summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-03-05 14:40:40 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-03-05 14:40:40 +0530
commitf23cfa36053e25466b4bb0263c74e0a0ecfd76d2 (patch)
tree0f3783ee05aef772966f6189e32191f19d2247f2
parentfdadbc2b15401cc077daadcd1239e81074ddb30c (diff)
pass-otp menu
-rwxr-xr-x.local/bin/passmenu32
-rw-r--r--.xinitrc52
2 files changed, 33 insertions, 51 deletions
diff --git a/.local/bin/passmenu b/.local/bin/passmenu
new file mode 100755
index 0000000..b2f41cb
--- /dev/null
+++ b/.local/bin/passmenu
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#!/usr/bin/env bash
+
+shopt -s nullglob globstar
+
+typeit=0
+if [[ $1 == "--type" ]]; then
+ typeit=1
+ shift
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=( "$prefix"/**/*.gpg )
+password_files=( "${password_files[@]#"$prefix"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
+
+[[ -n $password ]] || exit
+
+pass_cmd=show
+if pass show "$password" | grep -q '^otpauth://'; then
+ pass_cmd=otp
+fi
+
+if [[ $typeit -eq 0 ]]; then
+ pass $pass_cmd -c "$password" 2>/dev/null
+ else
+ pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+ xdotool type --clearmodifiers --file -
+fi
diff --git a/.xinitrc b/.xinitrc
index aa07696..c0e66b6 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -6,57 +6,7 @@ setbg &
nm-applet &
unclutter &
picom --experimental-backends &
+xmodmap ~/.config/xmodmap
setxkbmap -option caps:escape &
dwmblocks &
exec dwm
-
-
-[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
-
-xrdb $HOME ~/.Xresources
-userresources=$HOME/.Xresources
-usermodmap=$HOME/.Xmodmap
-sysresources=/etc/X11/xinit/.Xresources
-sysmodmap=/etc/X11/xinit/.Xmodmap
-
-# merge in defaults and keymaps
-
-if [ -f $sysresources ]; then
-
-
-
-
-
-
-
- xrdb -merge $sysresources
-
-fi
-
-if [ -f $sysmodmap ]; then
- xmodmap $sysmodmap
-fi
-
-if [[ -f "$userresources" ]] && xrdb -merge -I$HOME ~/.Xresources
-
-fi
-
-if [ -f "$usermodmap" ]; then
- xmodmap "$usermodmap"
-fi
-
-# start some nice programs
-
-if [ -d /etc/X11/xinit/xinitrc.d ] ; then
- for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
- [ -x "$f" ] && . "$f"
- done
- unset f
-fi
-
-twm &
-xclock -geometry 50x50-1+1 &
-xterm -geometry 80x50+494+51 &
-xterm -geometry 80x20+494-0 &
-exec xterm -geometry 80x66+0+0 -name login
-