dotfiles/.config/dmenu/dmenu_wrun
2022-05-29 16:41:06 +02:00

35 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
################################################################
# dmenu_wrun - dmenu script that simulates 'rofi -show window' #
# #
# Author: q3aql <q3aql@duck.com> #
# Last update: 29-05-2022 #
################################################################
list_applications() {
list_raw=$(xlsclients | cut -d " " -f 3 | sed -e 's/soffice/libreoffice/g')
for process in ${list_raw}; do
echo "${process}"
done
}
list_applications_icons() {
list_applications | while read current_app ; do
echo "${current_app}"
done
}
list_output=$(list_applications_icons | dmenu "$@" -p " window:")
run_output=$(echo ${list_output} | cut -c 4-999)
if [ "${run_output}" == "gimp" ] ; then
xdotool search --onlyvisible -classname "${run_output}" windowactivate &> /dev/null
elif [ "${run_output}" == "gimp-2.10" ] ; then
xdotool search --onlyvisible -classname "${run_output}" windowactivate &> /dev/null
elif [ "${run_output}" == "truecrypt" ] ; then
xdotool search --onlyvisible -classname "${run_output}" windowactivate &> /dev/null
else
xdotool search ".*${run_output}.*" windowactivate &> /dev/null
fi