Skip to content

Commit

Permalink
Merge pull request #147 from ofpau/master
Browse files Browse the repository at this point in the history
add config variable for pass clearing delay
  • Loading branch information
carnager authored Oct 5, 2018
2 parents a223275 + 1366441 commit 1c9e639
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions config.example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ help_color="#4872FF"
# Possible options: primary, clipboard, both
clip=primary

# Seconds before clearing pass from clipboard
clip_clear=45

## Options for generating new password entries

# open new password entries in editor
Expand Down
13 changes: 7 additions & 6 deletions rofi-pass
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ auto_enter='false'
notify='false'
help_color=""
clip=primary
clip_clear=45
default_user="${ROFI_PASS_DEFAULT_USER-$(whoami)}"
default_user2=john_doe
password_length=12
Expand Down Expand Up @@ -239,13 +240,13 @@ copyPass () {
checkIfPass
printf '%s' "$password" | doClip
if [[ $notify == "true" ]]; then
notify-send "rofi-pass" "Copied Password\\nClearing in 45 seconds"
notify-send "rofi-pass" "Copied Password\\nClearing in $clip_clear seconds"
fi

if [[ $notify == "true" ]]; then
(sleep 45; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
(sleep $clip_clear; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
elif [[ $notify == "false" ]]; then
(sleep 45; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard) &
(sleep $clip_clear; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard) &
fi
}

Expand Down Expand Up @@ -602,12 +603,12 @@ showEntry () {
printf '%s' "${stuff[${word}]}" | doClip
fi
if [[ $notify == "true" ]]; then
notify-send "rofi-pass" "Copied Password\\nClearing in 45 seconds"
notify-send "rofi-pass" "Copied Password\\nClearing in $clip_clear seconds"
fi
if [[ $notify == "true" ]]; then
(sleep 45; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
(sleep $clip_clear; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
elif [[ $notify == "false" ]]; then
(sleep 45; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard) &
(sleep $clip_clear; printf '%s' "" | xclip; printf '%s' "" | xclip -selection clipboard) &
fi
exit
fi
Expand Down

0 comments on commit 1c9e639

Please sign in to comment.