From 136644167c06e842dd4f49541de1f9b1feb74c42 Mon Sep 17 00:00:00 2001 From: Pau Oliver Date: Fri, 5 Oct 2018 21:53:32 +0200 Subject: add config variable for pass clearing delay --- config.example | 3 +++ rofi-pass | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config.example b/config.example index 7464bb5..cb32391 100644 --- a/config.example +++ b/config.example @@ -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 diff --git a/rofi-pass b/rofi-pass index 3834030..7e164e4 100755 --- a/rofi-pass +++ b/rofi-pass @@ -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 @@ -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 } @@ -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 -- cgit