Files
rootiest bd4facf1c4 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.
2026-04-10 16:47:21 -04:00

21 lines
788 B
TOML

[package]
name = "qmk-host"
version = "0.1.0"
edition = "2021"
description = "Host bridge for bi-directional Raw HID layer sync and host data delivery to QMK keyboards"
license = "GPL-3.0-or-later"
[[bin]]
name = "qmk-host"
path = "src/main.rs"
[dependencies]
hidapi = "2" # Cross-platform Raw HID access
anyhow = "1" # Ergonomic error handling
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)