Skip to content

Commit

Permalink
rofi-pass, README.md: open URLs in private window
Browse files Browse the repository at this point in the history
  • Loading branch information
moviuro committed Apr 1, 2018
1 parent eb45b86 commit d13b4ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ in a convenient way using [rofi](https://github.com/DaveDavenport/rofi).
## Features

* Open URLs of entries with hotkey
* Open URLs of entries with hotkey in private browsing windows if the pass file
contains either `private` or `incognito` alone on a line.
* Add new Entries to Password Storage
* Edit existing Entries
* Generate new passwords for entries
Expand Down
15 changes: 14 additions & 1 deletion rofi-pass
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,20 @@ generateQrCode() {

openURL () {
checkIfPass
$BROWSER "$(PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
local url private_switch
url="$(PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"
if PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep -qE '^(private|incognito)$'; then
# We deal with private browsing
case "$BROWSER" in
*chrom*) private_switch="--incognito" ;;
*firefox*) private_switch="-private-window" ;;
*) # We fail hard
notify-send "can't find private switch for BROWSER $BROWSER; aborting"
exit 99 ;;
esac
fi
$BROWSER "$private_switch" "$url" &
unset url
clearUp
}

Expand Down

0 comments on commit d13b4ca

Please sign in to comment.