From 30c09bfa87b8373689af969293ff5817d1ae7add Mon Sep 17 00:00:00 2001 From: tavo Date: Sat, 20 Sep 2025 20:17:31 -0600 Subject: [PATCH] updates --- i3/config | 3 +- scripts/gtype | 7 ++ ...menu-copy-bookmark => menu-bookmarks-copy} | 0 ...menu-open-bookmark => menu-bookmarks-open} | 0 .../menu/{menu-copy-emoji => menu-emoji-copy} | 0 scripts/menu/menu-pass | 94 ++++++++++++++++++- scripts/menu/menu-pass-copy | 7 ++ scripts/menu/menu-pass-gtype | 7 ++ scripts/menu/menu-start | 11 +-- scripts/setup/setup-anypinentry | 7 ++ snippets/typst_hide_eq_label.typ | 12 +++ 11 files changed, 135 insertions(+), 13 deletions(-) create mode 100755 scripts/gtype rename scripts/menu/{menu-copy-bookmark => menu-bookmarks-copy} (100%) rename scripts/menu/{menu-open-bookmark => menu-bookmarks-open} (100%) rename scripts/menu/{menu-copy-emoji => menu-emoji-copy} (100%) create mode 100755 scripts/menu/menu-pass-copy create mode 100755 scripts/menu/menu-pass-gtype create mode 100755 scripts/setup/setup-anypinentry create mode 100644 snippets/typst_hide_eq_label.typ diff --git a/i3/config b/i3/config index 4a7b0ac..41ce85b 100644 --- a/i3/config +++ b/i3/config @@ -31,7 +31,7 @@ bindsym Shift+XF86AudioLowerVolume exec micdown bindsym Shift+XF86AudioMute exec micmute bindsym XF86MonBrightnessUp exec brightup bindsym XF86MonBrightnessDown exec brightdown -bindsym Print exec $prtsc +bindsym Print exec prtsc #bindsym $mod+Shift+c exec clipman pick -t wofi -T'--show dmenu -I' bindsym $mod+1 workspace " 1 " @@ -48,7 +48,6 @@ bindsym $mod+comma workspace next_on_output bindsym $mod+period workspace prev_on_output bindsym $mod+Shift+q reload -bindsym $mod+p exec menu-power bindsym $mod+c kill bindsym $mod+$left focus left bindsym $mod+$down focus down diff --git a/scripts/gtype b/scripts/gtype new file mode 100755 index 0000000..7a6b3c8 --- /dev/null +++ b/scripts/gtype @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "$GDK_BACKEND" = "x11" ]; then + xdotool type --file - +elif [ "$GDK_BACKEND" = "wayland" ]; then + echo "add wtype" +fi diff --git a/scripts/menu/menu-copy-bookmark b/scripts/menu/menu-bookmarks-copy similarity index 100% rename from scripts/menu/menu-copy-bookmark rename to scripts/menu/menu-bookmarks-copy diff --git a/scripts/menu/menu-open-bookmark b/scripts/menu/menu-bookmarks-open similarity index 100% rename from scripts/menu/menu-open-bookmark rename to scripts/menu/menu-bookmarks-open diff --git a/scripts/menu/menu-copy-emoji b/scripts/menu/menu-emoji-copy similarity index 100% rename from scripts/menu/menu-copy-emoji rename to scripts/menu/menu-emoji-copy diff --git a/scripts/menu/menu-pass b/scripts/menu/menu-pass index 717a7af..e078a34 100755 --- a/scripts/menu/menu-pass +++ b/scripts/menu/menu-pass @@ -1,8 +1,92 @@ #!/bin/sh -# menu for 'pass' -PASSWORD_STORE_DIR="$HOME/.local/share/password-store" -MENU="$HOME/.config/scripts/menu/menu" +PASSWORD_STORE_DIR= +PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-"$XDG_DATA_HOME"/password-store}" +MENU="menu "dmenu" """ -password="$(find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' | sed "s@$PASSWORD_STORE_DIR/@@g ; s@.gpg@@g" | $MENU "dmenu" "Pass:")" +if ! [ -d "$PASSWORD_STORE_DIR" ]; then + echo "error: could not find password-store directory" + exit 1 +fi -! [ -z "$password" ] && printf '%s' "$password" || exit 1 +passw="$(find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' | while read s; do + name="${s#"$PASSWORD_STORE_DIR"/}" + name="${name%.gpg}" + echo "$name" +done | $MENU)" + +if [ -z "$passw" ]; then + exit 0 +fi + +contents="$(pass "$passw")" + +counter=0 +field="$(echo "$contents" | while read -r line; do + counter=$((counter + 1)) + if [ "$counter" -eq 1 ]; then + echo "󰌾 Password" + echo "󰦨 All" + fi + + case "$line" in + user:* | User:* | USER:*) + echo " Username" + ;; + email:* | Email:* | EMAIL:*) + echo "󰇮 Email" + ;; + otpauth:* | Otpauth:* | OTPAUTH:*) + echo "󰦯 OTP" + ;; + *) ;; + esac +done | $MENU)" + +counter=0 +echo "$contents" | while read -r line; do + counter=$((counter + 1)) + if [ "$counter" -eq 1 ]; then + case "$field" in + *Password) + echo "$line" + exit 0 + ;; + *All) + echo "$contents" + exit 0 + ;; + esac + fi + + case "$line" in + user:* | User:* | USER:*) + case "$field" in + *Username) + c="${line#*:}" + c="${c# }" + echo "$c" + exit 0 + ;; + esac + ;; + email:* | Email:* | EMAIL:*) + case "$field" in + *Email) + c="${line#*:}" + c="${c# }" + echo "$c" + exit 0 + ;; + esac + ;; + otpauth:* | Otpauth:* | OTPAUTH:*) + case "$field" in + *OTP) + pass otp "$passw" + exit 0 + ;; + esac + ;; + *) ;; + esac +done diff --git a/scripts/menu/menu-pass-copy b/scripts/menu/menu-pass-copy new file mode 100755 index 0000000..8013a77 --- /dev/null +++ b/scripts/menu/menu-pass-copy @@ -0,0 +1,7 @@ +#!/bin/sh + +p="$(menu-pass)" + +if [ -n "$p" ]; then + printf '%s' "$p" | clip +fi diff --git a/scripts/menu/menu-pass-gtype b/scripts/menu/menu-pass-gtype new file mode 100755 index 0000000..de88364 --- /dev/null +++ b/scripts/menu/menu-pass-gtype @@ -0,0 +1,7 @@ +#!/bin/sh + +p="$(menu-pass)" + +if [ -n "$p" ]; then + printf '%s' "$p" | gtype +fi diff --git a/scripts/menu/menu-start b/scripts/menu/menu-start index 92d5fbf..8587a1e 100755 --- a/scripts/menu/menu-start +++ b/scripts/menu/menu-start @@ -1,6 +1,6 @@ #!/bin/sh -options="󰀻:Run 󰌾:Password 󰦯:OTP 󰕾:Output 󰍬:Input 󰱱:Emoji 󰃀:Open_Bookmark 󰆏:Copy_Bookmark 󰐥:Power" +options="󰀻:Run 󰌾:Password 󰕾:Output 󰍬:Input 󰱱:Emoji 󰃀:Open_Bookmark 󰆏:Copy_Bookmark 󰐥:Power" separator=" " chosen="$(for o in $options; do @@ -11,16 +11,15 @@ chosen="${chosen#*"$separator"}" case "$chosen" in Run) menu "run" "" ;; -Password) menu-pass ;; -OTP) menu-otp ;; +Password) menu-pass-gtype ;; Output) menu-output ;; Input) menu-input ;; -Emoji) menu-copy-emoji ;; +Emoji) menu-emoji-copy ;; -Open_Bookmark) menu-open-bookmark ;; -Copy_Bookmark) menu-copy-bookmark ;; +Open_Bookmark) menu-bookmarks-open ;; +Copy_Bookmark) menu-bookmarks-copy ;; Power) menu-power ;; diff --git a/scripts/setup/setup-anypinentry b/scripts/setup/setup-anypinentry new file mode 100755 index 0000000..2e116dd --- /dev/null +++ b/scripts/setup/setup-anypinentry @@ -0,0 +1,7 @@ +#!/bin/sh +pinentry_script="$HOME/.config/scripts/anypinentry" +gpg_conf_file="$HOME/.local/share/gnupg/gpg-agent.conf" + +printf 'pinentry-program %s\n' "$pinentry_script" >"$gpg_conf_file" +chmod 600 "$gpg_conf_file" +gpg-agent reload diff --git a/snippets/typst_hide_eq_label.typ b/snippets/typst_hide_eq_label.typ new file mode 100644 index 0000000..0523d9d --- /dev/null +++ b/snippets/typst_hide_eq_label.typ @@ -0,0 +1,12 @@ +/* Do not label equations unless they have an */ +#show: body => { + for elem in body.children { + if elem.func() == math.equation and elem.block { + let numbering = if "label" in elem.fields().keys() { "(1)" } else { none } + set math.equation(numbering: numbering) + elem + } else { + elem + } + } +}