mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: disable swayfx for non-nixos, modul. pkgs
This commit is contained in:
parent
e66390bd1f
commit
2390199b8a
7 changed files with 218 additions and 162 deletions
32
pkgs/pass-fuzzel-otp/default.nix
Normal file
32
pkgs/pass-fuzzel-otp/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ writeShellApplication, libnotify, pass, fuzzel, wtype }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "pass-fuzzel-otp";
|
||||
runtimeInputs = [ fuzzel (pass.withExtensions (exts: [ exts.pass-otp ])) ];
|
||||
text = ''
|
||||
shopt -s nullglob globstar
|
||||
|
||||
typeit=0
|
||||
if [[ $# -ge 1 && $1 == "--type" ]]; then
|
||||
typeit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
export PASSWORD_STORE_DIR=~/.local/share/password-store
|
||||
prefix=''${PASSWORD_STORE_DIR-~/.local/share/password-store}
|
||||
password_files=( "$prefix"/otp/**/*.gpg )
|
||||
password_files=( "''${password_files[@]#"$prefix"/}" )
|
||||
password_files=( "''${password_files[@]%.gpg}" )
|
||||
|
||||
password=$(printf '%s\n' "''${password_files[@]}" | fuzzel --dmenu "$@")
|
||||
|
||||
[[ -n $password ]] || exit
|
||||
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass otp -c "$password" &>/tmp/pass-fuzzel
|
||||
else
|
||||
pass otp "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
|
||||
fi
|
||||
notify-send -u critical -a pass -t 1000 "Copied/Typed OTPassword"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue