mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-22 02:50:24 +10:00
Pushing dmenu and related scripts.
This commit is contained in:
31
.dmenu/dmenu_running_apps
Executable file
31
.dmenu/dmenu_running_apps
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
||||
;;
|
||||
Reference in New Issue
Block a user