tts keybindings
This commit is contained in:
1 parent
a05e166e1a
commit
34cbfb9137
3 files changed
+59
-1
No files matched your search
@@ -51,6 +51,7 @@ split under `conf/` and pulled in with `require()`.
|
||||
hypr/
|
||||
├── hyprland.lua # entry point; require()s conf/*.lua in order
|
||||
├── screen-record.sh # wf-recorder toggle (bound to Mod+R)
|
||||
├── speak-selection.nu # piper TTS of primary selection (bound to Mod+M); press again to stop
|
||||
├── xdph.conf # xdph screencopy workaround (force_shm); hyprlang, read by xdph itself
|
||||
├── .luarc.json # lua-language-server config (library = ../../hypr-types)
|
||||
├── dms/ # DMS-auto-generated Hyprland overrides (colors/layout/windowrules);
|
||||
@@ -83,6 +84,7 @@ hypr/
|
||||
## Touchpad gestures (niri parity)
|
||||
|
||||
niri's 3-finger swipes are mirrored in `conf/inputs.lua`:
|
||||
|
||||
- **Horizontal** → `scroll_move` (scroll through columns along the tape)
|
||||
- **Vertical** → `workspace` (switch workspaces up/down)
|
||||
- **Mod + swipe (any direction)** → move the whole workspace to the monitor in
|
||||
|
||||
@@ -147,4 +147,4 @@ hl.bind("XF86AudioMute", hl.dsp.exec_cmd("noctalia msg volume-mute"), { locked =
|
||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("noctalia msg brightness-up"), { locked = true })
|
||||
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("noctalia msg brightness-down"), { locked = true })
|
||||
|
||||
hl.bind(mod .. " + M", hl.dsp.exec_cmd("wl-paste --primary | piper -m en_US-hfc_female-medium"))
|
||||
hl.bind(mod .. " + M", hl.dsp.exec_cmd("nu ~/.config/hypr/speak-selection.nu"))
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
def pidfile [] {
|
||||
$"($env.XDG_RUNTIME_DIR? | default "/tmp")/hypr-speak.pid"
|
||||
}
|
||||
|
||||
def pid-alive [pid: int] {
|
||||
(^kill -0 $pid | complete).exit_code == 0
|
||||
}
|
||||
|
||||
def kill-tree [pid: int] {
|
||||
let kids = (^pgrep -P $pid | complete)
|
||||
if $kids.exit_code == 0 {
|
||||
for kid in ($kids.stdout | lines) {
|
||||
let kid = ($kid | str trim)
|
||||
if not ($kid | is-empty) {
|
||||
kill-tree ($kid | into int)
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = (^kill -KILL $pid | complete)
|
||||
}
|
||||
|
||||
def main [] {
|
||||
let file = (pidfile)
|
||||
|
||||
if ($file | path exists) {
|
||||
let old = (try { open --raw $file | str trim | into int } catch { null })
|
||||
rm --force $file
|
||||
if $old != null and (pid-alive $old) {
|
||||
kill-tree $old
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let paste = (^wl-paste --primary | complete)
|
||||
if $paste.exit_code != 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let text = ($paste.stdout
|
||||
| str replace --all --regex '[\n\t]' ' '
|
||||
| str replace --all --regex "[^0-9A-Za-z .,!?'-]" ''
|
||||
| str replace --all --regex ' +' ' '
|
||||
| str trim)
|
||||
|
||||
if ($text | is-empty) {
|
||||
return
|
||||
}
|
||||
|
||||
$"($nu.pid)" | save --force $file
|
||||
try {
|
||||
$text | ^piper -m en_US-hfc_female-medium
|
||||
}
|
||||
rm --force $file
|
||||
}
|
||||
Reference in new issue
Block a user