AutoYADM commit: 2025-05-04 18:00:06

This commit is contained in:
Daniel Fichtinger 2025-05-04 18:00:06 -04:00
parent 62b35dcdbf
commit 4d114c959a
3 changed files with 62 additions and 11 deletions

View file

@ -0,0 +1,3 @@
#!/usr/bin/env fish
echo rbw-fish

View file

@ -0,0 +1,44 @@
#!/usr/bin/env sh
set -eu
IFS='
'
# Creator: Robert Buchberger <robert@buchberger.cc>
# @robert@spacey.space
#
# Select an item from bitwarden with wofi, return value for passed query
# Dependencies: rbw installed and configured
#
# Usage: rbw-menu [query]
# query: "code" or anything on the login object; username, password, totp, etc
# - code will return a TOTP code
# - anything else will return the value of the query
# default: username
# Check if rbw is locked, redirect stderr and stdout to /dev/null. Unlock if
# necessary.
rbw unlocked >/dev/null 2>&1 || rbw unlock
query=${1:-username}
chosen_item=$(
# If RBW_MENU_COMMAND is unset, use wofi
if [ "${RBW_MENU_COMMAND:-}" = "" ]; then
rbw list | wofi --dmenu --matching fuzzy --insensitive --prompt "$query"
else
eval "rbw list | $RBW_MENU_COMMAND"
fi
)
# Exit if user didn't select anything
[ "$chosen_item" = "" ] && exit 1
case "$query" in
code)
rbw code "$chosen_item"
;;
*)
# Select chosen item from vault, return login.query
rbw get "$chosen_item" --raw | jq --join-output ".data.$query"
;;
esac

View file

@ -1,17 +1,21 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set -l opts --selector fuzzel --clipboarder wl-copy --typer wtype --use-notify-send
set -l cmd (echo type\ncopy\nprint\n | fuzzel --prompt="Mode: " --dmenu) set -l cmd (echo type\ncopy\nprint\n | fuzzel --prompt="Mode: " --dmenu)
set -l opts --selector fuzzel --clear-after 60 --clipboarder wl-copy --typer wtype --use-notify-send set -l target (echo username\npassword\nautotype | fuzzel --prompt="Targets: " --dmenu)
rofi-rbw $opts --action $cmd if not test "$target" = both
set --append opts --target $target
end
# if test "$cmd" = type if test "$cmd" = type
# rofi-rbw $opts --action type rofi-rbw $opts --action type
# else if test "$cmd" = copy else if test "$cmd" = copy
# rofi-rbw $opts --action copy rofi-rbw $opts --action copy
# else if test "$cmd" = print else if test "$cmd" = print
# rofi-rbw $opts --action print notify-send --wait (rofi-rbw $opts --action print | string collect -N)
# else else
# return 1 return 1
# end end