aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2017-07-15 23:47:24 +0200
committerGitHub <noreply@github.com>2017-07-15 23:47:24 +0200
commit21532f8d926c481dc62400c8b427f679e035c85d (patch)
tree5d8a2a9efae5754e8d8c7a27e1e2f319b24b894b
parentac5ee34d5961611f3ef8798eb2152110c24a0f95 (diff)
parentb8ec983209ff708c8f542b772d800091436ee141 (diff)
downloadrofi-pass-21532f8d926c481dc62400c8b427f679e035c85d.tar.gz
Merge pull request #80 from dkasak/master
Fix copy username action (and some miscellaneous cleanup).
-rwxr-xr-xrofi-pass171
1 files changed, 86 insertions, 85 deletions
diff --git a/rofi-pass b/rofi-pass
index 371e312..804d8ce 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -328,18 +328,18 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
# actions based on keypresses
if [[ "${rofi_exit}" -eq 0 ]]; then typeMenu;
- elif [[ "${rofi_exit}" -eq 13 ]]; then openURL;
elif [[ "${rofi_exit}" -eq 10 ]]; then sleep 0.2; autopass;
- elif [[ "${rofi_exit}" -eq 14 ]]; then copyMenu;
elif [[ "${rofi_exit}" -eq 11 ]]; then sleep 0.2; typeUser;
elif [[ "${rofi_exit}" -eq 12 ]]; then sleep 0.2; typePass;
- elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
+ elif [[ "${rofi_exit}" -eq 13 ]]; then openURL;
+ elif [[ "${rofi_exit}" -eq 14 ]]; then copyUser;
+ elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
elif [[ "${rofi_exit}" -eq 16 ]]; then viewEntry;
+ elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
elif [[ "${rofi_exit}" -eq 18 ]]; then export default_do="menu"; typeMenu;
- elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu;
- elif [[ "${rofi_exit}" -eq 25 ]]; then unset selected_password; helpMenu;
elif [[ "${rofi_exit}" -eq 24 ]]; then copyMenu;
+ elif [[ "${rofi_exit}" -eq 25 ]]; then unset selected_password; helpMenu;
elif [[ "${rofi_exit}" -eq 26 ]]; then ${basecommand} --bmarks;
elif [[ "${rofi_exit}" -eq 27 ]]; then insertPass;
fi
@@ -586,7 +586,7 @@ help_msg () {
echo -e "Usage:\n"
echo "--insert insert new entry to password store"
echo "--manage edit/move/delete entries"
- echo -e "--root set custom root directory"
+ echo "--root set custom root directory"
echo "--last-used highlight last used item"
echo "--show-last show details of last used Entry"
echo "--bmarks run bookmarks Mode"
@@ -594,85 +594,86 @@ help_msg () {
}
main () {
-# enable extended globbing
-shopt -s nullglob globstar
-
-# check if global config exists and load it
-if [[ -f /etc/rofi-pass.conf ]]; then
- source /etc/rofi-pass.conf
-fi
-
-# check if local config exists and load it
-if [[ -f "$HOME/.config/rofi-pass/config" ]]; then
- source "$HOME/.config/rofi-pass/config"
-fi
-
-# create tmp dir
-if [[ ! -d "$HOME/.cache/rofi-pass" ]]; then
- mkdir "$HOME/.cache/rofi-pass"
-fi
-
-# fix keyboard layout if enabled in config
-if [[ $fix_layout == "true" ]]
-then
- layout_cmd
-fi
-
-# set help color
-if [[ $help_color == "" ]]; then
- help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')
-fi
-
-# check for BROWSER variable, use xdg-open as fallback
-if [[ -z $BROWSER ]]; then
- export BROWSER=xdg-open
-fi
-
-# check if alternative root directory was given on commandline
-if [[ -r "$HOME/.cache/rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then
- export root; root=$(awk -F ': ' '{ print $1 }' "$HOME/.cache/rofi-pass/last_used")
-elif [[ -n "$2" && "$1" == "--root" ]]; then
- export root="${2}"
-elif [[ -n $root ]]; then
- export root="${root}"
-elif [[ -n ${PASSWORD_STORE_DIR} ]]; then
- export root=${PASSWORD_STORE_DIR}
-else
- export root="$HOME/.password-store"
-fi
-export PASSWORD_STORE_DIR="${root}"
- case $1 in
- --insert)
- insertPass
- ;;
- --root)
- mainMenu
- ;;
- --manage)
- manageEntry
- ;;
- --help)
- help_msg
- ;;
- --last-used)
- if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then
- entry="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")"
- fi
- mainMenu
- ;;
- --show-last)
- if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then
- selected_password="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")" viewEntry
- else
+ # enable extended globbing
+ shopt -s nullglob globstar
+
+ # check if global config exists and load it
+ if [[ -f /etc/rofi-pass.conf ]]; then
+ source /etc/rofi-pass.conf
+ fi
+
+ # check if local config exists and load it
+ if [[ -f "$HOME/.config/rofi-pass/config" ]]; then
+ source "$HOME/.config/rofi-pass/config"
+ fi
+
+ # create tmp dir
+ if [[ ! -d "$HOME/.cache/rofi-pass" ]]; then
+ mkdir "$HOME/.cache/rofi-pass"
+ fi
+
+ # fix keyboard layout if enabled in config
+ if [[ $fix_layout == "true" ]]
+ then
+ layout_cmd
+ fi
+
+ # set help color
+ if [[ $help_color == "" ]]; then
+ help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')
+ fi
+
+ # check for BROWSER variable, use xdg-open as fallback
+ if [[ -z $BROWSER ]]; then
+ export BROWSER=xdg-open
+ fi
+
+ # check if alternative root directory was given on commandline
+ if [[ -r "$HOME/.cache/rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then
+ export root; root=$(awk -F ': ' '{ print $1 }' "$HOME/.cache/rofi-pass/last_used")
+ elif [[ -n "$2" && "$1" == "--root" ]]; then
+ export root="${2}"
+ elif [[ -n $root ]]; then
+ export root="${root}"
+ elif [[ -n ${PASSWORD_STORE_DIR} ]]; then
+ export root=${PASSWORD_STORE_DIR}
+ else
+ export root="$HOME/.password-store"
+ fi
+ export PASSWORD_STORE_DIR="${root}"
+ case $1 in
+ --insert)
+ insertPass
+ ;;
+ --root)
mainMenu
- fi
- ;;
- --bmarks)
- mainMenu --bmarks;
- ;;
- *)
- mainMenu
- ;;
-esac
+ ;;
+ --manage)
+ manageEntry
+ ;;
+ --help)
+ help_msg
+ ;;
+ --last-used)
+ if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then
+ entry="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")"
+ fi
+ mainMenu
+ ;;
+ --show-last)
+ if [[ -r "$HOME/.cache/rofi-pass/last_used" ]]; then
+ selected_password="$(awk -F ': ' '{ print $2 }' "$HOME/.cache/rofi-pass/last_used")" viewEntry
+ else
+ mainMenu
+ fi
+ ;;
+ --bmarks)
+ mainMenu --bmarks;
+ ;;
+ *)
+ mainMenu
+ ;;
+ esac
}
+
main "$@"