New script

This commit is contained in:
Tio TROM 2022-09-14 17:14:04 +02:00
parent 1eefef0667
commit 89923ccc9e

View File

@ -1,31 +1,34 @@
#!/bin/bash #!/bin/bash
icons=/usr/share/theme-switcher/icons icons=/usr/share/tromjaro-theme-switcher/icons
set_icon_theme() {
# Change icon theme in XFCE
xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s "$1"
# Change icon theme in qt5ct configuration
sed -i "s/^icon_theme=.*$/icon_theme=$1/" "$HOME"/.config/qt5ct/qt5ct.conf
}
set_theme() { set_theme() {
# Check for Zafiro icon pack, icon packs won't be changed if Zafiro is not in use
current_icon_theme=$(xfconf-query -c xsettings -p /Net/IconThemeName)
[ "${current_icon_theme%-Icons-Light-Black-f}" = 'Zafiro' ] && Zafiro='True'
if [ "${1##*-}" = 'Light' ]; then if [ "${1##*-}" = 'Light' ]; then
yad --image "dialog-question" --title '' --button='DARK':1 --button='LIGHT':0 --text 'Select the panels theme:' yad --image "dialog-question" --title '' --buttons-layout=center --text-align=center --button='DARK':1 --button='LIGHT':0 --text "Select the panels theme\n\nNote: dark panels may result in light icons over a light theme"
case $? in case $? in
1) 1)
# Enable dark panels # Enable dark panels
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s true xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s true
# Use the dark icon pack # Use the dark icon theme
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro set_icon_theme zafiro-dark
;; ;;
0) 0)
# Disable dark panels # Disable dark panels
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s false xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s false
# Use the light icon pack # Use the light icon theme
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro-Icons-Light-Black-f set_icon_theme zafiro
;; ;;
*) exit ;; *) exit ;;
esac esac
else else
# Use the dark icon pack # Use the dark icon theme
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro set_icon_theme zafiro-dark
fi fi
# Change the main theme to the chosen one # Change the main theme to the chosen one
xfconf-query -c xsettings -p /Net/ThemeName -n -t string -s "Skeuos-$1" xfconf-query -c xsettings -p /Net/ThemeName -n -t string -s "Skeuos-$1"
@ -33,9 +36,10 @@ set_theme() {
gsettings set org.gnome.desktop.interface gtk-theme "Skeuos-$1" gsettings set org.gnome.desktop.interface gtk-theme "Skeuos-$1"
notify-send "Skeuos-$1 theme was enabled" notify-send "Skeuos-$1 theme was enabled"
} }
export -f set_theme
yad --no-buttons --center --keep-icon-size --use-interp --title 'Theme Switcher' --text-align=center --text "A Theme Switcher for TROMjaro's default theme-set (Skeuos)" --form --columns 5 \ export -f set_icon_theme set_theme
yad --no-buttons --center --keep-icon-size --use-interp --title 'TROMjaro Theme Switcher' --text-align=center --text "A Theme Switcher for TROMjaro's default theme-set (Skeuos) and icon-set (Zafiro)." --form --columns 5 \
--field=!"$icons/Blue-Dark.png"!'Blue-Dark':FBTN "set_theme 'Blue-Dark'" \ --field=!"$icons/Blue-Dark.png"!'Blue-Dark':FBTN "set_theme 'Blue-Dark'" \
--field=!"$icons/Violet-Dark.png"!'Violet-Dark':FBTN "set_theme 'Violet-Dark'" \ --field=!"$icons/Violet-Dark.png"!'Violet-Dark':FBTN "set_theme 'Violet-Dark'" \
--field=!"$icons/Blue-Light.png"!'Blue-Light':FBTN "set_theme 'Blue-Light'" \ --field=!"$icons/Blue-Light.png"!'Blue-Light':FBTN "set_theme 'Blue-Light'" \