diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-03-13 10:43:52 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-03-13 10:43:52 +0800 |
commit | 3b396b67111ecf963716d70ac5ee93a1522fef5e (patch) | |
tree | 5459d9e0233308e3594ca2f614f9a137c984e608 | |
parent | f5c7e048fb6b0a3e5f22c0edf31c34911fb326d1 (diff) |
Update
-rwxr-xr-x | X11/ask_before_close.sh | 10 | ||||
-rw-r--r-- | X11/openbox/rc.xml | 4 | ||||
-rwxr-xr-x | X11/rename_current_window.sh | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/X11/ask_before_close.sh b/X11/ask_before_close.sh new file mode 100755 index 0000000..7dfeda8 --- /dev/null +++ b/X11/ask_before_close.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | current_window=$(xdotool getactivewindow) | ||
4 | |||
5 | if [ $(xdotool getwindowclassname $current_window) = CONFIRM_BEFORE_CLOSE ]; then | ||
6 | zenity --question --text "Are you sure you want to close this window?" || \ | ||
7 | exit 1 | ||
8 | fi | ||
9 | |||
10 | xdotool windowkill $current_window | ||
diff --git a/X11/openbox/rc.xml b/X11/openbox/rc.xml index 1c22271..1a78d45 100644 --- a/X11/openbox/rc.xml +++ b/X11/openbox/rc.xml | |||
@@ -715,7 +715,9 @@ | |||
715 | </action> | 715 | </action> |
716 | </keybind> | 716 | </keybind> |
717 | <keybind key="A-q"> | 717 | <keybind key="A-q"> |
718 | <action name="Close"/> | 718 | <action name="Execute"> |
719 | <command>~/helper/X11/ask_before_close.sh</command> | ||
720 | </action> | ||
719 | </keybind> | 721 | </keybind> |
720 | <keybind key="A-w"> | 722 | <keybind key="A-w"> |
721 | <action name="Iconify"/> | 723 | <action name="Iconify"/> |
diff --git a/X11/rename_current_window.sh b/X11/rename_current_window.sh index c66c86b..d686ba4 100755 --- a/X11/rename_current_window.sh +++ b/X11/rename_current_window.sh | |||
@@ -1,3 +1,3 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh |
2 | 2 | ||
3 | xdotool set_window --name "$1" "$(xdotool getactivewindow)" | 3 | xdotool set_window --name "$1" --class CONFIRM_BEFORE_CLOSE "$(xdotool getactivewindow)" |