mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2023-02-13 20:55:19 -05:00
32 lines
908 B
Text
32 lines
908 B
Text
|
#!/bin/bash
|
||
|
# ____ _____
|
||
|
# | _ \_ _| Derek Taylor (DistroTube)
|
||
|
# | | | || | http://www.youtube.com/c/DistroTube
|
||
|
# | |_| || | http://www.gitlab.com/dwt1/
|
||
|
# |____/ |_|
|
||
|
#
|
||
|
# Search through open programs and switch to their tag in dwm.
|
||
|
# The package xorg-xlsclients is required!
|
||
|
|
||
|
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 "switch to:" $@
|
||
|
)
|
||
|
|
||
|
# Switch to chosen application
|
||
|
case $application in
|
||
|
gimp | truecrypt)
|
||
|
xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null
|
||
|
;;
|
||
|
*)
|
||
|
xdotool search ".*${application}.*" windowactivate &> /dev/null
|
||
|
;;
|