mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 01:18:30 +09:00
handy
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
homebrew.casks = [ "handy" ];
|
||||
|
||||
launchd.agents.handy = {
|
||||
command = "/usr/bin/open -gja Handy --args --start-hidden";
|
||||
serviceConfig.RunAtLoad = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
handy = inputs.handy.packages.${pkgs.stdenv.hostPlatform.system}.handy;
|
||||
settingsFile = "${config.xdg.configHome}/com.pais.handy/settings_store.json";
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
handy
|
||||
pkgs.wtype
|
||||
];
|
||||
|
||||
# Handy has no disabled-shortcut setting. Empty bindings are rejected before
|
||||
# registration, leaving niri and labwc as the sole owners of Ctrl+Space.
|
||||
home.activation.disableHandyGlobalShortcuts = {
|
||||
after = [ "writeBoundary" ];
|
||||
before = [ ];
|
||||
data = ''
|
||||
settingsFile=${lib.escapeShellArg settingsFile}
|
||||
mkdir -p "$(dirname "$settingsFile")"
|
||||
|
||||
if [ -f "$settingsFile" ]; then
|
||||
${lib.getExe pkgs.jq} \
|
||||
'.settings.bindings.transcribe.current_binding = ""
|
||||
| .settings.bindings.transcribe_with_post_process.current_binding = ""' \
|
||||
"$settingsFile" > "$settingsFile.tmp"
|
||||
else
|
||||
${lib.getExe pkgs.jq} -n '
|
||||
{
|
||||
settings: {
|
||||
bindings: {
|
||||
transcribe: {
|
||||
id: "transcribe",
|
||||
name: "Transcribe",
|
||||
description: "Converts your speech into text.",
|
||||
default_binding: "ctrl+space",
|
||||
current_binding: ""
|
||||
},
|
||||
transcribe_with_post_process: {
|
||||
id: "transcribe_with_post_process",
|
||||
name: "Transcribe with Post-Processing",
|
||||
description: "Converts your speech into text and applies AI post-processing.",
|
||||
default_binding: "ctrl+shift+space",
|
||||
current_binding: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
' > "$settingsFile.tmp"
|
||||
fi
|
||||
|
||||
mv "$settingsFile.tmp" "$settingsFile"
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.user.services.handy = {
|
||||
Unit = {
|
||||
Description = "Handy speech-to-text";
|
||||
After = [ "graphical-session.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${lib.getExe handy} --start-hidden";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
};
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
description = "Handy offline speech-to-text";
|
||||
}
|
||||
@@ -127,6 +127,7 @@ in
|
||||
(execute "W-space" "ghostty +toggle-quick-terminal")
|
||||
(execute "W-p" "wdisplays")
|
||||
(execute "W-z" "wl-find-cursor -c 0xCCFF453A -s 160 -d 1200")
|
||||
(execute "C-space" "handy --toggle-transcription")
|
||||
|
||||
# Function keys (sync with niri modules/applications/niri/home.nix)
|
||||
(execute "XF86AudioRaiseVolume" "noctalia msg volume-up")
|
||||
|
||||
@@ -119,6 +119,13 @@ in
|
||||
];
|
||||
hotkey-overlay.title = "Find Cursor";
|
||||
};
|
||||
"Ctrl+Space" = {
|
||||
action.spawn = [
|
||||
"handy"
|
||||
"--toggle-transcription"
|
||||
];
|
||||
hotkey-overlay.title = "Toggle Handy Transcription";
|
||||
};
|
||||
|
||||
# Function keys (sync with labwc modules/applications/labwc/home.nix)
|
||||
"XF86AudioRaiseVolume".action.spawn = [
|
||||
|
||||
Reference in New Issue
Block a user