feat: implement active-app monitor via KWin scripting and D-Bus
Replaces the no-op stub with a working implementation for KDE6 Wayland. Wayland's privacy model prevents querying focused-window state from outside the compositor, so the monitor injects a KWin JavaScript snippet at runtime that subscribes to workspace.windowActivated and calls back via D-Bus. On startup: - Writes the KWin script to a NamedTempFile - Registers dev.rootiest.qmk_host on the session bus at /AppMonitor - Loads the script via org.kde.kwin.Scripting.loadScript(), then calls start() to activate it (loadScript alone does not execute the script) On each window-activation event: - Truncates app_id to 27 UTF-8 bytes at a char boundary - Skips no-op updates when the active app has not changed - Broadcasts CMD_ACTIVE_APP (0x43) to all connected keyboards Depends on new crates: zbus v4 (blocking D-Bus) and tempfile v3.
This commit is contained in:
@@ -16,3 +16,5 @@ log = "0.4" # Logging facade
|
||||
env_logger = "0.11" # Logger implementation (RUST_LOG env var)
|
||||
ctrlc = "3" # Ctrl+C / SIGINT handler
|
||||
clap = { version = "4", features = ["derive"] } # CLI argument parsing
|
||||
tempfile = "3" # NamedTempFile for KWin script
|
||||
zbus = { version = "4", features = ["blocking"] } # D-Bus (KWin scripting callback)
|
||||
|
||||
Reference in New Issue
Block a user