helm/base/arch-desktop/bin/urxvt-pass-manager

30 lines
765 B
Plaintext
Raw Normal View History

#!/usr/bin/env zsh
#
2018-03-23 12:29:50 -07:00
# Opens sk-pass in a transient popup window and temporary tmux session,
# recreating this window if necessary.
#
# Get firefox's current url; requires "Hostname in title" plugin for firefox
win=$(xdotool getactivewindow)
if [[ -n $win ]]; then
winname=$(xdotool getwindowname $win)
if [[ $winname =~ " - Mozilla Firefox$" ]]; then
url=${winname% - Mozilla*}
url=${url##* - }
while (( ${#url//[^.]/} > 1 )); do
url=${url#*.}
done
fi
fi
# Present the popup
xdotool search --onlyvisible --classname urxvt-fuzzy windowkill
bspc monitor -f primary
urxvt -name urxvt-fuzzy \
-geometry 100x16 \
-e $SHELL \
2018-03-23 12:29:50 -07:00
-c "sk-pass $@ $url"
[[ -n $win ]] && xdotool windowactivate $win