confOS/.config/update_theme.sh
2024-03-26 11:20:36 +01:00

86 lines
3 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 GT_default
GT_default=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
case $1 in
"sunset" ) # Go to dark mode
# Terminal profile
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
visible-name "Dark"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
foreground-color "rgb(211,208,200)"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
background-color "rgb(45,45,45)"
# Fish theme
fish -c "fish_config theme choose 'Base16 Eighties' && \
yes | fish_config theme save"
fish -c "set fish_color_comment 5c6773" # custom comment color
# Micro editor
sed -i "s/bubblegum/monokai/g" "$HOME"/.config/micro/settings.json
# Keyboard backlight
busctl call --system org.freedesktop.UPower \
/org/freedesktop/UPower/KbdBacklight \
org.freedesktop.UPower.KbdBacklight SetBrightness 'i' 1
# Bottom theme
sed -i "s/color = \"default-light\"/#color = \"default\"/g" "$HOME"/.config/bottom/bottom.toml
# Bat theme
sed -i "s/Solarized (light)/Dracula/g" "$HOME"/.config/bat/config
;;
"sunrise" ) # Go to light mode
# Terminal profile
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
visible-name "Light"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
foreground-color "rgb(23,20,33)"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_default}"/ \
background-color "rgb(253,246,227)"
# Fish theme
fish -c "fish_config theme choose 'Solarized Light' && yes | fish_config theme save"
# Micro editor
sed -i "s/monokai/bubblegum/g" "$HOME"/.config/micro/settings.json
# Keyboard backlight
busctl call --system org.freedesktop.UPower \
/org/freedesktop/UPower/KbdBacklight \
org.freedesktop.UPower.KbdBacklight SetBrightness 'i' 0
# Bottom theme
sed -i "s/#color = \"default\"/color = \"default-light\"/g" "$HOME"/.config/bottom/bottom.toml
# Bat theme
sed -i "s/Dracula/Solarized (light)/g" "$HOME"/.config/bat/config
;;
* )
echo "Can't interpret given argument"
;;
esac
fi
}
main "$@"