summaryrefslogtreecommitdiff
path: root/tessen
diff options
context:
space:
mode:
authorAyush Agarwal <ayush@fastmail.in>2022-02-16 21:07:30 +0530
committerAyush Agarwal <ayush@fastmail.in>2022-02-16 21:07:30 +0530
commit75bd665fde9d0d940f45d644afae6308d01a33c3 (patch)
tree9cdc44b2d42adf76f65c90aaa29032f4c9163ba3 /tessen
parent54bf7b219cfa52817508df8dc7039413d59b2791 (diff)
feat!: add support for configuration file
I've dropped support for environment variables in favor of a config file. This was motivated by https://github.com/Cloudef/bemenu/issues/15 From what I think of environment variables, they're meant to be used when they won't change often, especially not during a live session while you're working. I don't think that performing a relogin to change colors in a dmenu program is a sensible thing. Sure, you can create wrapper scripts and place them in your `$PATH` but that feels like an inferior solution compared to config file kept in `$XDG_CONFIG_HOME`.
Diffstat (limited to 'tessen')
-rwxr-xr-xtessen33
1 files changed, 14 insertions, 19 deletions
diff --git a/tessen b/tessen
index 7f8d369..6c619a4 100755
--- a/tessen
+++ b/tessen
@@ -11,28 +11,23 @@
set +x
# GLOBAL VARIABLES
-# variables which won't be changed and can be made readonly
-readonly tsn_version="1.3.1"
-readonly tsn_prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
-readonly tsn_cliptime="${PASSWORD_STORE_CLIP_TIME:-15}"
-readonly tsn_delay="${TESSEN_DELAY:-200}"
-# a list of dmenu backends for which tessen provides default options
-readonly -a tsn_known_backends=('bemenu' 'fuzzel' 'rofi' 'wofi')
-# variables which hold data for possible actions and choices
-tsn_backend="${TESSEN_BACKEND-}"
-tsn_backend_opts=()
-tsn_action="${TESSEN_ACTION-}"
-tsn_userkey_regex="${TESSEN_USERKEY:-user}"
-tsn_userkey="user"
-tsn_urlkey="${TESSEN_URLKEY:-url}"
-tsn_autokey="${TESSEN_AUTOKEY:-autotype}"
-tsn_autotype=""
+readonly tsn_version="2.0.0"
+declare pass_backend dmenu_backend tsn_action tsn_config
+declare -a dmenu_backend_opts tmp_opts
+declare tsn_userkey tsn_urlkey tsn_autokey tsn_delay tsn_web_browser
+# show both actions, 'autotype' and 'copy', to choose from by default
+tsn_action="default"
tsn_otp=false
+# initialize default values for keys
+tsn_userkey="user"
+tsn_urlkey="url"
+tsn_autokey="autotype"
+tsn_delay=100
+# initialize the default location of the config file
+tsn_config="${XDG_CONFIG_HOME:-$HOME/.config}"/tessen/config
# variables with sensitive data which will be manually unset using _clear
-tsn_passfile=""
+declare tsn_passfile tsn_username tsn_password tsn_url tsn_autotype chosen_key
declare -A tsn_passdata
-tsn_username=""
-tsn_password=""
# FIRST MENU: generate a list of password store files, let the user select one
get_pass_file() {