From 1b4dc09bbfc18f4a517f5ef3872d4c3e68943570 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 23 Dec 2021 22:36:12 +0100 Subject: [PATCH] Remove old keyboard shortcut and add the new one --- installFlameshot.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/installFlameshot.sh b/installFlameshot.sh index 49ead83..2d98630 100644 --- a/installFlameshot.sh +++ b/installFlameshot.sh @@ -6,4 +6,28 @@ echo -e "\nFlameshot installed!" # Apply custom configuration rm $HOME/.config/flameshot/flameshot.ini 2>/dev/null wget https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/flameshot/flameshot.ini -P $HOME/.config/flameshot/ + +# Remove old shortcut assign with the Print key +gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot "[]" +echo -e "\nOld ImprEcran shortcut removed!" + +# Fetching customs keyboard shortcuts +CUSTOM_KEYBINDINGS_LIST=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) + +if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # Creating new list if not exists +then + CUSTOM_KEYBINDINGS_LIST="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/']" +else # If already existing, adding our new element + CUSTOM_KEYBINDINGS_LIST="${CUSTOM_KEYBINDINGS_LIST::-1}, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/']" +fi + +# Updating the list +gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$CUSTOM_KEYBINDINGS_LIST" + +# Configure the new shortcut +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/ name 'Flameshot' # set name +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/ command 'flameshot gui' # set command +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/ binding 'Print' # set key +echo -e "\nFlameshot shortcut added (ImprEcran key)!" + echo -e "\nFlameshot configured! 🎉"