gnometouchscreenwaylandwakeuplibinput

Wake up Gnome/GDM from lockscreen via touchscreen


I want to unlock/wakeup/..., a kiosk system from power-saving/locked-state when the touchscreen is pressed. The touchscreen is the only input device on this machine. (For testing purposes I attached an USB keyboard.)

I installed Gnome, GDM, etc. using NixOS 25.05 (not sure if relevant).

  services.xserver.displayManager.gdm = {
    enable = true;
    wayland = true;
  };
  services.xserver.desktopManager.gnome.enable = true;

  services.gnome.core-apps.enable = false;
  environment.gnome.excludePackages = (
    with pkgs;
    [
      gnome-tour
      gnome-backgrounds
    ]
  );

  services.libinput.enable = true; # Tried different values here...
  environment.systemPackages = with pkgs; [libinput usbutils pciutils]; # For debugging...

Situation: I'm in the GDM lockscreen and wait half a minute or so. The display turns black. When this happens, I see the following in the SSH session ...

$ dbus-monitor
signal time=1749564736.400317 sender=org.freedesktop.DBus -> destination=:1.83 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.83"
signal time=1749564736.400676 sender=org.freedesktop.DBus -> destination=:1.83 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.83"
signal time=1749564763.491195 sender=:1.10 -> destination=:1.40 serial=477 path=/org/gnome/Mutter/IdleMonitor/Core; interface=org.gnome.Mutter.IdleMonitor; member=WatchFired
   uint32 7
method call time=1749564763.491998 sender=:1.40 -> destination=:1.10 serial=69 path=/org/gnome/Mutter/IdleMonitor/Core; interface=org.gnome.Mutter.IdleMonitor; member=AddUserActiveWatch
method call time=1749564763.492312 sender=:1.40 -> destination=:1.10 serial=70 path=/org/gnome/Mutter/DisplayConfig; interface=org.freedesktop.DBus.Properties; member=Set
   string "org.gnome.Mutter.DisplayConfig"
   string "PowerSaveMode"
   variant       int32 3
method call time=1749564763.493924 sender=:1.10 -> destination=org.freedesktop.DBus serial=478 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string ":1.40"
method return time=1749564763.494359 sender=org.freedesktop.DBus -> destination=:1.10 serial=442 reply_serial=478
   string ":1.40"
method return time=1749564763.494633 sender=:1.10 -> destination=:1.40 serial=479 reply_serial=69
   uint32 9
method return time=1749564764.038010 sender=:1.10 -> destination=:1.40 serial=480 reply_serial=70
signal time=1749564764.038385 sender=:1.10 -> destination=(null destination) serial=481 path=/org/gnome/Mutter/DisplayConfig; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.gnome.Mutter.DisplayConfig"
   array [
      dict entry(
         string "PowerSaveMode"
         variant             int32 3
      )
   ]
   array [
   ]

Now, after pressing ESC on the keyboard, I see ...

$ libinput debug-events
-event3   KEYBOARD_KEY                +0.000s   *** (-1) pressed
 event3   KEYBOARD_KEY                +0.120s   *** (-1) released

... and ...

$ dbus-monitor
signal time=1749565006.666054 sender=:1.10 -> destination=:1.40 serial=482 path=/org/gnome/Mutter/IdleMonitor/Core; interface=org.gnome.Mutter.IdleMonitor; member=WatchFired
   uint32 9
method call time=1749565006.667388 sender=:1.40 -> destination=:1.10 serial=71 path=/org/gnome/Mutter/DisplayConfig; interface=org.freedesktop.DBus.Properties; member=Set
   string "org.gnome.Mutter.DisplayConfig"
   string "PowerSaveMode"
   variant       int32 0
method return time=1749565006.693257 sender=:1.10 -> destination=:1.40 serial=483 reply_serial=71
signal time=1749565006.696749 sender=:1.10 -> destination=(null destination) serial=484 path=/org/gnome/Mutter/DisplayConfig; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.gnome.Mutter.DisplayConfig"
   array [
      dict entry(
         string "PowerSaveMode"
         variant             int32 0
      )
   ]
   array [
   ]

The keypress seems to emit a dbus event so that PowerSaveMode is changed from 3 to 0. The display turns on when this happens. This is the behavior I want for the touchscreen, too.

However, when using the touchscreen, I see ...

$ libinput debug-events 
-event1   TOUCH_DOWN                  +87.149s  0 (0) 47.88/57.69 (126.53/95.47mm)
 event1   TOUCH_FRAME                 +87.149s  
 event1   TOUCH_UP                    +87.242s  0 (0)
 event1   TOUCH_FRAME                 +87.242s  
 event1   TOUCH_DOWN                  +90.434s  0 (0) 58.89/42.45 (155.61/70.25mm)
 event1   TOUCH_FRAME                 +90.434s  
 event1   TOUCH_MOTION                +91.188s  0 (0) 58.43/42.64 (154.40/70.57mm)
 event1   TOUCH_FRAME                 +91.188s  
 event1   TOUCH_UP                    +92.771s  0 (0)
 event1   TOUCH_FRAME                 +92.771s  

... but no dbus event is emitted. The display stays black.

What could help me pinpoint the issue is to better understand how a libinput event is processed by Gnome, GDM, Mutter, Clutter, ..., but I just can't get to the core issue even after reading quite a lot documentation.


System Information


[kiosk@kiosk:~]$ uname -a
Linux kiosk 6.12.32 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun  4 12:43:54 UTC 2025 x86_64 GNU/Linux
[kiosk@kiosk:~]$ sudo libinput list-devices
Device:           Power Button
Kernel:           /dev/input/event6
Group:            1
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           eGalax Inc. eGalaxTouch P81X32 2748 v02_S2 k4.18.203 Mouse
Kernel:           /dev/input/event2
Group:            2
Seat:             seat0, default
Size:             256x164mm
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      identity matrix
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           eGalax Inc. eGalaxTouch P81X32 2748 v02_S2 k4.18.203
Kernel:           /dev/input/event1
Group:            2
Seat:             seat0, default
Size:             264x165mm
Capabilities:     touch 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      identity matrix
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           SteelSeries SteelSeries Apex M500 Gaming Keyboard
Kernel:           /dev/input/event3
Group:            3
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           SteelSeries SteelSeries Apex M500 Gaming Keyboard
Kernel:           /dev/input/event4
Group:            3
Seat:             seat0, default
Capabilities:     keyboard pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           SteelSeries SteelSeries Apex M500 Gaming Keyboard
Kernel:           /dev/input/event5
Group:            3
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           AT Translated Set 2 keyboard
Kernel:           /dev/input/event0
Group:            4
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           ImExPS/2 Generic Explorer Mouse
Kernel:           /dev/input/event7
Group:            5
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   button
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive custom
Rotation:         0.0
[kiosk@kiosk:~]$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 009 Device 002: ID 0eef:c002 D-WAV Scientific Co., Ltd eGalaxTouch P81X32 2748 v02_S2 k4.18.203
Bus 009 Device 003: ID 1038:1607 SteelSeries ApS SteelSeries Apex M500 Gaming Keyboard
Bus 010 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
$ [kiosk@kiosk:~]$ busctl 
NAME                                   PID PROCESS         USER             CONNECTION    UNIT                       >
:1.0                                   411 systemd-oomd    systemd-oom      :1.0          systemd-oomd.service       >
:1.1                                   714 systemd-machine root             :1.1          systemd-machined.service   >
:1.10                                  832 gdm             root             :1.10         display-manager.service    >
:1.101                                2222 busctl          kiosk            :1.101        session-6.scope            >
:1.18                                  927 rtkit-daemon    root             :1.18         rtkit-daemon.service       >
:1.19                                  952 .colord-wrapped colord           :1.19         colord.service             >
:1.2                                     1 systemd         root             :1.2          init.scope                 >
:1.24                                  994 upowerd         root             :1.24         upower.service             >
:1.3                                   444 systemd-timesyn systemd-timesync :1.3          systemd-timesyncd.service  >
:1.38                                 1157 power-profiles- root             :1.38         power-profiles-daemon.servi>
:1.4                                   738 systemd-logind  root             :1.4          systemd-logind.service     >
:1.5                                   439 systemd-resolve systemd-resolve  :1.5          systemd-resolved.service   >
:1.50                                 1295 gdm-session-wor root             :1.50         session-2.scope            >
:1.54                                 1311 systemd         kiosk            :1.54         user@1000.service          >
:1.55                                 1325 .gnome-keyring- kiosk            :1.55         session-2.scope            >
:1.56                                 1333 gdm-wayland-ses kiosk            :1.56         session-2.scope            >
:1.57                                 1373 .gnome-session- kiosk            :1.57         user@1000.service          >
:1.58                                 1399 .gnome-shell-wr kiosk            :1.58         user@1000.service          >
:1.6                                   709 avahi-daemon    avahi            :1.6          avahi-daemon.service       >
:1.60                                 1492 .org.gnome.Shel kiosk            :1.60         user@1000.service          >
:1.61                                 1506 .gsd-sharing-wr kiosk            :1.61         user@1000.service          >
:1.63                                 1501 .gsd-print-noti kiosk            :1.63         user@1000.service          >
:1.64                                 1510 .gsd-usb-protec kiosk            :1.64         user@1000.service          >
:1.66                                 1504 .gsd-rfkill-wra kiosk            :1.66         user@1000.service          >
:1.68                                 1625 .gsd-printer-wr kiosk            :1.68         user@1000.service          >
:1.69                                 1631 .org.gnome.Scre kiosk            :1.69         user@1000.service          >
:1.7                                   730 accounts-daemon root             :1.7          accounts-daemon.service    >
:1.70                                 1652 .gvfs-udisks2-v kiosk            :1.70         user@1000.service          >
:1.71                                 1663 udisksd         root             :1.71         udisks2.service            >
:1.73                                 1697 .evolution-addr kiosk            :1.73         user@1000.service          >
:1.74                                 1399 .gnome-shell-wr kiosk            :1.74         user@1000.service          >
:1.75                                 1735 pipewire        kiosk            :1.75         user@1000.service          >
:1.76                                 1736 wireplumber     kiosk            :1.76         user@1000.service          >
:1.77                                 1737 pipewire-pulse  kiosk            :1.77         user@1000.service          >
:1.78                                 1499 .gsd-media-keys kiosk            :1.78         user@1000.service          >
:1.79                                 1500 .gsd-power-wrap kiosk            :1.79         user@1000.service          >
:1.8                                   756 polkitd         polkituser       :1.8          polkit.service             >
:1.80                                 1498 .gsd-keyboard-w kiosk            :1.80         user@1000.service          >
:1.82                                 1736 wireplumber     kiosk            :1.82         user@1000.service          >
:1.83                                 1736 wireplumber     kiosk            :1.83         user@1000.service          >
:1.85                                 1866 .xdg-desktop-po kiosk            :1.85         user@1000.service          >
:1.86                                 1852 .xdg-desktop-po kiosk            :1.86         user@1000.service          >
:1.87                                 1885 .xdg-desktop-po kiosk            :1.87         user@1000.service          >
:1.88                                 1852 .xdg-desktop-po kiosk            :1.88         user@1000.service          >
:1.9                                   818 systemd-network systemd-network  :1.9          systemd-networkd.service   >
net.hadess.PowerProfiles              1157 power-profiles- root             :1.38         power-profiles-daemon.servi>
org.freedesktop.Accounts               730 accounts-daemon root             :1.7          accounts-daemon.service    >
org.freedesktop.Avahi                  709 avahi-daemon    avahi            :1.6          avahi-daemon.service       >
org.freedesktop.ColorManager           952 .colord-wrapped colord           :1.19         colord.service             >
org.freedesktop.DBus                     1 systemd         root             -             init.scope                 >
org.freedesktop.GeoClue2                 - -               -                (activatable) -                          >
org.freedesktop.PolicyKit1             756 polkitd         polkituser       :1.8          polkit.service             >
org.freedesktop.RealtimeKit1           927 rtkit-daemon    root             :1.18         rtkit-daemon.service       >
org.freedesktop.UDisks2               1663 udisksd         root             :1.71         udisks2.service            >
org.freedesktop.UPower                 994 upowerd         root             :1.24         upower.service             >
org.freedesktop.UPower.PowerProfiles  1157 power-profiles- root             :1.38         power-profiles-daemon.servi>
org.freedesktop.bolt                     - -               -                (activatable) -                          >
org.freedesktop.home1                    - -               -                (activatable) -                          >
org.freedesktop.hostname1                - -               -                (activatable) -                          >
org.freedesktop.import1                  - -               -                (activatable) -                          >
org.freedesktop.locale1                  - -               -                (activatable) -                          >
org.freedesktop.login1                 738 systemd-logind  root             :1.4          systemd-logind.service     >
org.freedesktop.machine1               714 systemd-machine root             :1.1          systemd-machined.service   >
org.freedesktop.network1               818 systemd-network systemd-network  :1.9          systemd-networkd.service   >
org.freedesktop.oom1                   411 systemd-oomd    systemd-oom      :1.0          systemd-oomd.service       >
org.freedesktop.portable1                - -               -                (activatable) -                          >
org.freedesktop.resolve1               439 systemd-resolve systemd-resolve  :1.5          systemd-resolved.service   >
org.freedesktop.systemd1                 1 systemd         root             :1.2          init.scope                 >
org.freedesktop.timedate1                - -               -                (activatable) -                          >
org.freedesktop.timesync1              444 systemd-timesyn systemd-timesync :1.3          systemd-timesyncd.service  >
org.gnome.DisplayManager               832 gdm             root             :1.10         display-manager.service    >
org.gnome.RemoteDesktop.Configuration    - -               -                (activatable) -                          >

Solution

  • Firstly, I really appreciate the way of asking questions, most of the question on this platform is kind of incomplete, and even if I know the answer then I won't bother to answer them because they haven't put enough effort into asking then they do not deserve to get answered.

    Now let's understand what is wrong in your scenario.

    On GNOME GDM (Wayland), direct touchscreen interaction does not wake the screen from the lock state, only tracked by Mutter’s idle/power-saving behavior. In your dbus-monitor logs, you observed:

    As of now, it appears this is expected behavior within GNOME/GDM. The compositor won't listen to touch events to re-awaken the screen, it only responds to keyboard, mouse, or other connected input devices.

    Potential Workaround

    1. Install Prerequisites:
    Ensure your user has permission to write /dev/uinput, either by being in the input group or via udev rules (tools like Steam do this automatically)

    sudo apt update
    sudo apt install python3 python3-pip libudev-dev
    sudo pip3 install python-uinput evdev
    sudo modprobe uinput
    

    There is a little workaround is that we can simulate Input via Script

    2. Python Script: touch_wake.py

    #!/usr/bin/env python3
    import time
    from evdev import InputDevice, categorize, ecodes
    from evdev import UInput, AbsInfo
    
    # Path to your touchscreen device (adjust with `ls /dev/input/by-id/`)
    TOUCH_DEV = '/dev/input/event0'
    
    # 1) Open touchscreen
    ts = InputDevice(TOUCH_DEV)
    
    # 2) Create virtual keyboard to simulate 'KEY_ENTER' or pointer movement
    cap = {ecodes.EV_KEY: [ecodes.KEY_ENTER], ecodes.EV_REL: [ecodes.REL_X, ecodes.REL_Y]}
    ui = UInput(cap, name="touch-wake-sim", version=0x3)
    
    print(f"Watching {ts.path} for touch events…")
    
    try:
        for event in ts.read_loop():
            if event.type == ecodes.EV_KEY and event.code == ecodes.BTN_TOUCH and event.value == 1:
                # Simulate wake: pointer move + ENTER press
                ui.write(ecodes.EV_REL, ecodes.REL_X, 0)
                ui.write(ecodes.EV_REL, ecodes.REL_Y, 0)
                ui.write(ecodes.EV_KEY, ecodes.KEY_ENTER, 1)
                ui.write(ecodes.EV_KEY, ecodes.KEY_ENTER, 0)
                ui.syn()
                print("Touch detected → wake simulated.")
                time.sleep(0.5)
    except KeyboardInterrupt:
        pass
    finally:
        ui.close()
        ts.close()
    

    How it works:

    1. Listens for BTN_TOUCH events from your touchscreen.

    2. When touched, emits a zero-distance mouse move + KEY_ENTER, which GDM recognizes and wakes the screen.

    3. Find Your Touchscreen Device and update TOUCH_DEV with the correct path:

    ls /dev/input/by-id/*
    

    3. Run and Test:
    Now lock your device and touch it, it should wake it up.

    sudo python3 touch_wake.py
    

    Let me know if you have any more questions.

    PS> This works for GNOME/GDM (Wayland), but not all devices, like Lenovo X11 / X11 Yoga.