The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 6,836β€…    Votes:  7β€…
Tags: 18.04   shortcut-keys   power-management  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/1128676
Title: How to disable sleep / suspend / hibernate HP keyboard buttons for Ubuntu 18.04?
ID: /2019/03/25/How-to-disable-sleep-_-suspend-_-hibernate-HP-keyboard-buttons-for-Ubuntu-18.04_
Created: March 25, 2019    Edited:  March 26, 2019
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


In addition to the Gnome Power settings you can set the systemd settings found in /etc/systemd/logind.conf:

My laptop looks like this:

$ cat /etc/systemd/logind.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=12288

Notice on my system the only option I’ve changed is HandleLidswitch. For your system I would override these defaults:

#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate

to this:

HandleSuspendKey=ignore
HandleHibernateKey=ignore

systemd is a little unique in that a line beginning with a hashtag (#) is not only a comment but also represents the default action taken.

Unfortunately I don’t have your keyboard to test this configuration.

NOTE: After saving changes either reboot to activate or use:

sudo systemctl restart systemd-logind.service
⇧ Can't remove environmental variable in Ubuntu 18.04 How to clear history in Gedit? (Ubuntu 18.04)  β‡©