Files
opalfiles/.local/bin/pass_autofill
2025-08-16 11:35:38 -07:00

26 lines
610 B
Bash
Executable File

#!/bin/sh
entry=$(gopass list --flat | ~/.config/rofi/launchers.d/rofi_launcher_autofill.sh)
if [ -n "$entry" ]; then
username=$(gopass show "$entry" | grep '^username:' | cut -d' ' -f2-)
password=$(gopass show -o "$entry")
if [ -z "$password" ]; then
notify-send "Gopass Error" "No password for $entry"
exit 1
fi
notify-send "Autofill in 1s: Focus username field in form"
sleep 1
# Type username, press Tab, then password, then Enter
wtype "$username"
sleep 0.2
wtype -k Tab
sleep 0.2
wtype "$password"
sleep 0.2
wtype -k Return
fi