diff --git a/dotfiles/config/hypr/hyprland/binds.lua b/dotfiles/config/hypr/hyprland/binds.lua index e6ae51b3..c41b7670 100644 --- a/dotfiles/config/hypr/hyprland/binds.lua +++ b/dotfiles/config/hypr/hyprland/binds.lua @@ -35,6 +35,12 @@ function M.setup(ctx) end local function setup_audio_media_bindings() + bind("F5", exec("voxtype record start"), desc("Start hold-to-talk dictation")) + bind("F5", exec("voxtype record stop"), desc("Stop and transcribe hold-to-talk dictation", { release = true })) + bind(hyper .. " + B", exec("voxtype record start"), desc("Start hold-to-talk dictation")) + bind(hyper .. " + B", exec("voxtype record stop"), desc("Stop and transcribe hold-to-talk dictation", { release = true })) + bind(hyper .. " + Escape", exec("voxtype record cancel"), desc("Cancel voice dictation")) + bind(main_mod .. " + I", exec("set_volume --unmute --change-volume +5"), desc("Raise volume", { repeating = true })) bind(main_mod .. " + K", exec("set_volume --unmute --change-volume -5"), desc("Lower volume", { repeating = true })) bind(main_mod .. " + U", exec("set_volume --toggle-mute"), desc("Toggle mute")) diff --git a/nixos/flake.lock b/nixos/flake.lock index 50696281..1ee8a4eb 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -580,6 +580,24 @@ "type": "github" } }, + "flake-utils_6": { + "inputs": { + "systems": "systems_7" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "git-blame-rank": { "inputs": { "fenix": "fenix", @@ -2088,6 +2106,7 @@ "rlru": "rlru", "systems": "systems_6", "t3code-nix": "t3code-nix", + "voxtype": "voxtype", "vscode-server": "vscode-server", "xmonad": "xmonad_2", "xmonad-contrib": "xmonad-contrib_2", @@ -2255,6 +2274,21 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "t3code-nix": { "inputs": { "nixpkgs": [ @@ -2315,6 +2349,27 @@ "type": "github" } }, + "voxtype": { + "inputs": { + "flake-utils": "flake-utils_6", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1783956569, + "narHash": "sha256-36bYa6+d+SjLXTDeUOoCiuTlAL9mgp9h5WK4WMCEuZQ=", + "owner": "peteonrails", + "repo": "voxtype", + "rev": "86666ab9ee681eb3d1e80ef1826affd8e11107e5", + "type": "github" + }, + "original": { + "owner": "peteonrails", + "repo": "voxtype", + "type": "github" + } + }, "vscode-server": { "inputs": { "flake-utils": [ diff --git a/nixos/flake.nix b/nixos/flake.nix index d789a560..af91c93d 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -101,6 +101,11 @@ }; }; + voxtype = { + url = "github:peteonrails/voxtype"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + kanshi-sni = { url = "github:taffybar/kanshi-sni"; inputs = { diff --git a/nixos/hyprland.nix b/nixos/hyprland.nix index 1001d09f..b9377dd6 100644 --- a/nixos/hyprland.nix +++ b/nixos/hyprland.nix @@ -166,6 +166,7 @@ then "1" else "0"; hyprlandCursorSizeString = toString config.myModules.hyprland.cursorSize; + voxtypePackage = inputs.voxtype.packages.${system}.vulkan; enableHyprglass = false; hyprglass = pkgs.callPackage ./packages/hyprglass { src = inputs.hyprglass; @@ -432,6 +433,47 @@ HYPRCURSOR_SIZE = hyprlandCursorSizeString; }; + home-manager.users.imalison = lib.mkIf config.myModules.voxtype.enable { + imports = [inputs.voxtype.homeManagerModules.default]; + + home.packages = [inputs.voxtype.packages.${system}.osd-gtk4]; + + programs.voxtype = { + enable = true; + package = voxtypePackage; + engine = "whisper"; + model.name = "large-v3-turbo"; + service.enable = true; + + settings = { + hotkey.enabled = false; + + audio = { + device = "default"; + max_duration_secs = 120; + }; + + whisper = { + language = "en"; + translate = false; + on_demand_loading = false; + initial_prompt = "Ivan Malison, Railbird, NixOS, Hyprland, Taffybar, Emacs, Codex."; + }; + + output = { + mode = "type"; + fallback_to_clipboard = true; + pre_type_delay_ms = 100; + notification = { + on_recording_start = true; + on_recording_stop = true; + on_transcription = false; + }; + }; + }; + }; + }; + home-manager.sharedModules = [ inputs.hyprscratch.homeModules.default ( diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index 3ef42575..085f746a 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -25,6 +25,7 @@ myModules.gitea-runner.enable = false; myModules.postgres.enable = true; myModules.tts.enable = true; + myModules.voxtype.enable = true; myModules.cua = { enable = true; android = { diff --git a/nixos/options.nix b/nixos/options.nix index 977be334..05f02a65 100644 --- a/nixos/options.nix +++ b/nixos/options.nix @@ -44,6 +44,8 @@ in { type = lib.types.ints.positive; description = "Cursor size exported to Hyprland and cursor-aware toolkits."; }; + + myModules.voxtype.enable = lib.mkEnableOption "local push-to-talk voice dictation"; }; config = {