Hot-reload terminal theme

This commit is contained in:
Mylloon 2023-09-13 14:22:11 +02:00
parent 21ed5b5de5
commit 6df2a46612
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 14 additions and 15 deletions

View file

@ -15,20 +15,24 @@ 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 "\'[],")"
local GT_default
GT_default=$(gsettings get org.gnome.Terminal.ProfilesList default | 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]}"
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)"
# 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]}"
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)"
# Set the fish theme
fish -c "fish_config theme choose 'Solarized Light' && yes | fish_config theme save"
;;

17
arch.sh
View file

@ -96,11 +96,12 @@ main() {
wget -q https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/alias.fish -O "$HOME"/.config/fish/conf.d/alias.fish
# Themes in Gnome Terminal, the default one will be the dark one
local GT_default GT_light
local GT_default GT_profile2
GT_default=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
GT_light=$(uuidgen)
gsettings set org.gnome.Terminal.ProfilesList list "['${GT_default}', '${GT_light}']"
GT_profiles=("${GT_default}" "${GT_light}")
GT_profile2=$(uuidgen)
gsettings set org.gnome.Terminal.ProfilesList list "['${GT_default}', '${GT_profile2}']"
GT_profiles=("${GT_default}" "${GT_profile2}")
wget -q https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/update_theme.sh -P "$HOME"/.config/
for profile in "${GT_profiles[@]}"
do
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${profile}"/ use-custom-command true
@ -114,13 +115,7 @@ main() {
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${profile}"/ font "MesloLGM Nerd Font 12"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${profile}"/ use-system-font false
done
# Dark theme
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)"
# Light theme
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_light}"/ visible-name 'Light'
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:"${GT_light}"/ background-color "rgb(253,246,227)"
bash "$HOME"/.config/update_theme.sh sunset
# Keybinds
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ close-tab "<Control>w"