feat: add hold-to-talk listener and restore Handy-managed preferences

This commit is contained in:
kiri committed 2026-09-09 20:44:59 +02:00
1 parent 0992f3b863
commit e61f230978
7 files changed
+135 -47

No files matched your search

+20 -26
View File
@@ -1,30 +1,16 @@
{
flake.modules.nixos.handy = { pkgs, ... }: {
services.udev.packages = [
(pkgs.writeTextDir "lib/udev/rules.d/70-handy-keyboard.rules" ''
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEYBOARD}=="1", TAG+="uaccess"
'')
];
};
flake.modules.homeManager.handy =
{ config, pkgs, ... }:
{ pkgs, ... }:
let
settings = (pkgs.formats.json { }).generate "handy-settings.json" {
settings = {
settings_schema_version = 1;
selected_model = "handy-computer/nemotron-3.5-asr-streaming-0.6b-gguf/nemotron-3.5-asr-streaming-0.6b-Q8_0.gguf";
selected_language = "auto";
translate_to_english = false;
selected_microphone = null;
always_on_microphone = false;
push_to_talk = true;
paste_method = "ctrl_shift_v";
typing_tool = "wtype";
clipboard_handling = "dont_modify";
auto_submit = false;
overlay_style = "live";
overlay_position = "bottom";
post_process_enabled = false;
start_hidden = true;
autostart_enabled = false;
update_checks_enabled = false;
show_whats_new_on_update = false;
onboarding_completed = true;
};
};
python = pkgs.python3.withPackages (ps: [ ps.evdev ]);
in
{
home.packages = [ pkgs.handy ];
@@ -37,10 +23,18 @@
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
# Handy writes migrations and runtime preferences: restore the Nix baseline on start.
ExecStartPre = "${pkgs.coreutils}/bin/install -Dm600 ${settings} ${config.xdg.dataHome}/com.pais.handy/settings_store.json";
ExecStart = "${pkgs.handy}/bin/handy --start-hidden";
};
};
systemd.user.services.handy-ptt = {
Unit = {
Description = "Handy push-to-talk key release listener";
PartOf = [ "graphical-session.target" ];
Requisite = [ "handy.service" ];
After = [ "handy.service" ];
};
Service.ExecStart = "${python}/bin/python ${./handy/_push_to_talk.py} ${pkgs.handy}/bin/handy";
};
};
}