From 54bd85b0c046ed190724fcfeaaa129c88020b5a2 Mon Sep 17 00:00:00 2001 From: Moviuro Date: Sun, 1 Apr 2018 12:10:46 +0200 Subject: [PATCH] rofi-pass, README.md: open URLs in private window --- rofi-pass | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rofi-pass b/rofi-pass index 4ce5bb1..c2f7751 100755 --- a/rofi-pass +++ b/rofi-pass @@ -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 }