Commit 94cf1411 authored by Roman Alifanov's avatar Roman Alifanov

renaming functions and variables (for standardization)

parent 2070a5f6
#!/bin/bash #!/bin/bash
updateKvantumTheme() { update_kv_theme() {
echo "Updating Kvantum theme to $1..." echo "Updating Kvantum theme to $1..."
if [ "$1" == "light" ]; then if [ "$1" == "light" ]; then
kvantummanager --set KvGnome kvantummanager --set KvGnome
...@@ -9,7 +9,7 @@ updateKvantumTheme() { ...@@ -9,7 +9,7 @@ updateKvantumTheme() {
fi fi
} }
updateGTK3Theme() { update_gtk3_theme() {
echo "Updating GTK3 theme to $1..." echo "Updating GTK3 theme to $1..."
if [ "$1" == "light" ]; then if [ "$1" == "light" ]; then
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3' gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
...@@ -19,34 +19,34 @@ updateGTK3Theme() { ...@@ -19,34 +19,34 @@ updateGTK3Theme() {
} }
# Function to check and update the theme # Function to check and update the theme
checkAndUpdateTheme() { check_and_update_themes() {
currentTheme=$(gsettings get org.gnome.desktop.interface color-scheme | awk -F"'" '{print $2}') CURRENT_THEME=$(gsettings get org.gnome.desktop.interface color-scheme | awk -F"'" '{print $2}')
if [ "$currentTheme" == "default" ]; then if [ "$CURRENT_THEME" == "default" ]; then
updateKvantumTheme "light" update_kv_theme "light"
updateGTK3Theme "light" update_gtk3_theme "light"
else else
updateKvantumTheme "dark" update_kv_theme "dark"
updateGTK3Theme "dark" update_gtk3_theme "dark"
fi fi
} }
# Initial check and update # Initial check and update
checkAndUpdateTheme check_and_update_themes
count=0 COUNT=0
dbus-monitor "interface='org.freedesktop.portal.Settings',member=SettingChanged" | \ dbus-monitor "interface='org.freedesktop.portal.Settings',member=SettingChanged" | \
while IFS= read -r line; do while IFS= read -r LINE; do
theme=$(echo "$line" | grep -E -o 'string "(prefer-dark|default)"') THEME=$(echo "$LINE" | grep -E -o 'string "(prefer-dark|default)"')
if [ -n "$theme" ]; then if [ -n "$THEME" ]; then
((count++)) ((COUNT++))
if [ $(($count % 2)) = 0 ]; then if [ $(($COUNT % 2)) = 0 ]; then
echo "$theme" echo "$THEME"
checkAndUpdateTheme check_and_update_themes
count=0 COUNT=0
fi fi
fi fi
done 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