Skip to content

Instantly share code, notes, and snippets.

@augustin64
Created November 7, 2021 17:30
Show Gist options
  • Save augustin64/20955098b8c921894632179901067a49 to your computer and use it in GitHub Desktop.
Save augustin64/20955098b8c921894632179901067a49 to your computer and use it in GitHub Desktop.
Permet de changer rapidement de thème gnome, suivre l'exemple utilisé pour matcha pour l'appliquer sur un autre set de thèmes `load_theme gtk-theme icon-theme gnome-shell-theme`
#!/usr/bin/bash
mkdir -p {~/.local,/usr}/share/themes
mkdir -p ~/.themes
THEMES="$(ls ~/.themes) $(ls ~/.local/share/themes) $(ls /usr/share/themes)"
mkdir -p {~/.local,/usr}/share/icons
mkdir -p ~/.icons
ICONS="$(ls ~/.icons) $(ls ~/.local/share/icons) $(ls /usr/share/icons)"
load_theme ()
{
if [[ "$THEMES" != *"$1"* ]]; then
echo "$1 theme not found, quitting"
exit
fi;
if [[ "$THEMES" != *"$3"* ]]; then
echo "$3 theme not found, quitting"
exit
fi;
if [[ "$ICONS" != *"$2"* ]]; then
echo "$2 icon theme not found, quitting"
exit
fi;
gsettings set org.gnome.desktop.interface gtk-theme "$1"
gsettings set org.gnome.desktop.interface icon-theme "$2"
gsettings set org.gnome.desktop.wm.preferences theme "$2"
if [[ "$(gsettings writable org.gnome.shell.extensions.user-theme name)" != "true" ]]; then
echo "User-Theme extensions not found, please install and enable it to have full experience"
exit
fi;
gsettings set org.gnome.shell.extensions.user-theme name "$3"
}
if [[ "$1" == "matcha" ]]; then
echo "switching to Matcha theme"
load_theme "Matcha-dark-azul" "Canta" "Matcha-dark-azul"
exit
fi;
echo "loading default theme"
load_theme "Adwaita" "Adwaita" "Adwaita-maia"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment