dotfiles/.config/dmenu/dmenu_wrun
2022-05-28 01:56:42 +02:00

26 lines
705 B
Bash
Executable File

#!/bin/bash
# Search through open programs and switch to their tag
application=$(
# List all running programs
xlsclients |\
# Fix Virtualbox and LibreOffice
sed -e 's/.*VirtualBox/foobar virtualbox/g' -e 's/.*soffice/foobar libreoffice/g' |\
# Remove flash from results
grep -v "plugin-container" |\
# Show only app-names
cut -d" " -f3 |\
# Pipe to dmenu ($@ to include font settings from dwm/config.h)
dmenu -i -p " window:" $@
)
# Switch to chosen application
case $application in
gimp | truecrypt)
xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null
;;
*)
xdotool search ".*${application}.*" windowactivate &> /dev/null
;;
esac