I have recently given up my Desktop Environment and am now only using a Window Manager (i3) and X. It all works very well and I do not miss much. Except for one thing: the shutdown button. I can now only shutdown by issuing:
sudo shutdown -Ph now
from a terminal. This works, but I want to create a keybinding in i3 to shutdown by clicking
Mod+x. And I am not sure how this can be achieved. If I create a script in say
~/shutdown and refer to this with:
bindsym $mod+x exec ~/shutdown
Then this does not work; I figure because I am running as a regular user and I am sudoing in this script. I would be fine with having a terminal appear and prompting me for the password (although I prefer this to not require a password, if possible), but am not sure how to do this. What is a way to get this done?
Using Arch Linux.