I have the following script called pwrmenu:
Code:
#!/bin/sh
OPTION=$(echo -e 'hibernate\nsuspend\nreboot\nshutdown' | dmenu "$@")
case $OPTION in
hibernate)
sudo /bin/systemctl hibernate
;;
suspend)
sudo /bin/systemctl suspend
;;
reboot)
sudo /bin/systemctl reboot
;;
shutdown)
sudo /bin/systemctl poweroff
;;
*)
echo "whuh?"
exit 1
;;
esac
I am a member of the 'power' group which I created:
Code:
~ > groups
phil wheel audio jackuser power
As per visudo, members of the 'power' group can run power management commands via sudo with no password:
Code:
[...]
Cmnd_Alias POWER = /bin/systemctl hibernate, /bin/systemctl reboot, /bin/systemctl suspend, /bin/systemctl poweroff
[...]
%power ALL=(ALL) NOPASSWD: POWER
[...]
Running, e.g., 'sudo /bin/systemctl hibernate' from a terminal hibernates the machine with no password. Running pwrmenu (the script above) from a terminal allows me to manage power with no password.
But in my Openbox config, I have the following:
Code:
[...]
<keybind key="W-p">
<action name="Execute">
<command>/home/phil/bin/pwrmenu -b -fn '-*-clean-medium-r-*-*-16-*-*-*-*-*-*-*' -nb '#000000' -nf '#0088ff' -sb '#0088ff' -sf '#000000'</command>
</action>
</keybind>
[...]
When I hit Win+p, the pwrmenu comes up, but none of the options actually do anything; the computer's power state does not change. How could I have it so that I can use the script above to change the computer's power state?