summaryrefslogtreecommitdiff
path: root/.local/bin/quitapp
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 /.local/bin/quitapp
parent155a72d1e551a87667dcde31d6cf1c44284247bb (diff)
Closing a firefox window no longer kills it
Diffstat (limited to '.local/bin/quitapp')
-rwxr-xr-x.local/bin/quitapp11
1 files changed, 11 insertions, 0 deletions
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
+