From 3b396b67111ecf963716d70ac5ee93a1522fef5e Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 13 Mar 2023 10:43:52 +0800 Subject: Update --- X11/ask_before_close.sh | 10 ++++++++++ X11/openbox/rc.xml | 4 +++- X11/rename_current_window.sh | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 X11/ask_before_close.sh 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 @@ +#! /bin/sh + +current_window=$(xdotool getactivewindow) + +if [ $(xdotool getwindowclassname $current_window) = CONFIRM_BEFORE_CLOSE ]; then + zenity --question --text "Are you sure you want to close this window?" || \ + exit 1 +fi + +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 @@ - + + ~/helper/X11/ask_before_close.sh + 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 @@ #! /bin/sh -xdotool set_window --name "$1" "$(xdotool getactivewindow)" +xdotool set_window --name "$1" --class CONFIRM_BEFORE_CLOSE "$(xdotool getactivewindow)" -- cgit v1.2.3-70-g09d2