This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmenu_run
executable file
·61 lines (55 loc) · 1.89 KB
/
dmenu_run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
############################################################
# dmenu_run - dmenu script that simulates 'rofi -show run' #
# #
# Author: q3aql <[email protected]> #
# Last update: 10-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 list_binaries() {
binaries=0
path_binaries=${PATH}
count_path=1
while [ ${binaries} -eq 0 ] ; do
current_path=$(echo ${path_binaries} | cut -d ":" -f ${count_path})
if [ -z "${current_path}" ] ; then
binaries=1
else
# Extra code / When /bin is the same that /usr/bin/
bin_same=$(ls -la ${current_path} | grep "> usr/bin")
if [ -z "${bin_same}" ] ; then
ls -1 ${current_path}/
count_path=$(expr ${count_path} + 1)
else
count_path=$(expr ${count_path} + 1)
fi
fi
done
}
function list_binaries_icons() {
list_binaries | while read current_binary ; do
echo " ${current_binary}"
done
}
load_theme
list_output=$(list_binaries_icons | dmenu -i -nb "${NBCOLOR}" -nf "${NFCOLOR}" -sb "${SBCOLOR}" -sf "${SFCOLOR}" -l 18 -p " run:")
run_output=$(echo "${list_output}" | cut -c4-999)
${run_output}