From d25930beda1262f54dad228562a79b3b1253b43f Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Mon, 23 Feb 2026 14:12:08 +0000 Subject: [PATCH] Refactored rbw-autofill --- .../worklaptop/packages/rbw_autofill.nix | 24 +------------------ .../worklaptop/packages/rbw_autofill.sh | 21 ++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 home-manager/worklaptop/packages/rbw_autofill.sh diff --git a/home-manager/worklaptop/packages/rbw_autofill.nix b/home-manager/worklaptop/packages/rbw_autofill.nix index 0a4b931..d25be98 100644 --- a/home-manager/worklaptop/packages/rbw_autofill.nix +++ b/home-manager/worklaptop/packages/rbw_autofill.nix @@ -2,27 +2,5 @@ pkgs.writeShellApplication { name = "rbw-autofill"; runtimeInputs = [pkgs.bash pkgs.libsecret pkgs.zenity]; - - text = '' - #!/usr/bin/env bash - echo "OK" - while read -r line; do - if [[ "$line" == "GETPIN" ]]; then - pass=$(secret-tool lookup application rbw 2>/dev/null) - if [[ -z "$pass" ]]; then - pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:") - if [[ -n "$pass" ]]; then - printf "%s" "$pass" | secret-tool store --label="rbw" application rbw - else - echo "ERR 100 Password retrieval cancelled" - exit 1 - fi - fi - printf "D %s\n" "$pass" - echo "OK" - exit 0 - fi - echo "OK" - done - ''; + text = builtins.readFile ./rbw_autofill.sh; } diff --git a/home-manager/worklaptop/packages/rbw_autofill.sh b/home-manager/worklaptop/packages/rbw_autofill.sh new file mode 100644 index 0000000..3c43104 --- /dev/null +++ b/home-manager/worklaptop/packages/rbw_autofill.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +echo "OK" +while read -r line; do + if [[ "$line" == "GETPIN" ]]; then + pass=$(secret-tool lookup application rbw 2>/dev/null) + if [[ -z "$pass" ]]; then + pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:") + if [[ -n "$pass" ]]; then + printf "%s" "$pass" | secret-tool store --label="rbw" application rbw + else + echo "ERR 100 Password retrieval cancelled" + exit 1 + fi + fi + printf "D %s\n" "$pass" + echo "OK" + exit 0 + fi + echo "OK" +done