Repository navigation
Tags: bethropolis/omarchy-kcd-plugin
Tags
feat: event-driven panel with unpair and SFTP storage toggle Omarchy Quattro bar-widget for kcd (KDE Connect daemon), 1.1.0. The panel is event-driven end to end. It boots from one `kcd watch --json` snapshot (devices carrying battery, media, signal and SFTP mount state) and then stays live on watch events; the only CLI call left is `kcd --version`, which detects whether the binary exists at all. All three state one-shots (`devices`, `battery`, `mpris status`) are gone, along with the gap-filling and top-up logic that existed only because the one-shots embedded no sub-state. Refresh re-checks the binary and bounces the watch stream, since every connect starts with a fresh snapshot. Steady-state idle CPU is 0% by construction: no timers poll, and an unhealthy plugin spawns nothing. Subscribes to connectivity.update, device.added, device.removed and sftp.mounted / sftp.unmounted, and handles connect/disconnect and the pair events in memory rather than re-reading through the CLI. SFTP mount state comes from the daemon rather than from scraping /proc/mounts, so it works for mounts made by other clients too. Quick actions, ordered by use: Ring, Screenshot, Clipboard, then Share and Files. Files is a toggle -- `kcd sftp mount` opens the phone's storage in the file manager, then it turns into Unmount while the mount is live. Mounting is idempotent upstream and unmount failures are distinguishable, so the plugin needs no retry guards or error string-matching. Flows that can fail (share, screenshot, SFTP) go through shell scripts that turn the error into an actionable notification instead of silence, and never escalate privileges. Unpairing is a press-and-hold on the phone name in the panel header, with a confirm dialog (Cancel preselected). No tile, row or menu is added for it, so the layout is unchanged until you press. Security: the device ID is daemon-supplied and untrusted, so it never reaches a shell. Commands are argv arrays with no shell, and an anchored allowlist drops hostile IDs at intake. Requires Omarchy Quattro and kcd >= 1.22.0 (socket activation, SFTP mount state), plus sshfs for the Files tile.