aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--KEYBINDS.md1
-rw-r--r--dot_config/sway/config3
-rw-r--r--dot_config/sway/executable_type-vpn-otp.sh23
3 files changed, 27 insertions, 0 deletions
diff --git a/KEYBINDS.md b/KEYBINDS.md
index af1f4b9..d7f8143 100644
--- a/KEYBINDS.md
+++ b/KEYBINDS.md
@@ -337,6 +337,7 @@ Mod key: `Super` (Mod4). Only personal additions beyond sway defaults listed.
| `Shift+Print` | Full screenshot (grim) |
| `Super+i` | Dictate toggle (whisper.cpp → wtype + clipboard) |
| `Super+Shift+o` | OCR region (tesseract → clipboard) |
+| `Super+o` | Type VPN TOTP via wtype (clipboard fallback) |
| `Super+Shift+s` | Lock screen + pause media |
| `Super+n` | Dismiss top visible notification |
| `Super+Shift+n` | Dismiss all visible notifications |
diff --git a/dot_config/sway/config b/dot_config/sway/config
index 18b402c..86a75e1 100644
--- a/dot_config/sway/config
+++ b/dot_config/sway/config
@@ -182,6 +182,9 @@ bindsym $mod+i exec ~/.local/bin/dictate
# OCR — crop a region, copy text to clipboard (tesseract)
bindsym $mod+Shift+o exec ~/.local/bin/ocr
+# VPN OTP — type current TOTP via wtype, fall back to clipboard
+bindsym $mod+o exec ~/.config/sway/type-vpn-otp.sh
+
# Lock & pause
bindsym $mod+Shift+s exec "playerctl -a pause; swaylock -f -e -c 000000"
diff --git a/dot_config/sway/executable_type-vpn-otp.sh b/dot_config/sway/executable_type-vpn-otp.sh
new file mode 100644
index 0000000..b3f0924
--- /dev/null
+++ b/dot_config/sway/executable_type-vpn-otp.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Fetch the current VPN TOTP from pass-otp and type it into the focused
+# surface via wtype. If wtype isn't available or fails (focused surface
+# lacks virtual-keyboard support, e.g. an Xwayland app), copy the code
+# to the Wayland clipboard instead and notify so the user can Ctrl+V it.
+set -eu
+
+code=$(pass otp show vpn/totp 2>/dev/null | tr -d ' \t\n\r') || {
+ notify-send -u critical "VPN OTP" "pass otp show vpn/totp failed"
+ exit 1
+}
+
+if [ -z "$code" ]; then
+ notify-send -u critical "VPN OTP" "empty code from pass-otp"
+ exit 1
+fi
+
+if command -v wtype >/dev/null 2>&1 && wtype -- "$code" 2>/dev/null; then
+ exit 0
+fi
+
+printf '%s' "$code" | wl-copy
+notify-send "VPN OTP" "Typed via wtype failed — code copied to clipboard"