How to set the Power Off key binding in i3wm for the Pinebook

The purpose of this blog post is to detail the steps necessary to set the Power Off key-binding for the Pinebook in i3 window manager.  We don't want the Pinebook to come crashing down if we accidentally touch the poweroff button -- so we'll set a key-binding that makes sense requiring at least two other keys , for instance the $mod key and the Shift key.  The following key-binding should bring the system down cleanly ( and power off properly ) without prompting for a password:


The key-binding will be placed in the i3 config;  but I'm getting ahead of myself.  The first step is to build the poweroff script in /usr/local/sbin/



The simple script above should be placed in  /usr/local/sbin/  and should be made active with the following commands:

       sudo  chown  root:root

       sudo  chmod  0754

The next step is to place a rule file in  /etc/sudoers.d/  so that the command trigger will not prompt for the sudo password when the key-binding is pressed.  Creat the following rule file in /etc/sudoers.d/  :


# Pb power rule
Cmnd_Alias PBPOWEROFF=/usr/local/sbin/

Place the above rule file in the  /etc/sudoers.d/  directory and activate with the following commands :

       sudo  chown  root:root  Pb_power_rule

       sudo  chmod  0440  Pb_power_rule

The last step is to place the following bindsym entry in the i3 configuration  ~/.config/i3/config  , in your home directory:

       bindsym  $mod+Shift+XF86_PowerOff  exec  sudo  /usr/local/sbin/

Place the above bindsym entry somewhere near the end of your i3 config after the "resize"  and before the "bar".  The configuration file is  ~/.config/i3/config

Activate the key-binding by either pressing $mod+Shift+c to re-read the config,  or $mod+Shift+r to restart i3wm.


Pressing the Pinebook power button returns scancode 124;  key-sym XF86_PowerOff.  This by default does nothing in i3wm;  unlike other OS window manager | desktops  ,  which typically pulls up the shutdown dialogue.

With our keybinding in effect the script will be called with sudo,  and because the Pb_power_rule file exists in /etc/sudoers.d/  the command trigger will not prompt for the password,  but the poweroff command will simply take effect:   while holding down the mod key,  and the Shift key together,  press the power button and the i3 window manager will exit and the system will cleanly shutdown and power off.

marcushh777    Cool

please join us for a chat @   or ssl

( I regret that I am not able to respond to personal messages;  let's meet on irc! )

Messages In This Thread
How to set the Power Off key binding in i3wm for the Pinebook - by MarkHaysHarris777 - 09-16-2017, 10:21 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Slarm64 on Pinebook [Slackware Arm - 64 bit] KRT 8 325 04-01-2020, 12:53 AM
Last Post: e-minguez
  pinebook black screen when booting with "different power mode than last used" penzoiders 10 968 03-27-2020, 02:08 AM
Last Post: mr.angeli
Information Manjaro ARM for Pinebook erchache2000 73 8,213 03-05-2020, 07:15 AM
Last Post: tophneal
  Kali Linux for the Pinebook Luke 1 215 03-03-2020, 05:01 AM
Last Post: e-minguez
  Anyway to run Teamviewer for ARM/Pinebook? Ekkaia 8 3,304 01-16-2020, 08:51 PM
Last Post: dhosh
  Pinebook is going the way of Betamax? trigger 8 738 01-06-2020, 09:57 AM
Last Post: Jeremiah Cornelius
  Pinebook Wlan Driver does not work properly matze79 2 171 12-15-2019, 02:50 AM
Last Post: matze79
  Q4OS for PINEBOOK q4osteam 89 30,053 11-12-2019, 09:17 PM
Last Post: ac8dg
  Pinebook 1080p / KDE Neon freezes every 5-10 min pyrrhumain 12 1,056 11-02-2019, 10:03 AM
Last Post: rookieone
  Are Pinebook images compatible with Pine64+? starcrescent 7 394 09-18-2019, 09:22 AM
Last Post: tophneal

Forum Jump:

Users browsing this thread: 1 Guest(s)