Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure icon and mouse themes are also applied for GTK-3 and GTK-4, ensure Qt and Qt icon themes update #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions xfce4-night-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ function set_theme()
then
gsettings set org.gnome.desktop.interface gtk-theme "$target_theme"
fi
if [ "$2" = "/Net/IconThemeName" ]
then
gsettings set org.gnome.desktop.interface icon-theme "$target_theme"
fi
if [ "$2" = "/Gtk/CursorThemeName" ]
then
gsettings set org.gnome.desktop.interface cursor-theme "$target_theme"
fi
}

function get_config()
Expand Down Expand Up @@ -152,6 +160,35 @@ set_theme 'xsettings' '/Gtk/CursorThemeName' "CURSOR_$suffix"
# Window manager theme
set_theme 'xfwm4' '/general/theme' "WM_$suffix"

# apply settings to QT theme (using Kvantum Manager and qt5ct/qt6ct configs)
if type kvantummanager > /dev/null 2>&1; then
# gtk theme applied at the moment
gtk_theme=$(gsettings get org.gnome.desktop.interface gtk-theme)
# no Arc-Lighter (only KvArc) for Kvantum Manager, so apply filter
filter="Lighter"
# remove "-"" and "'" since themes are named like KvArc, KvArcDark, KvAdapta
qt_theme=$(echo "$gtk_theme" | tr -d "-" | tr -d "'" | sed "s/$filter//g")
# apply theme
kvantummanager --set Kv"$qt_theme"

# gtk icon theme applied at the moment, also filter out single quotes
icon_theme=$(gsettings get org.gnome.desktop.interface icon-theme | tr -d "'")
# qt5ct and qt6ct config file paths
qt5ct_conf="$HOME/.config/qt5ct/qt5ct.conf"
qt6ct_conf="$HOME/.config/qt6ct/qt6ct.conf"
# parameter to look for on config files (no CLI at the moment)
param="icon_theme="
# parameter replacement
replacement="icon_theme=$icon_theme"
# change QT icon theme (if qt5ct and qt6ct config files exist)
if [ -e "$qt5ct_conf" ]; then
sed -i "/$param/c\\$replacement" "$qt5ct_conf"
fi
if [ -e "$qt6ct_conf" ]; then
sed -i "/$param/c\\$replacement" "$qt6ct_conf"
fi
fi

set_config 'active' 'string' "$mode"

# Execute user script to change wallpaper, terminal theme, etc.
Expand Down