Add a script who perform all the things to do when we're changing theme

This commit is contained in:
Mylloon 2023-09-13 13:28:57 +02:00
parent afaec0c5d6
commit 00ba181522
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 36 additions and 1 deletions

31
.config/update_theme.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -o errexit # crash the script when a command crash
set -o pipefail # same as above for piped command
set -o nounset # crash when a variable doesnt exist
# TRACE=1 for debug
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
cd "$(dirname "$0")" # change script directory
main() {
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else
case $1 in
"sunset" ) # Go to dark mode
set org.gnome.desktop.wm.preferences theme Dracula
;;
"sunrise" ) # Go to light mode
echo "Nothing to do"
;;
* )
echo "Can't interpret given argument" ;;
esac
fi
}
main "$@"

View file

@ -88,6 +88,9 @@ sync-dotfiles:
# Arch distro specific # Arch distro specific
sync-arch: sync-arch:
# .config
@$(WGET) $(REPO_SRC)/.config/update_theme.sh -O $(HOME)/.config/update_theme.sh
# Fish # Fish
@$(WGET) $(REPO_SRC)/.config/fish/config_arch.fish -O $(HOME)/.config/fish/config.fish @$(WGET) $(REPO_SRC)/.config/fish/config_arch.fish -O $(HOME)/.config/fish/config.fish
@$(WGET) $(REPO_SRC)/.config/fish/conf.d/abbr.fish -O $(HOME)/.config/fish/conf.d/abbr.fish @$(WGET) $(REPO_SRC)/.config/fish/conf.d/abbr.fish -O $(HOME)/.config/fish/conf.d/abbr.fish

View file

@ -274,7 +274,8 @@ main() {
gsettings set org.gnome.desktop.peripherals.touchpad click-method areas # right click on laptop gsettings set org.gnome.desktop.peripherals.touchpad click-method areas # right click on laptop
gsettings set org.gnome.desktop.peripherals.mouse speed -0.6 # mouse speed gsettings set org.gnome.desktop.peripherals.mouse speed -0.6 # mouse speed
gsettings --schemadir /usr/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.gtk-variants enabled true # enable GTK theme to change gsettings --schemadir /usr/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.gtk-variants enabled true # enable GTK theme to change
gsettings --schemadir /usr/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.commands sunset "set org.gnome.desktop.wm.preferences theme Dracula" # change gtk theme to dark at sunset gsettings --schemadir /usr/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.commands sunset "bash $HOME/.config/update_theme.sh sunset" # run script for the sunset
gsettings --schemadir /usr/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.commands sunrise "bash $HOME/.config/update_theme.sh sunrise" # run script for the sunrise
# Default app Nautilus # Default app Nautilus
sed -i "s/inode\/directory=nautilus.desktop/inode\/directory=org.gnome.Nautilus.desktop/g" "$HOME"/.config/mimeapps.list sed -i "s/inode\/directory=nautilus.desktop/inode\/directory=org.gnome.Nautilus.desktop/g" "$HOME"/.config/mimeapps.list