From 00ba181522f5817df9b1011886993911d844b2f5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 13 Sep 2023 13:28:57 +0200 Subject: [PATCH] Add a script who perform all the things to do when we're changing theme --- .config/update_theme.sh | 31 +++++++++++++++++++++++++++++++ Makefile | 3 +++ arch.sh | 3 ++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 .config/update_theme.sh diff --git a/.config/update_theme.sh b/.config/update_theme.sh new file mode 100755 index 0000000..9a084ee --- /dev/null +++ b/.config/update_theme.sh @@ -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 "$@" diff --git a/Makefile b/Makefile index 331e517..bbd422e 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,9 @@ sync-dotfiles: # Arch distro specific sync-arch: +# .config + @$(WGET) $(REPO_SRC)/.config/update_theme.sh -O $(HOME)/.config/update_theme.sh + # 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 diff --git a/arch.sh b/arch.sh index 9ded162..9c04a1b 100644 --- a/arch.sh +++ b/arch.sh @@ -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.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.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 sed -i "s/inode\/directory=nautilus.desktop/inode\/directory=org.gnome.Nautilus.desktop/g" "$HOME"/.config/mimeapps.list