confOS/.config/update_theme.sh
2023-09-13 14:10:13 +02:00

41 lines
1.2 KiB
Bash
Executable file

#!/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
local profiles
IFS=" " read -r -a profiles <<< "$(gsettings get org.gnome.Terminal.ProfilesList list | tr -d "\'[],")"
case $1 in
"sunset" ) # Go to dark mode
# Set the Dracula theme
set org.gnome.desktop.wm.preferences theme Dracula
# Set the Terminal profile
gsettings set org.gnome.Terminal.ProfilesList default "${profiles[0]}"
# Set the fish theme
fish -c "fish_config theme choose 'Base16 Eighties' && yes | fish_config theme save"
;;
"sunrise" ) # Go to light mode
# Set the Terminal profile
gsettings set org.gnome.Terminal.ProfilesList default "${profiles[1]}"
# Set the fish theme
fish -c "fish_config theme choose 'Solarized Light' && yes | fish_config theme save"
;;
* )
echo "Can't interpret given argument" ;;
esac
fi
}
main "$@"