This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / passmenu / flake-module.nix
2.4 kB 71 lines
1{ self, ... }: 2{ 3 perSystem = 4 { pkgs, ... }: 5 { 6 packages.passmenu = pkgs.writeShellApplication { 7 name = "passmenu"; 8 runtimeInputs = 9 with pkgs; 10 [ 11 self.packages.${pkgs.system}.menu 12 self.packages.${pkgs.system}.pass 13 ] 14 ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ 15 wtype 16 xdotool 17 ]; 18 text = '' 19 set -eu 20 set -x 21 shopt -s nullglob globstar 22 23 typeit=0 24 if [[ $# -gt 0 && $1 == "--type" ]]; then 25 typeit=1 26 shift 27 fi 28 29 prefix=''${PASSWORD_STORE_DIR-~/.passage/store} 30 password_files=( "$prefix"/**/*.age ) 31 password_files=( "''${password_files[@]#"$prefix"/}" ) 32 password_files=( "''${password_files[@]%.age}" ) 33 34 password=$(printf '%s\n' "''${password_files[@]}" | menu "$@") 35 36 filename=$(basename "$password") 37 if [[ "$filename" == "otp" ]]; then 38 if [[ $typeit -eq 1 ]]; then 39 # Type OTP code 40 otp_code=$(pass otp "$password" | tr -d '\n') 41 if [[ "$(uname)" == "Darwin" ]]; then 42 # On macOS, use osascript to type the code 43 osascript -e "tell application \"System Events\" to keystroke \"$otp_code\"" 2>/dev/null 44 elif [[ -n "$WAYLAND_DISPLAY" ]]; then 45 echo -n "$otp_code" | wtype -d 10 -s 400 - 46 else 47 echo -n "$otp_code" | xdotool type --clearmodifiers --file - 48 fi 49 else 50 pass otp --clip "$password" 51 fi 52 else 53 if [[ $typeit -eq 1 ]]; then 54 # Type password 55 pw=$(pass show "$password" | head -n1 | tr -d '\n') 56 if [[ "$(uname)" == "Darwin" ]]; then 57 # On macOS, use osascript to type the password 58 osascript -e "tell application \"System Events\" to keystroke \"$pw\"" 2>/dev/null 59 elif [[ -n "$WAYLAND_DISPLAY" ]]; then 60 echo -n "$pw" | wtype -d 10 -s 400 - 61 else 62 echo -n "$pw" | xdotool type --clearmodifiers --file - 63 fi 64 else 65 pass show --clip "$password" 66 fi 67 fi 68 ''; 69 }; 70 }; 71}