Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private browsing #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 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 Expand Up @@ -91,6 +93,10 @@ ROFI_PASS_CONFIG="$HOME/path/to/config" rofi-pass

For an example configuration please take a look at the included `config.example` file.

If you use a browser that is neither `chromium` nor `firefox`, you may edit the
`incognito_switches` array to add your own browser. Maybe even open a PR to
include it by default?

## Extras

### addpass
Expand Down
10 changes: 8 additions & 2 deletions config.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ wait=0.2

## Programs to be used
# Editor
EDITOR='gvim -f'
#EDITOR='gvim -f'

# Browser
BROWSER='xdg-open'
#BROWSER='xdg-open'

## Misc settings

Expand Down Expand Up @@ -86,3 +86,9 @@ type_menu="Alt+t"
help="Alt+h"
switch="Alt+x"
insert_pass="Alt+n"

# BROWSER -> incognito_switch association
declare -A incognito_switches
incognito_switches[google-chrome-stable]="--incognito"
incognito_switches[chromium]="--incognito"
incognito_switches[firefox]="-private-window"
13 changes: 12 additions & 1 deletion rofi-pass
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,18 @@ generateQrCode() {

openURL () {
checkIfPass
$BROWSER "$(PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
local url incognito_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
incognito_switch="${incognito_switches["$BROWSER"]}"
if [[ -z "$incognito_switch" ]]; then
notify-send "can't find private switch for BROWSER $BROWSER; aborting"
exit 99
fi
fi
"$BROWSER" "$incognito_switch" "$url" &
unset url
clearUp
}

Expand Down