Added choice of GTK themes (default, light, dark)

This commit is contained in:
2024-11-04 03:12:20 +05:00
parent 8f160515be
commit b97b6623f2
4 changed files with 104 additions and 9 deletions

View File

@ -5619,12 +5619,27 @@ gui_userconf () {
YAD_DPI_VAR="disabled"
fi
if [[ $GUI_THEME == default ]] ; then GUI_THEME=${translations[default]}
elif [[ $GUI_THEME == compact ]] ; then GUI_THEME=${translations[compact]}
elif [[ $GUI_THEME == classic ]] ; then GUI_THEME=${translations[classic]}
fi
if [[ -z $GTK_THEME ]] ; then
YAD_GTK_THEME="${translations[default]}!${translations[light]}!${translations[dark]}"
else
if [[ $GTK_THEME =~ :dark$ ]]
then YAD_GTK_THEME="${translations[dark]}!${translations[light]}!${translations[default]}"
else YAD_GTK_THEME="${translations[light]}!${translations[dark]}!${translations[default]}"
fi
fi
"${pw_yad}" --plug=$KEY_USERCONF_GUI --tabnum="2" --form --columns=1 --separator="@" --homogeneous-row \
--gui-type-text="$PANED_GUI_TYPE_TEXT_DOWN" --gui-type-layout="$PANED_GUI_TYPE_LAYOUT_DOWN" \
--field="${translations[Choose a graphics card to run the game]}!${translations[Select which video card will be used to run the game (used for all running games and programs in PortProton)]} :CB" "$(combobox_fix --disabled "$GPU_VAR" "$GET_GPU_NAMES")" \
--field="${translations[Force dpi for fonts]}!${translations[Here you can set forced dpi for fonts in wine]} :CB" "$(combobox_fix --disabled "$YAD_DPI_VAR" "96 (100%)!120 (125%)!144 (150%)!168 (175%)!192 (200%)!216 (225%)!240 (250%)!264 (275%)!288 (300%)")" \
--field="${translations[Choice wine audio driver]}!${translations[Fixes sound popling if choice alsa]} :CB" "$(combobox_fix --disabled "$SOUND_DRIVER_VAR" "alsa!oss!pulse")" \
--field="${translations[Choice gui themes]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "default!compact!classic")" \
--field="${translations[Select PortProton theme]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "${translations[default]}!${translations[compact]}!${translations[classic]}")" \
--field="${translations[Select gtk theme]}!${translations[Allows you to select a theme for GTK.]} :CB" "$(combobox_fix "$YAD_GTK_THEME")" \
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "enabled")" \
--field="${translations[Sort shortcuts by time]}!${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" "$(combobox_fix --disabled "$SORT_WITH_TIME" "enabled")" \
1> "${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb" 2>/dev/null &
@ -5663,9 +5678,20 @@ gui_userconf () {
PW_WINE_DPI_VALUE="${PW_ADD_SETTINGS_UC[1]}"
PW_SOUND_DRIVER_USE="${PW_ADD_SETTINGS_UC[2]}"
GUI_THEME="${PW_ADD_SETTINGS_UC[3]}"
DESKTOP_WITH_TIME="${PW_ADD_SETTINGS_UC[4]}"
SORT_WITH_TIME="${PW_ADD_SETTINGS_UC[5]}"
edit_user_conf_from_gui PW_GPU_USE PW_WINE_DPI_VALUE PW_SOUND_DRIVER_USE GUI_THEME DESKTOP_WITH_TIME SORT_WITH_TIME
if [[ $GUI_THEME == ${translations[default]} ]] ; then GUI_THEME=default
elif [[ $GUI_THEME == ${translations[compact]} ]] ; then GUI_THEME=compact
elif [[ $GUI_THEME == ${translations[classic]} ]] ; then GUI_THEME=classic
fi
GTK_THEME="${PW_ADD_SETTINGS_UC[4]}"
YAD_GTK_THEME=$(gsettings get org.gnome.desktop.interface gtk-theme)
YAD_GTK_THEME=${YAD_GTK_THEME//\'/}
if [[ $GTK_THEME == ${translations[default]} ]] ; then unset GTK_THEME
elif [[ $GTK_THEME == ${translations[light]} ]] ; then GTK_THEME="$YAD_GTK_THEME:light"
elif [[ $GTK_THEME == ${translations[dark]} ]] ; then GTK_THEME="$YAD_GTK_THEME:dark"
fi
DESKTOP_WITH_TIME="${PW_ADD_SETTINGS_UC[5]}"
SORT_WITH_TIME="${PW_ADD_SETTINGS_UC[6]}"
edit_user_conf_from_gui PW_GPU_USE PW_WINE_DPI_VALUE PW_SOUND_DRIVER_USE GUI_THEME GTK_THEME DESKTOP_WITH_TIME SORT_WITH_TIME
restart_pp
;;
esac