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.
This commit is contained in:
Donovan Glover 2022-12-15 10:57:47 -05:00
parent ff4eddace5
commit 4f5a891280
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -41,6 +41,12 @@
# fact that active windows will not handle DPI changes anyway, you should # fact that active windows will not handle DPI changes anyway, you should
# probably have no GUIs running when switching DPI. # 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_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
ROFI_SCALE=$(expr $ROFI_DPI / 96) ROFI_SCALE=$(expr $ROFI_DPI / 96)
ROFI_DPI_SCALE=$(awk "BEGIN { print "1/$ROFI_SCALE" }") ROFI_DPI_SCALE=$(awk "BEGIN { print "1/$ROFI_SCALE" }")