I have a little problem with the i3 tiling window manager's ~/.i3/config file. I am trying to set the pm-suspend utility as a key-binding of Mod4 (the windows key) + p (the p char).
I have this bash script called suspendandlock in /usr/bin/:
#!/bin/bash
sudo pm-suspend | i3lock -i /home/antony/unity-desk.png -p default -d -n
I previously modified the /etc/sudoers file with visudo, adding this line:
%users ALL = NOPASSWD: /usr/sbin/pm-suspend
So that no one needs the password to execute pm-suspend utility.
Then I have my i3 config file, where I added this:
bindsym $mod+p exec suspendandlock
Where $mod is the Mod4 key. The script works fine from gnome-terminal when I type the suspendandlock command -> it suspends the system and blocks the screen as expected.
But when I type Mod4+p from keyboard it only blocks the screen without executing pm-suspend. Why does it not work?
Does anyone knows where I am wrong?
To close an window, press Alt+Shift+Q. This tells i3 to send a regular "close window" command to the application, that is, shutting it down gracefully.
To logout, press Mod+shift+e (like exit).
It looks like OP solved the problem, but for anyone else who needed to fix it (myself included), just run:
sudo usermod -aG users `whoami`
which pm-suspend || sudo apt-get install pm-utils #make sure you have pm-suspend command, install it if you don't
run sudo visudo
and add:
%users ALL = NOPASSWD: /usr/sbin/pm-suspend
and then add:
bindsym $mod+p exec "sudo pm-suspend | i3lock"
to ~/.i3/config. Running $mod+p will now lock and then suspend your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With