From 96d17f8fcb3713caa06ed7e45fe25de027f647d5 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 16 Jun 2025 22:46:14 +0200 Subject: [PATCH] material palette: apply to kde material you colors --- .config/matugen/config.toml | 14 -------- .../kde/kde-material-you-colors-wrapper.sh | 34 ++++++++++++++++++- .../quickshell/scripts/colors/applycolor.sh | 6 ---- .../quickshell/scripts/colors/switchwall.sh | 16 +++++++++ 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.config/matugen/config.toml b/.config/matugen/config.toml index 66c17a37e..a7330d496 100644 --- a/.config/matugen/config.toml +++ b/.config/matugen/config.toml @@ -25,23 +25,9 @@ output_path = '~/.config/gtk-3.0/gtk.css' input_path = '~/.config/matugen/templates/gtk/gtk-colors.css' output_path = '~/.config/gtk-4.0/gtk.css' -[templates.ags_source_view] -input_path = '~/.config/matugen/templates/ags/sourceviewtheme.xml' -output_path = '~/.config/ags/assets/themes/sourceviewtheme.xml' - -[templates.ags_source_view_light] -input_path = '~/.config/matugen/templates/ags/sourceviewtheme-light.xml' -output_path = '~/.config/ags/assets/themes/sourceviewtheme-light.xml' - -[templates.ags_scss] -input_path = '~/.config/matugen/templates/ags/_material.scss' -output_path = '~/.local/state/ags/scss/_material.scss' -post_hook = 'pidof gjs && agsv1 run-js "handleStyles(false)"' - [templates.kde_colors] input_path = '~/.config/matugen/templates/kde/color.txt' output_path = '~/.local/state/quickshell/user/generated/color.txt' -post_hook = '~/.config/matugen/templates/kde/kde-material-you-colors-wrapper.sh' [templates.wallpaper] input_path = '~/.config/matugen/templates/wallpaper.txt' diff --git a/.config/matugen/templates/kde/kde-material-you-colors-wrapper.sh b/.config/matugen/templates/kde/kde-material-you-colors-wrapper.sh index 02856d603..7d5f1146d 100755 --- a/.config/matugen/templates/kde/kde-material-you-colors-wrapper.sh +++ b/.config/matugen/templates/kde/kde-material-you-colors-wrapper.sh @@ -11,4 +11,36 @@ else mode_flag="-l" fi -kde-material-you-colors "$mode_flag" --color "$color" +# Parse --scheme-variant flag +scheme_variant_str="" +while [[ $# -gt 0 ]]; do + case "$1" in + --scheme-variant) + scheme_variant_str="$2" + shift 2 + ;; + *) + shift + ;; + esac +done + +# Map string variant to integer +case "$scheme_variant_str" in + scheme-content) sv_num=0 ;; + scheme-expressive) sv_num=1 ;; + scheme-fidelity) sv_num=2 ;; + scheme-monochrome) sv_num=3 ;; + scheme-neutral) sv_num=4 ;; + scheme-tonal-spot) sv_num=5 ;; + scheme-vibrant) sv_num=6 ;; + scheme-rainbow) sv_num=7 ;; + scheme-fruit-salad) sv_num=8 ;; + "") sv_num=5 ;; + *) + echo "Unknown scheme variant: $scheme_variant_str" >&2 + exit 1 + ;; +esac + +kde-material-you-colors "$mode_flag" --color "$color" -sv "$sv_num" diff --git a/.config/quickshell/scripts/colors/applycolor.sh b/.config/quickshell/scripts/colors/applycolor.sh index ab30ca223..b36fc4d25 100755 --- a/.config/quickshell/scripts/colors/applycolor.sh +++ b/.config/quickshell/scripts/colors/applycolor.sh @@ -56,11 +56,5 @@ apply_qt() { python "$CONFIG_DIR/scripts/kvantum/changeAdwColors.py" # apply config colors } -apply_ags() { - pidof agsv1 && agsv1 run-js "handleStyles(false);" - pidof agsv1 && agsv1 run-js 'openColorScheme.value = true; Utils.timeout(2000, () => openColorScheme.value = false);' -} - -apply_ags & apply_qt & apply_term & diff --git a/.config/quickshell/scripts/colors/switchwall.sh b/.config/quickshell/scripts/colors/switchwall.sh index 6918e5af0..9b2892031 100755 --- a/.config/quickshell/scripts/colors/switchwall.sh +++ b/.config/quickshell/scripts/colors/switchwall.sh @@ -10,6 +10,20 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" MATUGEN_DIR="$XDG_CONFIG_HOME/matugen" terminalscheme="$XDG_CONFIG_HOME/quickshell/scripts/terminal/scheme-base.json" +handle_kde_material_you_colors() { + # Map $type_flag to allowed scheme variants for kde-material-you-colors-wrapper.sh + local kde_scheme_variant="" + case "$type_flag" in + scheme-content|scheme-expressive|scheme-fidelity|scheme-fruit-salad|scheme-monochrome|scheme-neutral|scheme-rainbow|scheme-tonal-spot) + kde_scheme_variant="$type_flag" + ;; + *) + kde_scheme_variant="scheme-tonal-spot" # default + ;; + esac + "$XDG_CONFIG_HOME"/matugen/templates/kde/kde-material-you-colors-wrapper.sh --scheme-variant "$kde_scheme_variant" +} + pre_process() { local mode_flag="$1" # Set GNOME color-scheme if mode_flag is dark or light @@ -31,6 +45,8 @@ post_process() { local screen_height="$2" local wallpaper_path="$3" + handle_kde_material_you_colors & + # Determine the largest region on the wallpaper that's sufficiently un-busy to put widgets in if [ ! -f "$MATUGEN_DIR/scripts/least_busy_region.py" ]; then echo "Error: least_busy_region.py script not found in $MATUGEN_DIR/scripts/"