helm/base/arch-desktop/bin/urxvt-pass-manager
2018-03-23 15:29:50 -04:00

30 lines
765 B
Bash
Executable file

#!/usr/bin/env zsh
#
# 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 \
-c "sk-pass $@ $url"
[[ -n $win ]] && xdotool windowactivate $win