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

30 lines
761 B
Plaintext
Raw Normal View History

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