Monday, June 10, 2019

a little more about that shutdown script

So, what is gxmessage (which I wrote about earlier, here and here)? A description:

Gxmessage is an xmessage clone for GTK based desktops. Gxmessage pops up a dialog window, displays a given message or question, then waits for the user's response. That response is returned as the program's exit code. Because gxmessage is a drop-in alternative to xmessage, gxmessage accepts any option xmessage would, and returns the same exit codes.

From: https://trmusson.dreamhosters.com/programs.html#gxmessage

From your Linux system, if you have gxmessage installed, you should have access to the man gxmessage document. Or the manpage can be found online -- see: https://helpmanual.io/man1/gxmessage/. (Arch Linux currently has that same May 25th, 2015 version of man gxmessage.)

Looks like the earliest mention of a gxmessage script for logging out of Openbox was posted online at "urukrama's weblog" back in 2007 (see: https://urukrama.wordpress.com/2007/12/03/confirm-to-shut-down-reboot-or-log-out-in-openbox/). Here's the script back then:

#!/bin/bash

gmessage "Are you sure you want to shut down your computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"_Log out":2,"_Reboot":3,"_Shut down":4 >/dev/null

case $? in
1)
echo "Exit";;
2)
killall openbox;;
3)
sudo shutdown -r now;;
4)
sudo shutdown -h now;;
esac

Well, that script used gmessage instead of gxmessage, and there are other differences compared to the script I'm using now, in Arch:

#!/bin/bash

gxmessage "Shut down the computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"_Log Out":2,"_Reboot":3,"_Shut Down":4 >/dev/null

case $? in
    1)
        echo "Exit";;
    2)
        openbox --exit;;
    3)
        systemctl reboot;;
    4)
        systemctl poweroff;;
esac

Anyway, I think that the great Openbox guru "urukrama" should get the credit for coming up with the script. And, who is/was "urukrama"? Along with "urukrama's weblog", I found the following:

https://www.opendesktop.org/u/urukrama/
https://github.com/urukrama

No comments: