ckb-next / ckb-next

RGB Driver for Linux
GNU General Public License v2.0
3.29k stars 274 forks source link

Implement IDLE light switch under Wayland #1012

Open AFCMS opened 1 year ago

AFCMS commented 1 year ago

Enhancement Details

Freedesktop Portal

Freedesktop Portals provide the org.freedesktop.portal.Inhibit portal (accessible with DBUS) that can monitor screensaver state. This will not handle a custom timeout, but rely on the system screensaver state

image

https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-method-org-freedesktop-portal-Inhibit.CreateMonitor

Per Desktop Environment DBUS

GNOME's Mutter Wayland compositor provide a DBUS API to get IDLE time (org.gnome.Mutter.IdleMonitor.GetIdletime)

It seems much easier to implement than the desktop portal, and doesn't rely on the screensaver, giving IDLE time.

To test :

dbus-send --print-reply --dest=org.gnome.Mutter.IdleMonitor /org/gnome/Mutter/IdleMonitor/Core org.gnome.Mutter.IdleMonitor.GetIdletime

Another option is the org.freedesktop.ScreenSaver.GetSessionIdleTime DBUS API that is present on some desktop environment despite not being in the Freedesktop spec. (doesn't seem to be present in GNOME)

Wayland idle_notifier protocol

https://wayland.app/protocols/ext-idle-notify-v1

It seems to cover the current feature, but sadly only KWin and Sway support it at the moment.

Additional Details

No response

thembees commented 8 months ago

+1 to this please