summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-01-26 14:20:13 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2024-01-26 14:20:13 -0500
commit231013623dff3e6eb68ab9e3883e5e2262bdab60 (patch)
tree50304b395e0c196307630762637a5485ebfc1c00
parent155a72d1e551a87667dcde31d6cf1c44284247bb (diff)
Closing a firefox window no longer kills it
-rw-r--r--.config/sxhkd/sxhkdrc3
-rwxr-xr-x.local/bin/quitapp11
2 files changed, 13 insertions, 1 deletions
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index be0e7c0..e35821f 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -27,7 +27,8 @@ super + shift + q
dwmc quit
## Quit Current/focused App
super + q
- kill -15 `xdotool getwindowfocus getwindowpid`
+ quitapp
+ # kill -15 `xdotool getwindowfocus getwindowpid`
## Toggle the dwm bar
super + b
dwmc togglebar
diff --git a/.local/bin/quitapp b/.local/bin/quitapp
new file mode 100755
index 0000000..60a8644
--- /dev/null
+++ b/.local/bin/quitapp
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+active_window="$(xdotool getwindowfocus)"
+active_class=$(xprop -id "$active_window" WM_CLASS | awk '{print $4}')
+
+if [ "$active_class" = '"firefox"' ]; then
+ xdotool windowclose "$active_window"
+else
+ kill -15 "$(xdotool getwindowfocus getwindowpid)"
+fi
+