Re: [i3]Not able to get the reboot/suspend script work.
于 Sun, 23 Mar 2014 19:14:13 +0530
Anubhav Yadav <anubhav1691@gmail.com> 写道:
> Hi, I am using debian 64 bit. I use lightdm to start i3. I am trying
> to get the reboot/suspend script work from i3 control mode as follows.
> I have created a script called i3exit , and placed it in ~/bin/
> directory, this directory is my PATH.
>
> Here are the contents of the script.
>
> #!/bin/sh
> lock() {
> i3lock
> }
>
> case "$1" in
> lock)
> i3lock -d -i /home/neo1691/.i3/i3lock_screen.png -n
> ;;
> logout)
> i3-msg exit
> ;;
> suspend)
> sudo pm-suspend
> ;;
> hibernate)
> sudo pm-hibernate
> ;;
> reboot)
> sudo reboot
> ;;
> shutdown)
> sudo halt
> ;;
> *)
> echo "Usage: $0
> {lock|logout|suspend|hibernate|reboot|shutdown}" exit 2Not able to
> get the reboot/suspend script work. esac
>
> Next in .i3/config I have added these lines,
>
> set $mode_system System (l) lock, (e) logout, (s) suspend, (h)
> hibernate, (r) reboot, (Shift+s) shutdown
> mode "$mode_system" {
> bindsym l exec --no-startup-id i3exit lock, mode "default"
> bindsym e exec --no-startup-id i3exit logout, mode "default"
> bindsym s exec --no-startup-id i3exit suspend, mode "default"
> bindsym h exec --no-startup-id i3exit hibernate, mode "default"
> bindsym r exec --no-startup-id i3exit reboot, mode "default"
> bindsym Shift+s exec --no-startup-id i3exit shutdown, mode
> "default"
>
> # back to normal: Enter or Escape
> bindsym Return mode "default"
> bindsym Escape mode "default"
> }
> bindsym $mod+Pause mode "$mode_system"
>
>
> Now if I run i3exit suspend, then my laptop suspends properly. [After
> asking the password]. If I run i3exit lock, then my laptop gets
> locked, without asking for the password.
>
> But when I press $mod+pause the control mod popups appears on the
> i3statusbar and if I press l (lock) nothing happens and the dialogue
> box disappears!
>
> If I open up a terminal and `echo $PATH`, then my folder, ~/bin is
> seen there. But if I run this specific command:
> `tr '\0' '\n' </proc/$(pidof i3)/environ | grep PATH` then the $PATH
> doesn't have the concerned folder.
>
> Also, will adding this line :
> `neo1691 ALL=(ALL) ALL, NOPASSWD: /home/neo1691/bin/i3exit` will stop
> asking passwords if I run i3exit. I just want to make sure of the
> syntax!
>
> Any ideas will be appreciated. Thanks
>
>
I'm using i3 on debian sid i686.
Simply I use a shortchut to show the system
power dailog by i3-nagbar and use mouse to choose the button.
Beacuse of systemd, when poweroff/suspend the machine, there is no need
to enter password for a normal user.
That works for me.
Reply to: