Skip to content

Commit

Permalink
Map most system control keys to poweroff
Browse files Browse the repository at this point in the history
With the typical use of the kiosk system there is little point to
suspending the machine, and it is more likely to confuse users than
help. With this change we set most simple key presses to ignored and map
all long presses to poweroff, which is the sensible action.

Because at this level both keyboard power keys and "regular" on-device
power keys are handled, we can not disable the power key completely.

When expected remote control devices have been clarified, we may want to
go back and handle all simple presses in the UI instead of ignoring or
immediately action on them, asking for a second press to confirm
poweroff. In this case logind can be told to hold off via DBUS locks.

As an alternative I tried resetting the key mappings via `xmodmap`, but
found that the keys still seemd to be handled at the low level.

https://www.freedesktop.org/software/systemd/man/latest/logind.conf.html#HandlePowerKey=
  • Loading branch information
knuton committed Mar 28, 2024
1 parent d2eeb7f commit b3f89e4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions application.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ rec {
};
};

# Ignore system control keys that do not make sense for kiosk applications
services.logind.extraConfig = ''
HandleSuspendKey=ignore
HandleRebootKey=ignore
HandleHibernateKey=ignore
HandlePowerKey=poweroff
HandlePowerKeyLongPress=poweroff
HandleRebootKeyLongPress=poweroff
HandleSuspendKeyLongPress=poweroff
HandleHibernateKeyLongPress=poweroff
'';

# Driver service
systemd.services."dividat-driver" = {
description = "Dividat Driver";
Expand Down
4 changes: 4 additions & 0 deletions controller/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- kiosk: Add a key combination to perform hard refresh (Ctrl-Shift-R)
- os: Added localization options for Polish and Czech

## Changed

- os: Ignore suspend and hibernation key presses, but interpret as poweroff when long-pressed

# [2023.9.1] - 2024-03-15

# [2023.9.1-VALIDATION] - 2024-03-12
Expand Down
2 changes: 2 additions & 0 deletions docs/user-manual/Readme.org
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Connection to an attached Dividat Senso will automatically be configured. To man

The system may be shut down by pressing the power button on the computer or alternatively from the administrator menu.

When a remote control with a power button is connected, the system may be shut down by long-pressing the power button.

* Administration

<<administration>>A menu for system administration may be accessed with the key combination ~Ctrl-Shift-F12~.
Expand Down

0 comments on commit b3f89e4

Please sign in to comment.