From 23f53a5ac422a57bddb8beffd0c8a9c76e1b2a7d Mon Sep 17 00:00:00 2001 From: Opal Date: Tue, 15 Apr 2025 15:02:25 -0700 Subject: [PATCH] adding gopass stuff --- .bash_env | 4 ++-- .config/doom/init.el | 2 +- .config/sway/config | 11 ++++++++--- .local/bin/pass_autofill.sh | 22 ++++++++++++++++++++++ .local/bin/pass_copy.sh | 8 ++++++++ .local/bin/pass_user_copy.sh | 8 ++++++++ 6 files changed, 49 insertions(+), 6 deletions(-) create mode 100755 .local/bin/pass_autofill.sh create mode 100755 .local/bin/pass_copy.sh create mode 100755 .local/bin/pass_user_copy.sh diff --git a/.bash_env b/.bash_env index 4980827..b8a1e85 100644 --- a/.bash_env +++ b/.bash_env @@ -6,8 +6,8 @@ export XDG_CONFIG_HOME=~/.config export XDG_CACHE_HOME=~/.cache export XDG_DATA_HOME=~/.local/share export BROWSER=/usr/bin/firefox -export VISUAL=emacsclient -export EDITOR=emacsclient +export VISUAL=nvim +export EDITOR=nvim export QT_QPA_PLATFORMTHEME=qt5ct # Scripts Path diff --git a/.config/doom/init.el b/.config/doom/init.el index 220db7a..c9c9911 100644 --- a/.config/doom/init.el +++ b/.config/doom/init.el @@ -98,7 +98,7 @@ :os (:if IS-MAC macos) ; improve compatibility with macOS - ;;tty ; improve the terminal Emacs experience + tty ; improve the terminal Emacs experience :lang ;;agda ; types of types of types of types... diff --git a/.config/sway/config b/.config/sway/config index 4369062..a321c6b 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -163,12 +163,17 @@ bindsym $mod+Ctrl+g exec grimshot save window #bindsym $mod+Shift+e exec wlogout -p layer-shell # Bookmarks -bindsym $mod+Insert exec wtype $(grep -v '^#' ~/.local/share/bookmarks/bookmarks | bemenu -p Bookmark: -l 50 -c -M 500 --fn 'Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | cut -d ' ' -f1) +bindsym $mod+i exec wtype $(grep -v '^#' ~/.local/share/bookmarks/bookmarks | bemenu -p Bookmark: -l 50 -c -M 500 --fn 'Monospace 14' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | cut -d ' ' -f1) -bindsym $mod+Shift+Insert exec ~/.local/bin/bookmark_insert +bindsym $mod+Shift+i exec ~/.local/bin/bookmark_insert # Emojis -bindsym $mod+Shift+e exec wtype $(awk '{print $1, $0}' ~/.local/share/chars/emojis* | bemenu -p Emoji: -l 25 -c -M 500 --fn 'Noto Color Emoji,Terminus 16' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | awk '{print $1}') +bindsym $mod+Shift+e exec wtype $(awk '{print $1, $0}' ~/.local/share/chars/emojis* | bemenu -p Emoji: -l 25 -c -M 500 --fn 'Noto Color Emoji,Monospace 14' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00' | awk '{print $1}') + +# Gopass +bindsym $mod+y exec ~/.local/bin/pass_copy.sh +bindsym $mod+u exec ~/.local/bin/pass_user_copy.sh +bindsym $mod+p exec ~/.local/bin/pass_autofill.sh ####################### diff --git a/.local/bin/pass_autofill.sh b/.local/bin/pass_autofill.sh new file mode 100755 index 0000000..bb54d63 --- /dev/null +++ b/.local/bin/pass_autofill.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +entry=$(gopass list --flat | bemenu -p Autofill: -l 25 -c -M 500 --fn 'Monospace 14' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00') + +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 3s: Focus username field in form" + sleep 3 + + # Type username, press Tab, then password, then Enter + wtype "$username" + wtype -k Tab + wtype "$password" + wtype -k Return +fi diff --git a/.local/bin/pass_copy.sh b/.local/bin/pass_copy.sh new file mode 100755 index 0000000..7da4912 --- /dev/null +++ b/.local/bin/pass_copy.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +entry=$(gopass list --flat | bemenu -p Password: -l 25 -c -M 500 --fn 'Monospace 14' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00') + +if [ -n "$entry" ]; then + gopass show -c "$entry" 2>/dev/null || notify-send "Gopass Error" "Failed to copy: $entry" +fi + diff --git a/.local/bin/pass_user_copy.sh b/.local/bin/pass_user_copy.sh new file mode 100755 index 0000000..c5784e5 --- /dev/null +++ b/.local/bin/pass_user_copy.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +entry=$(gopass list --flat | bemenu -p Username: -l 25 -c -M 500 --fn 'Monospace 14' --tf '#ff4e00' --ff '#dbc077' --hf '#ff4e00') + +if [ -n "$entry" ]; then + gopass show -c "$entry" username 2>/dev/null || notify-send "Gopass Error" "Failed to copy username from: $entry" +fi +