From 369ede739c4af6a9a39c356586cf7947a236262a Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 5 May 2025 14:42:13 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-05 14:42:13 --- .config/niri/config.kdl##hostname.dbox | 4 ++++ .config/niri/scripts/rbw-fish.fish | 25 ++++++++++++++++++++++--- .config/rbw/config.json | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.config/niri/config.kdl##hostname.dbox b/.config/niri/config.kdl##hostname.dbox index ef0c31c3..4e6d4ae9 100644 --- a/.config/niri/config.kdl##hostname.dbox +++ b/.config/niri/config.kdl##hostname.dbox @@ -207,6 +207,10 @@ window-rule { match app-id="^spotify$" open-on-workspace "music" } +window-rule { + match app-id="footfloat" + open-floating true +} window-rule { // This regular expression is intentionally made as specific as possible, // since this is the default config, and we want no false positives. diff --git a/.config/niri/scripts/rbw-fish.fish b/.config/niri/scripts/rbw-fish.fish index e5bf76af..1f513c0c 100755 --- a/.config/niri/scripts/rbw-fish.fish +++ b/.config/niri/scripts/rbw-fish.fish @@ -3,15 +3,22 @@ # This script lets you query entries from bitwarden # using rbw and fuzzel. You can copy, auto-type, or show in notification. # Requires wl-copy, wtype, jq, and rbw. +# Intended use: bind this to a key in your window manager # unlock vault if needed # Note: launches foot with 'footfloat' app-id -# so Niri sets it as floating with the appropriate -# window rule +# You can use a window rule in your compositor +# to display this as a floating window if you wish +# This is to accommodate pinentry-curses or tty if not rbw unlocked - rbw unlock + foot -w 750x500 -a footfloat rbw unlock + # if the unlock failed we quit early + if not rbw unlocked + return 1 + end end +# check if action was given as arg, prompt otherwise set -l action if test (count $argv) -ne 0 set action $argv[1] @@ -21,8 +28,11 @@ end if test -z "$action" return 1 end + +# prompt for query set -l query set -l queries username password code +# double query only availably for type action if test "$action" = type set --append queries double end @@ -31,15 +41,19 @@ if test -z "$query" return 1 end +# prompt for account selection +# $selected is the entry's name used for lookup set -l selected (rbw list | fuzzel --prompt="$query: " --dmenu) if test -z "$selected" return 1 end +# get answer to the query for the selected account set -l output if test "$query" = code set output (rbw code "$selected") else if test "$query" = double + # special case for i in username password set --append output (rbw get "$selected" --raw | jq --join-output ".data.$i") end @@ -47,6 +61,7 @@ else set output (rbw get "$selected" --raw | jq --join-output ".data.$query") end +# finally process the output according to action switch $action case copy wl-copy $output @@ -54,11 +69,15 @@ switch $action if test (count $output) -eq 1 wtype "$output" else + # special case for double action + # to type both user and pass wtype "$output[1]" wtype -k Tab wtype "$output[2]" end case show + # notification doesn't time out + # until closed by user notify-send --wait "$output" case '*' notify-send "Invalid command!" diff --git a/.config/rbw/config.json b/.config/rbw/config.json index 034b515e..923d558c 100644 --- a/.config/rbw/config.json +++ b/.config/rbw/config.json @@ -7,6 +7,6 @@ "notifications_url": null, "lock_timeout": 3600, "sync_interval": 3600, - "pinentry": "pinentry", + "pinentry": "pinentry-curses", "client_cert_path": null } \ No newline at end of file