dmenu-scripts/dmenu_run

41 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-05-29 15:49:43 +02:00
#!/bin/bash
############################################################
# dmenu_run - dmenu script that simulates 'rofi -show run' #
# #
# Author: q3aql <q3aql@duck.com> #
# Last update: 29-05-2022 #
############################################################
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/
#if [ "${current_path}" == "/bin" ] ; then
# count_path=$(expr ${count_path} + 1)
#else
# ls -1 ${current_path}/
# count_path=$(expr ${count_path} + 1)
#fi
ls -1 ${current_path}/
count_path=$(expr ${count_path} + 1)
2022-05-29 15:49:43 +02:00
fi
done
}
list_binaries_icons() {
list_binaries | while read current_binary ; do
echo " ${current_binary}"
done
}
list_output=$(list_binaries_icons | dmenu "$@" -p " run:")
run_output=$(echo "${list_output}" | cut -c4-999)
${run_output}