Commit e4567c33 authored by Roman Alifanov's avatar Roman Alifanov

Initial commit

parents
#!/bin/bash
updateKvantumTheme() {
echo "Updating Kvantum theme to $1..."
if [ "$1" == "light" ]; then
kvantummanager --set KvGnome
elif [ "$1" == "dark" ]; then
kvantummanager --set KvGnomeDark
fi
}
updateGTK3Theme() {
echo "Updating GTK3 theme to $1..."
if [ "$1" == "light" ]; then
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
elif [ "$1" == "dark" ]; then
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark'
fi
}
# Function to check and update the theme
checkAndUpdateTheme() {
currentTheme=$(gsettings get org.gnome.desktop.interface color-scheme | awk -F"'" '{print $2}')
if [ "$currentTheme" == "default" ]; then
updateKvantumTheme "light"
updateGTK3Theme "light"
else
updateKvantumTheme "dark"
updateGTK3Theme "dark"
fi
}
# Initial check and update
checkAndUpdateTheme
count=0
dbus-monitor "interface='org.freedesktop.portal.Settings',member=SettingChanged" | \
while IFS= read -r line; do
theme=$(echo "$line" | grep -E -o 'string "(prefer-dark|default)"')
if [ -n "$theme" ]; then
((count++))
if [ $(($count % 2)) = 0 ]; then
echo "$theme"
checkAndUpdateTheme
count=0
fi
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment