From 4f5a891280c05f8c28d75fccde9f5c216e9f8672 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 15 Dec 2022 10:57:47 -0500 Subject: [PATCH] rofi: Make launch.sh a toggle script This lets us set the super key to launch.sh, which handles both opening rofi and closing it if it's already open. --- rofi/.config/rofi/launch.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rofi/.config/rofi/launch.sh b/rofi/.config/rofi/launch.sh index 4506c8d..1d420da 100755 --- a/rofi/.config/rofi/launch.sh +++ b/rofi/.config/rofi/launch.sh @@ -41,6 +41,12 @@ # fact that active windows will not handle DPI changes anyway, you should # probably have no GUIs running when switching DPI. +# Kill rofi if it's already running to make this a simple toggle script. +if pgrep -x rofi; then + killall rofi + exit +fi + ROFI_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2) ROFI_SCALE=$(expr $ROFI_DPI / 96) ROFI_DPI_SCALE=$(awk "BEGIN { print "1/$ROFI_SCALE" }")