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
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() {
# 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
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
1)
# Enable dark panels
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s true
# Use the dark icon pack
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro
# Use the dark icon theme
set_icon_theme zafiro-dark
;;
0)
# Disable dark panels
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s false
# Use the light icon pack
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro-Icons-Light-Black-f
# Use the light icon theme
set_icon_theme zafiro
;;
*) exit ;;
esac
else
# Use the dark icon pack
[ "$Zafiro" = 'True' ] && xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s Zafiro
# Use the dark icon theme
set_icon_theme zafiro-dark
fi
# Change the main theme to the chosen one
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"
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/Violet-Dark.png"!'Violet-Dark':FBTN "set_theme 'Violet-Dark'" \
--field=!"$icons/Blue-Light.png"!'Blue-Light':FBTN "set_theme 'Blue-Light'" \