diff --git a/.config/sway/config b/.config/sway/config index a644654..f740fd5 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -70,6 +70,7 @@ exec swayidle -w \ input * { xkb_layout pl + xkb_options caps:none repeat_rate 80 repeat_delay 300 } @@ -86,14 +87,6 @@ input "1267:12734:ELAN06FA:00_04F3:31BE_Touchpad" { scroll_factor 0.8 } -# Export important Wayland/Sway session variables to D-Bus and the systemd -# user manager. This lets apps and user services launched outside the shell -# know which Wayland display to use and that the current desktop is Sway. -# Helps with portals, screen sharing, notifications, and D-Bus activated apps. -exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway -exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP - - ### Key bindings # @@ -210,6 +203,9 @@ exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # Show the next scratchpad window or hide the focused scratchpad window. # If there are multiple scratchpad windows, this command cycles through them. bindsym $mod+minus scratchpad show + + # Dedicated scratchpad terminal for voice queries to pi. + for_window [app_id="pi-voice"] border pixel 2, move scratchpad # # Resizing containers: # @@ -232,7 +228,9 @@ mode "resize" { # Return to default mode bindsym Return mode "default" bindsym Escape mode "default" + bindsym $mod+r mode "default" } + bindsym $mod+r mode "resize" # # Utilities: @@ -249,6 +247,16 @@ bindsym $mod+r mode "resize" bindsym Print exec sh -c 'mkdir -p ~/screenshots; f=~/screenshots/$(date +%F-%H%M%S).png; grim "$f"; wl-copy < "$f"' bindsym Shift+Print exec sh -c 'mkdir -p ~/screenshots; f=~/screenshots/$(date +%F-%H%M%S).png; grim -g "$(slurp)" "$f"; wl-copy < "$f"' + # Push-to-talk: hold Caps Lock to record, release to transcribe. + # xkb_options caps:none above disables the normal Caps Lock toggle, so bind by keycode. + bindcode 66 exec sh -c 'voxtype record start; pkill -USR1 -f "$HOME/.config/sway/status.sh"' + bindcode --release 66 exec sh -c 'voxtype record stop; pkill -USR1 -f "$HOME/.config/sway/status.sh"' + + # Voice query to pi in a dedicated tmux session/scratchpad terminal. + # Hold $mod+Shift+x, speak, release; transcription is submitted to pi. + bindsym $mod+Shift+x exec ~/bin/pi-voice-query start + bindsym --release $mod+Shift+x exec ~/bin/pi-voice-query stop + # Pick an entry from clipboard history and copy it back to the clipboard bindsym $mod+c exec sh -c 'cliphist list | wmenu -l 10 | cliphist decode | wl-copy' diff --git a/.config/sway/status.sh b/.config/sway/status.sh index d200d1e..6506e92 100755 --- a/.config/sway/status.sh +++ b/.config/sway/status.sh @@ -7,14 +7,21 @@ print_status() { brightness=$(brightnessctl -m 2>/dev/null | awk -F, '{print $4}') - printf 'VOL %s | BRI %s | %s\n' "${volume:-n/a}" "${brightness:-n/a}" "$(date +'%Y-%m-%d %H:%M:%S')" + voxtype_state=$(voxtype status 2>/dev/null) + case "$voxtype_state" in + recording) voxtype=' | VOX REC' ;; + transcribing) voxtype=' | VOX ...' ;; + *) voxtype='' ;; + esac + + printf 'VOL %s | BRI %s%s | %s\n' "${volume:-n/a}" "${brightness:-n/a}" "$voxtype" "$(date +'%Y-%m-%d %H:%M:%S')" } trap print_status USR1 print_status while :; do - sleep 60 & + sleep 1 & wait $! print_status done diff --git a/install_the_dotfiles.sh b/install_the_dotfiles.sh index 6796313..08feeb9 100644 --- a/install_the_dotfiles.sh +++ b/install_the_dotfiles.sh @@ -82,3 +82,24 @@ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" # Extra ## Clipboard history # sudo apt install cliphist + +# Install +curl -LO https://github.com/peteonrails/voxtype/releases/download/v0.6.0/voxtype_0.6.0-1_amd64.deb +sudo dpkg -i voxtype_0.6.0-1_amd64.deb +rm voxtype_0.6.0-1_amd64.deb +sudo apt install wtype wl-clipboard libnotify-bin pipewire-alsa playerctl + +sudo usermod -aG input $USER + +read -r -p "Enable GPU support? [y/N] " answer +case "$answer" in + [yY]|[yY][eE][sS]) + sudo voxtype setup gpu --enable + ;; +esac + + +# Interactive model selection and systemd setup +voxtype setup +voxtype setup systemd +voxtype setup model