mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-18 00:16:10 +01:00
feat: new theming
This commit is contained in:
89
.local/bin/dark
Executable file
89
.local/bin/dark
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set theme environment variable
|
||||
export THEME="dark"
|
||||
|
||||
# Update GTK theme using gsettings (more reliable)
|
||||
if command -v gsettings >/dev/null 2>&1; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Rosepine-Dark"
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark"
|
||||
fi
|
||||
|
||||
# Update GTK configuration files directly
|
||||
mkdir -p "$HOME/.config/gtk-3.0" "$HOME/.config/gtk-4.0"
|
||||
|
||||
# GTK 3 settings
|
||||
cat > "$HOME/.config/gtk-3.0/settings.ini" << EOF
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=true
|
||||
gtk-theme-name=Rosepine-Dark
|
||||
gtk-icon-theme-name=Papirus-Dark
|
||||
EOF
|
||||
|
||||
# GTK 4 settings
|
||||
cat > "$HOME/.config/gtk-4.0/settings.ini" << EOF
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=true
|
||||
gtk-theme-name=Rosepine-Dark
|
||||
gtk-icon-theme-name=Papirus-Dark
|
||||
EOF
|
||||
|
||||
# GTK 2 settings
|
||||
cat > "$HOME/.gtkrc-2.0" << EOF
|
||||
gtk-theme-name="Rosepine-Dark"
|
||||
gtk-icon-theme-name="Papirus-Dark"
|
||||
EOF
|
||||
|
||||
# Update Qt6 theme using qt6ct
|
||||
if command -v qt6ct >/dev/null 2>&1; then
|
||||
export QT_QPA_PLATFORMTHEME=qt6ct
|
||||
mkdir -p "$HOME/.config/qt6ct"
|
||||
if [ -f "$HOME/.config/qt6ct/qt6ct.conf" ]; then
|
||||
sed -i 's/^style=.*/style=rose-pine/' "$HOME/.config/qt6ct/qt6ct.conf"
|
||||
sed -i 's/^color_scheme=.*/color_scheme=rose-pine/' "$HOME/.config/qt6ct/qt6ct.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update Qt5 theme using qt5ct
|
||||
if command -v qt5ct >/dev/null 2>&1; then
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
mkdir -p "$HOME/.config/qt5ct"
|
||||
if [ -f "$HOME/.config/qt5ct/qt5ct.conf" ]; then
|
||||
sed -i 's/^style=.*/style=rose-pine/' "$HOME/.config/qt5ct/qt5ct.conf"
|
||||
sed -i 's/^color_scheme=.*/color_scheme=rose-pine/' "$HOME/.config/qt5ct/qt5ct.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update Rofi theme
|
||||
if [ -f "$HOME/.config/rofi/config.rasi" ]; then
|
||||
sed -i 's/@theme ".*"/@theme "rose-pine"/' "$HOME/.config/rofi/config.rasi"
|
||||
elif [ -f "$HOME/.config/rofi/config" ]; then
|
||||
sed -i 's/rofi.theme:.*/rofi.theme: rose-pine/' "$HOME/.config/rofi/config"
|
||||
fi
|
||||
|
||||
# Update Wezterm theme
|
||||
if [ -f "$HOME/.config/wezterm/wezterm.lua" ]; then
|
||||
sed -i 's/config.color_scheme = .*/config.color_scheme = "rose-pine"/' "$HOME/.config/wezterm/wezterm.lua"
|
||||
elif [ -f "$HOME/.wezterm.lua" ]; then
|
||||
sed -i 's/config.color_scheme = .*/config.color_scheme = "rose-pine"/' "$HOME/.wezterm.lua"
|
||||
fi
|
||||
|
||||
# Set environment variables for current session
|
||||
export GTK_THEME="Rosepine-Dark:dark"
|
||||
|
||||
# Reload applications that support theme changes
|
||||
pkill -USR1 wezterm >/dev/null 2>&1 || true
|
||||
|
||||
# Try to reload GTK applications via xsettingsd if available
|
||||
if command -v xsettingsd >/dev/null 2>&1; then
|
||||
pkill -HUP xsettingsd >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Restart GTK settings daemon if using GNOME
|
||||
if pgrep -x "gnome-session" >/dev/null; then
|
||||
dbus-send --session --type=method_call --dest=org.gnome.SettingsDaemon.Color /org/gnome/SettingsDaemon/Color org.gnome.SettingsDaemon.Color.ApplySettings >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Notify about theme change
|
||||
echo "Switched to Rose Pine (dark) theme"
|
||||
90
.local/bin/light
Executable file
90
.local/bin/light
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set theme environment variable
|
||||
export THEME="light"
|
||||
|
||||
# Update GTK theme using gsettings (more reliable)
|
||||
if command -v gsettings >/dev/null 2>&1; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Rosepine-Light"
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-light"
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Papirus-Light"
|
||||
fi
|
||||
|
||||
# Update GTK configuration files directly
|
||||
mkdir -p "$HOME/.config/gtk-3.0" "$HOME/.config/gtk-4.0"
|
||||
|
||||
# GTK 3 settings
|
||||
cat > "$HOME/.config/gtk-3.0/settings.ini" << EOF
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=false
|
||||
gtk-theme-name=Rosepine-Light
|
||||
gtk-icon-theme-name=Papirus-Light
|
||||
EOF
|
||||
|
||||
# GTK 4 settings
|
||||
cat > "$HOME/.config/gtk-4.0/settings.ini" << EOF
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=false
|
||||
gtk-theme-name=Rosepine-Light
|
||||
gtk-icon-theme-name=Papirus-Light
|
||||
EOF
|
||||
|
||||
# GTK 2 settings
|
||||
cat > "$HOME/.gtkrc-2.0" << EOF
|
||||
gtk-theme-name="Rosepine-Light"
|
||||
gtk-icon-theme-name="Papirus-Light"
|
||||
EOF
|
||||
|
||||
# Update Qt6 theme using qt6ct
|
||||
if command -v qt6ct >/dev/null 2>&1; then
|
||||
export QT_QPA_PLATFORMTHEME=qt6ct
|
||||
mkdir -p "$HOME/.config/qt6ct"
|
||||
if [ -f "$HOME/.config/qt6ct/qt6ct.conf" ]; then
|
||||
sed -i 's/^style=.*/style=rose-pine-dawn/' "$HOME/.config/qt6ct/qt6ct.conf"
|
||||
sed -i 's/^color_scheme=.*/color_scheme=rose-pine-dawn/' "$HOME/.config/qt6ct/qt6ct.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update Qt5 theme using qt5ct
|
||||
if command -v qt5ct >/dev/null 2>&1; then
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
mkdir -p "$HOME/.config/qt5ct"
|
||||
if [ -f "$HOME/.config/qt5ct/qt5ct.conf" ]; then
|
||||
sed -i 's/^style=.*/style=rose-pine-dawn/' "$HOME/.config/qt5ct/qt5ct.conf"
|
||||
sed -i 's/^color_scheme=.*/color_scheme=rose-pine-dawn/' "$HOME/.config/qt5ct/qt5ct.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update Rofi theme
|
||||
if [ -f "$HOME/.config/rofi/config.rasi" ]; then
|
||||
sed -i 's/@theme ".*"/@theme "rose-pine-dawn"/' "$HOME/.config/rofi/config.rasi"
|
||||
elif [ -f "$HOME/.config/rofi/config" ]; then
|
||||
sed -i 's/rofi.theme:.*/rofi.theme: rose-pine-dawn/' "$HOME/.config/rofi/config"
|
||||
fi
|
||||
|
||||
# Update Wezterm theme
|
||||
if [ -f "$HOME/.config/wezterm/wezterm.lua" ]; then
|
||||
sed -i 's/config.color_scheme = .*/config.color_scheme = "rose-pine-dawn"/' "$HOME/.config/wezterm/wezterm.lua"
|
||||
elif [ -f "$HOME/.wezterm.lua" ]; then
|
||||
sed -i 's/config.color_scheme = .*/config.color_scheme = "rose-pine-dawn"/' "$HOME/.wezterm.lua"
|
||||
fi
|
||||
|
||||
# Set environment variables for current session
|
||||
export GTK_THEME=""
|
||||
unset GTK_THEME # Unset to use theme from config files
|
||||
|
||||
# Reload applications that support theme changes
|
||||
pkill -USR1 wezterm >/dev/null 2>&1 || true
|
||||
|
||||
# Try to reload GTK applications via xsettingsd if available
|
||||
if command -v xsettingsd >/dev/null 2>&1; then
|
||||
pkill -HUP xsettingsd >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Restart GTK settings daemon if using GNOME
|
||||
if pgrep -x "gnome-session" >/dev/null; then
|
||||
dbus-send --session --type=method_call --dest=org.gnome.SettingsDaemon.Color /org/gnome/SettingsDaemon/Color org.gnome.SettingsDaemon.Color.ApplySettings >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Notify about theme change
|
||||
echo "Switched to Rose Pine Dawn (light) theme"
|
||||
Reference in New Issue
Block a user