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

Greetings,

I'm going to expand a bit on the previous post by allowing for a parameter to be passed to the Pb_poweroff.sh script so that more than one key-binding may trigger the script for a different desired affect -- reboot for instance.  So let's first make some minor changes to the script in /usr/local/sbin/

Pb_poweroff.sh

Code:
#!/bin/sh

if [ "$1" = "OFF" ]
then
   systemctl poweroff
else
   systemctl reboot
fi


The default of the above script is to reboot the Pinebook, regardless of parameter.  On the other hand, if the parameter passed is "OFF" then the command script will shutdown and power off the Pinebook as expected.

To make the changes effective lets change our power off bindsym in  ~/.config/i3/config  to the following:

       bindsym $mod+Shift+XF86_PowerOff exec sudo /usr/local/sbin/Pb_poweroff.sh OFF

To make the reboot change effective add the following bindsym to  ~/.config/i3/config  :

       bindsym $mod+Control+XF86_PowerOff exec sudo /usr/local/sbin/Pb_poweroff.sh REBOOT

Notice I've changed the modifier key from Shift to Control,  and I've changed the parameter to REBOOT.  The effect is that the power button used with $mod+Shift will power off, while the power button used with $mod+Control will in fact reboot the system.

Note:  to make the changes active press $mod+Shift+c to re-read the config file, or press $mod+Shift+r to restart the i3 window manager.

Shy
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

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


Messages In This Thread
RE: How to set the Power Off key binding in i3wm for the Pinebook - by MarkHaysHarris777 - 09-17-2017, 11:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  DietPi OS for Pinebook MichaIng 3 5,143 03-11-2024, 05:02 PM
Last Post: oxoocoffee
  Slarm64 on Pinebook [Slackware Arm - 64 bit] KRT 46 59,538 09-26-2023, 03:18 PM
Last Post: mara
  Broke pinebook GUI, what to do, fix or install new? acruhl 2 771 07-13-2023, 05:43 PM
Last Post: acruhl
  Orignal PineBook jwp1000 1 603 07-10-2023, 07:44 AM
Last Post: tophneal
  Pinebook no longer boots rjtanner 12 3,232 04-13-2023, 01:09 PM
Last Post: tophneal
  Stock Debian on original Pinebook moonwalkers 1 3,114 01-29-2022, 10:37 PM
Last Post: cel
  Write image to eMMC - Pinebook 11.6" irongarment 4 3,659 01-04-2022, 09:22 PM
Last Post: irongarment
  E: The repository 'http://pinebook.kde.org.uk bionic Release' no longer has a Release pixelpaperyarn 3 5,081 05-07-2021, 10:20 AM
Last Post: tophneal
  pinebook.kde.org.uk no longer has release file?? supermassive 1 3,713 01-20-2021, 11:18 AM
Last Post: tophneal
Question Ran apt update on my Pinebook.. ford442 0 2,733 12-25-2020, 04:40 PM
Last Post: ford442

Forum Jump:


Users browsing this thread: 1 Guest(s)