Dotfiles config update (2022-07-29)
This commit is contained in:
parent
393c602e67
commit
035f027946
|
@ -42,7 +42,9 @@ dist: clean
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f dmenu dmenu_drun dmenu_run dmenu_wrun dmenu_fbrun dmenu_themes dmenu_cmd stest $(DESTDIR)$(PREFIX)/bin
|
mkdir -p /usr/share/fonts/truetype/ubuntumono/
|
||||||
|
tar Jxvf fonts/ubuntumono-nerd-fonts.tar.xz -C /usr/share/fonts/truetype/ubuntumono/
|
||||||
|
cp -f dmenu dmenu_drun dmenu_run dmenu_wrun dmenu_fbrun dmenu_themes dmenu_cmd dmenu_close stest $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_drun
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_drun
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
||||||
|
@ -50,6 +52,7 @@ install: all
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_fbrun
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_fbrun
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_themes
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_themes
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_cmd
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_cmd
|
||||||
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_close
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
|
||||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
|
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
|
||||||
|
@ -65,6 +68,7 @@ uninstall:
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_fbrun\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_fbrun\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_themes\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_themes\
|
||||||
$(DESTDIR)$(PREFIX)/bin/dmenu_cmd\
|
$(DESTDIR)$(PREFIX)/bin/dmenu_cmd\
|
||||||
|
$(DESTDIR)$(PREFIX)/bin/dmenu_close\
|
||||||
$(DESTDIR)$(PREFIX)/bin/stest\
|
$(DESTDIR)$(PREFIX)/bin/stest\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
|
||||||
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
$(DESTDIR)$(MANPREFIX)/man1/stest.1
|
||||||
|
|
90
.config/dmenu/dmenu_close
Executable file
90
.config/dmenu/dmenu_close
Executable file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# dmenu_close - dmenu script for poweroff/reboot/suspend and logout #
|
||||||
|
# #
|
||||||
|
# Author: q3aql <q3aql@duck.com> #
|
||||||
|
# Last update: 29-07-2022 #
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Configuration variables
|
||||||
|
load_theme_path="${HOME}/.dmenu"
|
||||||
|
load_themes="${load_theme_path}/themes"
|
||||||
|
load_theme_file="${load_theme_path}/load_theme"
|
||||||
|
|
||||||
|
function load_theme() {
|
||||||
|
if [ -f "${load_theme_file}" ] ; then
|
||||||
|
source "${load_theme_file}"
|
||||||
|
else
|
||||||
|
mkdir -p "${load_theme_path}"
|
||||||
|
mkdir -p "${load_themes}"
|
||||||
|
echo "#!/bin/bash" > ${load_theme_file}
|
||||||
|
echo "" >> ${load_theme_file}
|
||||||
|
echo "NFCOLOR=\"#bbbbbb\"" >> ${load_theme_file}
|
||||||
|
echo "NBCOLOR=\"#1f1f35\"" >> ${load_theme_file}
|
||||||
|
echo "SFCOLOR=\"#eeeeee\"" >> ${load_theme_file}
|
||||||
|
echo "SBCOLOR=\"#664477\"" >> ${load_theme_file}
|
||||||
|
source "${load_theme_file}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_session_options() {
|
||||||
|
echo " Restart"
|
||||||
|
echo " Shutdown"
|
||||||
|
echo " Suspend"
|
||||||
|
dwm_session=$(ps -ef | grep " dwm" | grep -v "grep")
|
||||||
|
spectrwm_session=$(ps -ef | grep " spectrwm" | grep -v "grep")
|
||||||
|
qtile_session=$(ps -ef | grep " qtile" | grep -v "grep")
|
||||||
|
sway_session=$(ps -ef | grep " sway" | grep -v "grep")
|
||||||
|
i3_session=$(ps -ef | grep " i3" | grep -v "grep")
|
||||||
|
sessions_check="${dwm_session}${spectrwm_session}${qtile_session}${sway_session}${i3_session}"
|
||||||
|
if [ ! -z "${sessions_check}" ] ; then
|
||||||
|
echo " Logout"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function close_session() {
|
||||||
|
killall dwm
|
||||||
|
killall spectrwm
|
||||||
|
killall sway
|
||||||
|
killall i3
|
||||||
|
qtile_pid=$(ps -ef | grep " qtile" | grep -v "grep" | tr -s " " | cut -d " " -f 2 | head -1)
|
||||||
|
if [ ! -z ${qtile_pid} ] ; then
|
||||||
|
kill ${qtile_pid}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate_spaces() {
|
||||||
|
num_spaces=${1}
|
||||||
|
count_spaces=1
|
||||||
|
while [ ${count_spaces} -le ${num_spaces} ] ; do
|
||||||
|
echo -n " "
|
||||||
|
count_spaces=$(expr ${count_spaces} + 1)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_action() {
|
||||||
|
load_theme
|
||||||
|
systemctl --version &> /dev/null
|
||||||
|
systemd_error=$?
|
||||||
|
if [ ${systemd_error} -eq 0 ] ; then
|
||||||
|
systemctl ${1}
|
||||||
|
else
|
||||||
|
echo > /dev/null | dmenu -i -nb "${NBCOLOR}" -nf "${NFCOLOR}" -sb "${SBCOLOR}" -sf "${SFCOLOR}" -p " You need SystemD for ${1} $(generate_spaces 60)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
load_theme
|
||||||
|
list_output=$(load_session_options | dmenu -i -nb "${NBCOLOR}" -nf "${NFCOLOR}" -sb "${SBCOLOR}" -sf "${SFCOLOR}" -l 18 -p " Session:")
|
||||||
|
run_output=$(echo ${list_output} | cut -c 5-999)
|
||||||
|
if [ ! -z "${run_output}" ] ; then
|
||||||
|
if [ "${run_output}" == "Restart" ] ; then
|
||||||
|
run_action "reboot"
|
||||||
|
elif [ "${run_output}" == "Shutdown" ] ; then
|
||||||
|
run_action "poweroff"
|
||||||
|
elif [ "${run_output}" == "Suspend" ] ; then
|
||||||
|
run_action "suspend"
|
||||||
|
elif [ "${run_output}" == "Logout" ] ; then
|
||||||
|
close_session
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -4,7 +4,7 @@
|
||||||
# dmenu_drun - dmenu script that simulates 'rofi -show drun' #
|
# dmenu_drun - dmenu script that simulates 'rofi -show drun' #
|
||||||
# #
|
# #
|
||||||
# Author: q3aql <q3aql@duck.com> #
|
# Author: q3aql <q3aql@duck.com> #
|
||||||
# Last update: 20-07-2022 #
|
# Last update: 29-07-2022 #
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
# Configuration variables
|
# Configuration variables
|
||||||
|
@ -16,6 +16,7 @@ desktop_files="/usr/share/applications"
|
||||||
desktop_files_local="/usr/local/share/applications"
|
desktop_files_local="/usr/local/share/applications"
|
||||||
desktop_files_home="${HOME}/.local/share/applications"
|
desktop_files_home="${HOME}/.local/share/applications"
|
||||||
desktop_files_flatpak="/var/lib/flatpak/exports/share/applications"
|
desktop_files_flatpak="/var/lib/flatpak/exports/share/applications"
|
||||||
|
desktop_files_snap="/var/lib/snapd/desktop/applications"
|
||||||
|
|
||||||
function load_theme() {
|
function load_theme() {
|
||||||
if [ -f "${load_theme_file}" ] ; then
|
if [ -f "${load_theme_file}" ] ; then
|
||||||
|
@ -46,12 +47,15 @@ function list_desktop_files() {
|
||||||
if [ -d "${desktop_files_flatpak}" ] ; then
|
if [ -d "${desktop_files_flatpak}" ] ; then
|
||||||
ls -1 "${desktop_files_flatpak}/" | grep ".desktop"
|
ls -1 "${desktop_files_flatpak}/" | grep ".desktop"
|
||||||
fi
|
fi
|
||||||
|
if [ -d "${desktop_files_snap}" ] ; then
|
||||||
|
ls -1 "${desktop_files_snap}/" | grep ".desktop"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_desktop_icons() {
|
function list_desktop_icons() {
|
||||||
echo " Scan New Desktop Files"
|
echo " Scan/Update Desktop Files"
|
||||||
ls -1 "${load_desktop_files}/" | while read current_desktop ; do
|
ls -1 "${load_desktop_files}/" | while read current_desktop ; do
|
||||||
echo " ${current_desktop}"
|
echo " ${current_desktop}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +101,13 @@ function create_list_files() {
|
||||||
if [ -f "${desktop_files_flatpak}/${current_file}" ] ; then
|
if [ -f "${desktop_files_flatpak}/${current_file}" ] ; then
|
||||||
name_show=$(cat "${desktop_files_flatpak}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g')
|
name_show=$(cat "${desktop_files_flatpak}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g')
|
||||||
if [ ! -z "${name_show}" ] ; then
|
if [ ! -z "${name_show}" ] ; then
|
||||||
echo "${desktop_files_flatpak}/${current_file}" > "${load_desktop_files}/${name_show}"
|
echo "${desktop_files_flatpak}/${current_file}" > "${load_desktop_files}/${name_show} (Flatpak)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f "${desktop_files_snap}/${current_file}" ] ; then
|
||||||
|
name_show=$(cat "${desktop_files_snap}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g')
|
||||||
|
if [ ! -z "${name_show}" ] ; then
|
||||||
|
echo "${desktop_files_snap}/${current_file}" > "${load_desktop_files}/${name_show} (Snap)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -116,7 +126,7 @@ create_list_files
|
||||||
list_output=$(list_desktop_icons | dmenu -i -nb "${NBCOLOR}" -nf "${NFCOLOR}" -sb "${SBCOLOR}" -sf "${SFCOLOR}" -l 18 -p " drun:")
|
list_output=$(list_desktop_icons | dmenu -i -nb "${NBCOLOR}" -nf "${NFCOLOR}" -sb "${SBCOLOR}" -sf "${SFCOLOR}" -l 18 -p " drun:")
|
||||||
run_output=$(echo ${list_output} | cut -c 5-999)
|
run_output=$(echo ${list_output} | cut -c 5-999)
|
||||||
if [ ! -z "${run_output}" ] ; then
|
if [ ! -z "${run_output}" ] ; then
|
||||||
if [ "${run_output}" == "Scan New Desktop Files" ] ; then
|
if [ "${run_output}" == "Scan/Update Desktop Files" ] ; then
|
||||||
echo "0" > ${HOME}/.dmenu/read_list
|
echo "0" > ${HOME}/.dmenu/read_list
|
||||||
create_list_files
|
create_list_files
|
||||||
$0
|
$0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user