PINE64
Disable the Power Button or make it do something else - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: Disable the Power Button or make it do something else (/showthread.php?tid=14024)



Disable the Power Button or make it do something else - User 22018 - 05-29-2021

Loving the Pinebook Pro on i3 Manjaro, but the power button is too close to the backspace and I keep hitting it.

I've tried the two things in this guide: https://forum.pine64.org/showthread.php?tid=8261&highlight=disable+power+button

1. Editing the logind.conf file
2.  this fancy commmand : systemd-inhibit --what=handle-power-key --who=i3 --why="accidental strike defense" sleep infinity

Neither of these two things worked and I've not found a solution on the manjaro forum. 


Any advice?


RE: Disable the Power Button or make it do something else - rimaille - 05-30-2021

Hi, dont know for i3, on sway i did :

1/ inhibit powerbutton in systemd/logind.conf

HandlePowerKey=ignore

2/ sway/config

# power button
bindsym XF86PowerOff exec ~/bin/wayland_toggle_screen.sh

3/ with wayland_toggle_screen.sh :

#!/bin/sh
read lcd < /tmp/lcd
if [ "$lcd" -eq "0" ]; then
swaymsg "output * dpms on"
echo 1 > /tmp/lcd
else
swaymsg "output * dpms off"
echo 0 > /tmp/lcd
fi

it works nice (powerbutton does switch screen on/off)


RE: Disable the Power Button or make it do something else - User 22018 - 06-01-2021

(05-30-2021, 10:35 PM)rimaille Wrote: Hi, dont know for i3, on sway i did :

1/ inhibit powerbutton in systemd/logind.conf

HandlePowerKey=ignore

2/ sway/config

# power button
bindsym XF86PowerOff exec ~/bin/wayland_toggle_screen.sh

3/ with wayland_toggle_screen.sh :

#!/bin/sh
read lcd < /tmp/lcd
    if [ "$lcd" -eq "0" ]; then
        swaymsg "output * dpms on"
        echo 1 > /tmp/lcd
    else
        swaymsg "output * dpms off"
        echo 0 > /tmp/lcd
    fi

it works nice (powerbutton does switch screen on/off)
Hi. I did 1 and for 2 I added this line to the shutdown code:


# Set shut down, restart and locking features
bindsym $mod+0 mode "$mode_system"
bindsym XF86PowerOff mode "$mode_system"

My only thought is maybe its a different key code on ANSI keyboard?


RE: Disable the Power Button or make it do something else - rimaille - 06-01-2021

(06-01-2021, 01:26 PM)jms429 Wrote: Hi. I did 1 and for 2 I added this line to the shutdown code:


# Set shut down, restart and locking features
bindsym $mod+0 mode "$mode_system"
bindsym XF86PowerOff mode "$mode_system"

My only thought is maybe its a different key code on ANSI keyboard?

Your response is quite incomplete.
Does 1 (inhibit power button) works ? after editing logind.conf, systemctl restart systemd-logind.service, or reboot.
Does your bind mod+0 works ? If it doesnt, not a problem of keycode, but code, in your conf.
Assuming you use i3, you must use x11, so try use xev to get your keycodes (mine is ansi too).


RE: Disable the Power Button or make it do something else - User 22018 - 06-03-2021

You are right, I wasn't helping with the lack of info.

1 (inhibit power button) didn't work, mod+0 worked fine.

Today, I added HandleSuspendKey=ignore and HandleHibernateKey=ignore to logind.conf then ran systemctl restart systemd-logind.service

and it is now working fine. Not sure if it is the extra entries, or restarting the service that did it.


RE: Disable the Power Button or make it do something else - Jonichka - 06-08-2021

instead of modifying logind.conf you can use https://www.linux.org/docs/man1/systemd-inhibit.html to take the lock on the handlepowerkey.


So that when sway is running the powerkey is inhibited and when it is stopped it isnt.


RE: Disable the Power Button or make it do something else - xmixahlx - 08-20-2021

i disable the power button via systemd and bind wlogout to sway exit.