reduce repetition (hope it works)
This commit is contained in:
parent
53f9bb0543
commit
151ff3dbf8
1 changed files with 38 additions and 36 deletions
74
arch.sh
74
arch.sh
|
@ -13,8 +13,10 @@ cd "$(dirname "$0")" # change script directory
|
|||
|
||||
function main {
|
||||
# === Variables ==
|
||||
local repo
|
||||
local repo gs_mediakey shortcut
|
||||
repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main
|
||||
gs_mediakey=org.gnome.settings-daemon.plugins.media-keys
|
||||
shortcut=/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings
|
||||
|
||||
|
||||
# === Assure that keyring is installed ==
|
||||
|
@ -105,17 +107,17 @@ function main {
|
|||
# Change keybindings
|
||||
gsettings set org.gnome.shell.keybindings show-screenshot-ui "[]"
|
||||
local custom_keybindings_list
|
||||
custom_keybindings_list=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
|
||||
custom_keybindings_list=$(gsettings get ${gs_mediakey} 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/']"
|
||||
custom_keybindings_list="['${shortcut}/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/']"
|
||||
custom_keybindings_list="${custom_keybindings_list::-1}, '${shortcut}/flameshot-shortcut/']"
|
||||
fi
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$custom_keybindings_list"
|
||||
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
|
||||
gsettings set ${gs_mediakey} custom-keybindings "$custom_keybindings_list"
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/flameshot-shortcut/ name "Flameshot" # set name
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/flameshot-shortcut/ command "flameshot gui" # set command
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/flameshot-shortcut/ binding "Print" # set key
|
||||
|
||||
|
||||
# === Emoji picker ==
|
||||
|
@ -123,20 +125,20 @@ function main {
|
|||
rm "$HOME"/.config/gazatu.xyz/emoji-picker.ini 2>/dev/null ||:
|
||||
wget -q --show-progress ${repo}/.config/gazatu.xyz/emoji-picker.ini -P "$HOME"/.config/gazatu.xyz/
|
||||
# Add keybinding
|
||||
custom_keybindings_list=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
|
||||
custom_keybindings_list=$(gsettings get ${gs_mediakey} custom-keybindings)
|
||||
if ! echo "$custom_keybindings_list" | grep -q "x11-emoji-picker"
|
||||
then
|
||||
if [ "$custom_keybindings_list" = "@as []" ] # creating new list if not exists
|
||||
then
|
||||
custom_keybindings_list="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/']"
|
||||
custom_keybindings_list="['${shortcut}/x11-emoji-picker/']"
|
||||
else # if already existing, adding our new element
|
||||
custom_keybindings_list=$(echo "$custom_keybindings_list" | sed "s/\[//" | sed "s/\]//")
|
||||
custom_keybindings_list="[$custom_keybindings_list, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/']"
|
||||
custom_keybindings_list="[$custom_keybindings_list, '${shortcut}/x11-emoji-picker/']"
|
||||
fi
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$custom_keybindings_list" # update the list
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ name "Emoji-Picker" # set name
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ command "emoji-picker" # set command
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ binding "<Super>period" # set shortcut
|
||||
gsettings set ${gs_mediakey} custom-keybindings "$custom_keybindings_list" # update the list
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/x11-emoji-picker/ name "Emoji-Picker" # set name
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/x11-emoji-picker/ command "emoji-picker" # set command
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/x11-emoji-picker/ binding "<Super>period" # set shortcut
|
||||
fi
|
||||
|
||||
|
||||
|
@ -169,17 +171,17 @@ function main {
|
|||
gnome-extensions enable color-picker@tuberry
|
||||
|
||||
# Nautilus keybinding
|
||||
custom_keybindings_list=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
|
||||
custom_keybindings_list=$(gsettings get ${gs_mediakey} 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/nautilus-shortcut/']"
|
||||
custom_keybindings_list="['${shortcut}/nautilus-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/nautilus-shortcut/']"
|
||||
custom_keybindings_list="${custom_keybindings_list::-1}, '${shortcut}/nautilus-shortcut/']"
|
||||
fi
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$custom_keybindings_list" # updating the list
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ name "Nautilus" # set name
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ command "nautilus -w" # set command
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ binding "<Super>E" # set shortcut
|
||||
gsettings set ${gs_mediakey} custom-keybindings "$custom_keybindings_list" # updating the list
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/nautilus-shortcut/ name "Nautilus" # set name
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/nautilus-shortcut/ command "nautilus -w" # set command
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/nautilus-shortcut/ binding "<Super>E" # set shortcut
|
||||
|
||||
# Some Gnome configuration
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock click-action minimize # add minimized window on dock click
|
||||
|
@ -248,17 +250,17 @@ function main {
|
|||
|
||||
# === Clipboard manager ==
|
||||
gsettings set org.gnome.shell.keybindings toggle-message-tray "[]"
|
||||
custom_keybindings_list=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
|
||||
custom_keybindings_list=$(gsettings get ${gs_mediakey} 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/clipboard-shortcut/']"
|
||||
custom_keybindings_list="['${shortcut}/clipboard-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/clipboard-shortcut/']"
|
||||
custom_keybindings_list="${custom_keybindings_list::-1}, '${shortcut}/clipboard-shortcut/']"
|
||||
fi
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$custom_keybindings_list" # updating the list
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/clipboard-shortcut/ name "Copyq" # set name
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/clipboard-shortcut/ command "copyq show" # set command
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/clipboard-shortcut/ binding "<Super>V" # set shortcut
|
||||
gsettings set ${gs_mediakey} custom-keybindings "$custom_keybindings_list" # updating the list
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/clipboard-shortcut/ name "Copyq" # set name
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/clipboard-shortcut/ command "copyq show" # set command
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/clipboard-shortcut/ binding "<Super>V" # set shortcut
|
||||
copyq > /dev/null & disown
|
||||
copyq config autostart true
|
||||
echo "style_main_window=true" >> /usr/share/copyq/themes/dark.ini
|
||||
|
@ -365,20 +367,20 @@ function main {
|
|||
# Enable
|
||||
systemctl enable --now --user gpu-screen-recorder
|
||||
# Keybind
|
||||
custom_keybindings_list=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
|
||||
custom_keybindings_list=$(gsettings get ${gs_mediakey} custom-keybindings)
|
||||
if ! echo "$custom_keybindings_list" | grep -q "gpu-screen-recorder"
|
||||
then
|
||||
if [ "$custom_keybindings_list" = "@as []" ] # creating new list if not exists
|
||||
then
|
||||
custom_keybindings_list="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gpu-screen-recorder/']"
|
||||
custom_keybindings_list="['${shortcut}/gpu-screen-recorder/']"
|
||||
else # if already existing, adding our new element
|
||||
custom_keybindings_list=$(echo "$custom_keybindings_list" | sed "s/\[//" | sed "s/\]//")
|
||||
custom_keybindings_list="[$custom_keybindings_list, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gpu-screen-recorder/']"
|
||||
custom_keybindings_list="[$custom_keybindings_list, '${shortcut}/gpu-screen-recorder/']"
|
||||
fi
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$custom_keybindings_list" # update the list
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gpu-screen-recorder/ name "Shadowplay" # set name
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gpu-screen-recorder/ command "bash -c \"killall -SIGUSR1 gpu-screen-recorder && notify-send -et 3000 -- 'Shadowplay' '2 dernières minutes sauvés dans ~/Vidéos'\"" # set command
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gpu-screen-recorder/ binding "<Super>Print" # set shortcut
|
||||
gsettings set ${gs_mediakey} custom-keybindings "$custom_keybindings_list" # update the list
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/gpu-screen-recorder/ name "Shadowplay" # set name
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/gpu-screen-recorder/ command "bash -c \"killall -SIGUSR1 gpu-screen-recorder && notify-send -et 3000 -- 'Shadowplay' '2 dernières minutes sauvés dans ~/Vidéos'\"" # set command
|
||||
gsettings set ${gs_mediakey}.custom-keybinding:${shortcut}/gpu-screen-recorder/ binding "<Super>Print" # set shortcut
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue