Power button pressed by other keys, disable power off key

My laptop’s keyboard is probably broken. I disabled the power off menu from appearing but sometimes, textboxes get deselected randomly. This is really annoying at times.

Here is a video (sorry for low quality :p) https://streamable.com/pk4n2k

So you did successfully disable it?
I cant tell if you are asking for guidance or not. :sweat_smile:

Hot Tip - Try loading up another environment, such as on a Ventoy USB … if its still happening on the live system it becomes even easier to assume its the hardware.

If you’re using X and have a USB keyboard, you can disable your keyboard to test.

xinput

# find the id of your keyboard
# should look something like this
# ↳ AT Translated Set 2 keyboard    id=14   [slave  keyboard (3)]

xinput disable 14

For a more permanent option and for wayland, you can create a udev rule to disable the keyboard.

https://unix.stackexchange.com/questions/381944/how-to-disable-internal-keyboard-on-fedora-26-wayland/702857#702857

It happens on Windows aswell.
I am asking for guidance

I get

zsh: correct 'xinput' to '_xinput' [nyae]? n
zsh: command not found: xinput

Sorry I forgot to say it isn’t installed by default.

The package is xorg-xinput, but for future reference you can find the package like this:

sudo pacman -Fy xinput

# or use the full path
sudo pacman -Fy /usr/bin/xinput

I don’t want to disable the keyboard. I want to disable the power off key.

I thought you already had disabled it, and were thinking the keyboard was still causing issues. Perhaps I missed the “menu” part.


Anyway the power button should be the same, if using X. Not sure if the udev rule would work, but we can make a systemd service to make it permanent.

↳ Power Button         id=6    [slave  keyboard (3)]

If in doubt please post the output of xinput, unless you’re using wayland. Not sure how to do it in wayland, yet.

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ HTIX5288:00 0911:5288 Mouse               id=9    [slave  pointer  (2)]
⎜   ↳ HTIX5288:00 0911:5288 Touchpad            id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Intel HID events                          id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]
    ↳ USB 2.0 Camera: USB 2.0 Camera            id=8    [slave  keyboard (3)]
    ↳ Intel HID 5 button array                  id=12   [slave  keyboard (3)]
    ↳ Video Bus                                 id=6    [slave  keyboard (3)]

I did xinput disable 7 and I don’t have my issue anymore, so I think that’s good enough. I’ll just make a systemd service to do that everytime.

1 Like

I forgot to mention that the id changes, so best to use the name for the systemd service. I’m too used to using the id as I mostly just play around with this stuff.

xinput disable "Power Button"
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.