44 lines
2.2 KiB
Bash
44 lines
2.2 KiB
Bash
# Install flameshot
|
|
sudo apt update
|
|
sudo apt install flameshot -y
|
|
echo -e "\nFlameshot installed!"
|
|
|
|
# Apply custom configuration
|
|
rm $HOME/.config/flameshot/flameshot.ini 2>/dev/null
|
|
wget -q --show-progress 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 "Old 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)!"
|
|
|
|
# Removal of Ubuntu icon
|
|
if grep "Ubuntu" /proc/version > /dev/null;
|
|
then
|
|
# We remove the Ubuntu desktop shortcut only if it already exists
|
|
if [ -f /usr/share/applications/org.flameshot.Flameshot.desktop ]
|
|
then
|
|
sudo mv /usr/share/applications/org.flameshot.Flameshot.desktop /usr/share/applications/org.flameshot.Flameshot.desktop.bak
|
|
echo -e "\nFlameshot icon removed!"
|
|
fi
|
|
fi
|
|
|
|
echo -e "\nFlameshot configured! 🎉"
|