From 76941c9959e80b3ebd81f7ff45ffb5b20794f9a3 Mon Sep 17 00:00:00 2001 From: q3aql Date: Sat, 28 May 2022 01:39:17 +0200 Subject: [PATCH] Dotfiles config update (2022-05-28) --- .config/dmenu/Makefile | 4 +++- .config/dmenu/dmenu_wrun | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 .config/dmenu/dmenu_wrun diff --git a/.config/dmenu/Makefile b/.config/dmenu/Makefile index b2db8b7..697dd89 100644 --- a/.config/dmenu/Makefile +++ b/.config/dmenu/Makefile @@ -42,10 +42,11 @@ dist: clean install: all mkdir -p $(DESTDIR)$(PREFIX)/bin - cp -f dmenu dmenu_drun dmenu_run stest $(DESTDIR)$(PREFIX)/bin + cp -f dmenu dmenu_drun dmenu_run dmenu_wrun stest $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_drun chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_wrun chmod 755 $(DESTDIR)$(PREFIX)/bin/stest mkdir -p $(DESTDIR)$(MANPREFIX)/man1 sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 @@ -57,6 +58,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ $(DESTDIR)$(PREFIX)/bin/dmenu_drun\ $(DESTDIR)$(PREFIX)/bin/dmenu_run\ + $(DESTDIR)$(PREFIX)/bin/dmenu_wrun\ $(DESTDIR)$(PREFIX)/bin/stest\ $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ $(DESTDIR)$(MANPREFIX)/man1/stest.1 diff --git a/.config/dmenu/dmenu_wrun b/.config/dmenu/dmenu_wrun new file mode 100755 index 0000000..4154827 --- /dev/null +++ b/.config/dmenu/dmenu_wrun @@ -0,0 +1,25 @@ +#!/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 " 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 + ;; +esac