summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Agarwal <ayush@fastmail.in>2022-02-18 22:09:50 +0530
committerAyush Agarwal <ayush@fastmail.in>2022-02-18 22:09:50 +0530
commit99d97ddf8cdfbf6abdc247d8036d596a65602060 (patch)
treeb771d723d392c1cdcd28069d2b5130bd95345a7c
parent7726e35e8f2d7f8559ed13124b5aa54144389e83 (diff)
fix: rofi and wofi need individual variables
since rofi and wofi support configuring themselves with config files, which is the sensible thing to do, we'll need to store their config option in separate variables to avoid conflict scenarios with the options of other dmenu backends rather than using `eval`, I've used parameter transformations in bash to expand possible variables provided in the config file. however, to avoid expanding and accepting arbitrary input, i'll use a regex to filter unwanted data
-rwxr-xr-xtessen24
1 files changed, 10 insertions, 14 deletions
diff --git a/tessen b/tessen
index f12e1d5..9eaf515 100755
--- a/tessen
+++ b/tessen
@@ -13,7 +13,7 @@ set +x
# GLOBAL VARIABLES
readonly tsn_version="2.0.0"
declare pass_backend dmenu_backend tsn_action tsn_config
-declare -a dmenu_backend_opts tmp_opts
+declare -a dmenu_backend_opts tmp_rofi_opts tmp_wofi_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"
@@ -736,19 +736,15 @@ parse_config() {
validate_dmenu_backend "$val"
elif [[ $key == "action" ]]; then
validate_action "$val"
- elif [[ $key == "rofi_config_file" ]] && [[ $dmenu_backend == "rofi" ]]; then
- validate_dmenu_backend rofi
- dmenu_backend_opts+=("-config $val")
- tmp_opts+=("-config $val")
- elif [[ $key == "wofi_config_file" ]] && [[ $dmenu_backend == "wofi" ]]; then
- dmenu_backend_opts+=("-c $val")
- tmp_opts+=("-c $val")
- elif [[ $key == "wofi_style_file" ]] && [[ $dmenu_backend == "wofi" ]]; then
- dmenu_backend_opts+=("-s $val")
- tmp_opts+=("-s $val")
- elif [[ $key == "wofi_color_file" ]] && [[ $dmenu_backend == "wofi" ]]; then
- dmenu_backend_opts+=("-C $val")
- tmp_opts+=("-C $val")
+ readonly tsn_action
+ elif [[ $key == "rofi_config_file" ]] && [[ -f ${val@P} ]]; then
+ tmp_rofi_opts+=("-config" "${val@P}")
+ elif [[ $key == "wofi_config_file" ]] && [[ -f ${val@P} ]]; then
+ tmp_wofi_opts+=("-c" "${val@P}")
+ elif [[ $key == "wofi_style_file" ]] && [[ -f ${val@P} ]]; then
+ tmp_wofi_opts+=("-s" "${val@P}")
+ elif [[ $key == "wofi_color_file" ]] && [[ -f ${val@P} ]]; then
+ tmp_wofi_opts+=("-C" "${val@P}")
elif [[ $key == "userkey" ]]; then
tsn_userkey="$val"
elif [[ $key == "urlkey" ]]; then