30 lines
		
	
	
		
			765 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			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
 |