hyperhive/nix/agent-modules/screen.nix
iris 7fa7e2bdfd refactor(#2305): drop mouse tools + ydotool, switch key_press to wtype
- remove mouse_move and mouse_click (no Wayland-native alternative on Weston
  without /dev/uinput; follow-up filed for future investigation)
- replace key_press from 'ydotool key' to 'wtype -k': parses mod1+mod2+key
  into -M mod1 ... -k key ... -m mod1 sequence via virtual-keyboard protocol
- remove dest_path parameter from screenshot: always writes to /tmp/ (fixes
  arbitrary write-path concern from security review)
- simplify screen.nix: drop screenInput option, ydotoold systemd unit, ydotool
  package; only grim + wtype remain (both compositor-mediated, no /dev/uinput)
- update module header comment to reflect three-tool surface

Addresses mara's /dev/uinput veto (PR #2617 comment #40524).
2026-07-20 20:55:27 +02:00

32 lines
1 KiB
Nix

# Screen MCP — screenshot + keyboard input for GUI agents.
#
# Auto-activated when `hyperhive.gui.enable = true`. Wires the
# `hive-screen-mcp` stdio bridge as `extraMcpServers.screen` so claude
# gets three tools: `screenshot`, `type_text`, and `key_press`.
#
# All tools use Wayland protocols mediated by the Weston compositor —
# no `/dev/uinput` or kernel-level injection needed. `grim` takes
# screenshots; `wtype` handles both text input and key/modifier combos
# via the `zwp-virtual-keyboard-unstable-v1` protocol.
{
pkgs,
lib,
config,
...
}:
{
config = lib.mkIf config.hyperhive.gui.enable {
# Register the screen MCP bridge so claude gets the screen tools.
hyperhive.extraMcpServers.screen = {
command = "${config.hyperhive.packages.hive-screen-mcp}/bin/hive-screen-mcp";
args = [ ];
};
# grim: Wayland screenshot; wtype: text + key input via virtual-keyboard
# protocol (compositor-mediated, no /dev/uinput required).
environment.systemPackages = [
pkgs.grim
pkgs.wtype
];
};
}