From 8ec4e9feddac4754cc222b64733e4810101bc14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Drahn=C3=ADk?= Date: Sat, 18 Mar 2023 13:27:31 +0100 Subject: [PATCH] #110 fixed case when was setting calculator toggling script as first to custom keybindings list --- install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index a57a5935..5b96f490 100755 --- a/install.sh +++ b/install.sh @@ -287,9 +287,14 @@ if [[ $(type gsettings 2>/dev/null) ]]; then # credits (https://unix.stackexchange.com/questions/323160/gnome3-adding-keyboard-custom-shortcuts-using-dconf-without-need-of-logging) existing_shortcut_string=$(runuser -u $SUDO_USER gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) #echo $existing_shortcut_string - exst_str_len=$((${#existing_shortcut_string})) - IFS=', ' read -ra existing_shortcut_array <<< "$existing_shortcut_string" - existing_shortcut_count="${#existing_shortcut_array[@]}" + + if [[ "$existing_shortcut_string" == "@as []" ]] + then + existing_shortcut_count=0 + else + IFS=', ' read -ra existing_shortcut_array <<< "$existing_shortcut_string" + existing_shortcut_count="${#existing_shortcut_array[@]}" + fi #echo $existing_shortcut_count new_shortcut_index=$(("$existing_shortcut_count")) #echo $new_shortcut_index