From 33af5b9ab944b4c98bb64fc1764cff8e7d9f93f5 Mon Sep 17 00:00:00 2001 From: Aiser <2912778691@qq.com> Date: Sun, 23 Nov 2025 15:10:38 +0800 Subject: [PATCH 1/2] Matugen: Add Cava's Theme --- Assets/MatugenTemplates/cava.ini | 16 ++++++++++++++++ Assets/Translations/de.json | 4 ++++ Assets/Translations/en.json | 4 ++++ Assets/Translations/es.json | 4 ++++ Assets/Translations/fr.json | 4 ++++ Assets/Translations/nl.json | 4 ++++ Assets/Translations/pt.json | 4 ++++ Assets/Translations/ru.json | 4 ++++ Assets/Translations/tr.json | 4 ++++ Assets/Translations/uk-UA.json | 4 ++++ Assets/Translations/zh-CN.json | 4 ++++ Commons/Settings.qml | 1 + .../Tabs/ColorScheme/ColorSchemeTab.qml | 18 ++++++++++++++++++ Services/System/ProgramCheckerService.qml | 4 +++- Services/Theming/TemplateRegistry.qml | 12 ++++++++++++ 15 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Assets/MatugenTemplates/cava.ini diff --git a/Assets/MatugenTemplates/cava.ini b/Assets/MatugenTemplates/cava.ini new file mode 100644 index 00000000..909c886f --- /dev/null +++ b/Assets/MatugenTemplates/cava.ini @@ -0,0 +1,16 @@ +[color] +background = '{{colors.surface.default.hex}}' +foreground = '{{colors.primary.default.hex}}' + +gradient = 1 +gradient_color_1 = '{{colors.primary_container.default.hex}}' +gradient_color_2 = '{{colors.primary.default.hex}}' +gradient_color_3 = '{{colors.on_primary_container.default.hex}}' + +horizontal_gradient = 0 +horizontal_gradient_color_1 = '{{colors.primary_container.default.hex}}' +horizontal_gradient_color_2 = '{{colors.primary.default.hex}}' +horizontal_gradient_color_3 = '{{colors.on_primary_container.default.hex}}' +horizontal_gradient_color_4 = '{{colors.primary.default.hex}}' +horizontal_gradient_color_5 = '{{colors.primary_container.default.hex}}' + diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 3dcb1b82..142d0782 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -1062,6 +1062,10 @@ "description": "Schreibe {filepath}.", "description-missing": "Benötigt die Installation von {app}" }, + "cava": { + "description": "Schreibe {filepath}.", + "description-missing": "Benötigt die Installation von {app}" + }, "vicinae": { "description": "Schreibt {filepath} und lädt neu", "description-missing": "Erfordert die Installation von {app}" diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index ef6bd875..ed0c1018 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -1062,6 +1062,10 @@ "description": "Write {filepath}.", "description-missing": "Requires {app} to be installed" }, + "cava": { + "description": "Write {filepath}.", + "description-missing": "Requires {app} to be installed" + }, "vicinae": { "description": "Write {filepath} and reload", "description-missing": "Requires {app} to be installed" diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 13c6d24e..6f02d91f 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -1062,6 +1062,10 @@ "description": "Escribe {filepath}.", "description-missing": "Requiere que {app} esté instalado/a." }, + "cava": { + "description": "Escribe {filepath}.", + "description-missing": "Requiere que {app} esté instalado/a." + }, "vicinae": { "description": "Escribir {filepath} y recargar", "description-missing": "Requiere que {app} esté instalado" diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index 76ca5dac..098c8ab6 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -1062,6 +1062,10 @@ "description": "Écrire {filepath}.", "description-missing": "Nécessite l'installation de {app}" }, + "cava": { + "description": "Écrire {filepath}.", + "description-missing": "Nécessite l'installation de {app}" + }, "vicinae": { "description": "Écrire {filepath} et recharger", "description-missing": "Nécessite que le lanceur {app} soit installé" diff --git a/Assets/Translations/nl.json b/Assets/Translations/nl.json index 8708a07f..fb5fc48b 100644 --- a/Assets/Translations/nl.json +++ b/Assets/Translations/nl.json @@ -1062,6 +1062,10 @@ "description": "Schrijf {filepath}.", "description-missing": "Vereist dat {app} is geïnstalleerd." }, + "cava": { + "description": "Schrijf {filepath}.", + "description-missing": "Vereist dat {app} is geïnstalleerd." + }, "vicinae": { "description": "Schrijf {filepath} en herlaad.", "description-missing": "Vereist dat {app} is geïnstalleerd." diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 48f6ac33..2c79bcdf 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -1062,6 +1062,10 @@ "description": "Escreva em {filepath}.", "description-missing": "Requer que o {app} esteja instalado." }, + "cava": { + "description": "Escreva em {filepath}.", + "description-missing": "Requer que o {app} esteja instalado." + }, "vicinae": { "description": "Escrever {filepath} e recarregar", "description-missing": "Requer que o {app} esteja instalado" diff --git a/Assets/Translations/ru.json b/Assets/Translations/ru.json index 95ce9cff..7507e373 100644 --- a/Assets/Translations/ru.json +++ b/Assets/Translations/ru.json @@ -1062,6 +1062,10 @@ "description": "Записать {filepath}.", "description-missing": "Требуется установка {app}" }, + "cava": { + "description": "Записать {filepath}.", + "description-missing": "Требуется установка {app}" + }, "vicinae": { "description": "Записать {filepath} и перезагрузить", "description-missing": "Требуется установка {app}" diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index 37642508..2bd759b7 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -1062,6 +1062,10 @@ "description": "{filepath} dosyasına yaz.", "description-missing": "Kurulum için {app} gereklidir" }, + "cava": { + "description": "{filepath} dosyasına yaz.", + "description-missing": "Kurulum için {app} gereklidir" + }, "vicinae": { "description": "{filepath} dosyasına yaz ve yeniden yükle", "description-missing": "Kurulum için {app} gereklidir" diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index 3f5c331e..76b0e05b 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -1062,6 +1062,10 @@ "description": "Записати {filepath}.", "description-missing": "Потрібна установка {app}" }, + "cava": { + "description": "Записати {filepath}.", + "description-missing": "Потрібна установка {app}" + }, "vicinae": { "description": "Записати {filepath} та перезавантажити", "description-missing": "Потрібна установка {app}" diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 70030835..ca55f3d5 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -1062,6 +1062,10 @@ "description": "写入 {filepath}。", "description-missing": "需要安装 {app}" }, + "cava": { + "description": "写入 {filepath}。", + "description-missing": "需要安装 {app}" + }, "vicinae": { "description": "写入 {filepath} 并重新加载", "description-missing": "需要安装 {app}" diff --git a/Commons/Settings.qml b/Commons/Settings.qml index ea422a7e..02fe889f 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -508,6 +508,7 @@ Singleton { property bool code: false property bool spicetify: false property bool telegram: false + property bool cava: false property bool enableUserTemplates: false } diff --git a/Modules/Panels/Settings/Tabs/ColorScheme/ColorSchemeTab.qml b/Modules/Panels/Settings/Tabs/ColorScheme/ColorSchemeTab.qml index 1839d5e6..fc92cbb0 100644 --- a/Modules/Panels/Settings/Tabs/ColorScheme/ColorSchemeTab.qml +++ b/Modules/Panels/Settings/Tabs/ColorScheme/ColorSchemeTab.qml @@ -853,6 +853,24 @@ ColumnLayout { } } } + + NCheckbox { + label: "Cava" + description: ProgramCheckerService.cavaAvailable ? I18n.tr("settings.color-scheme.templates.programs.cava.description", { + "filepath": "~/.config/cava/themes/noctalia" + }) : I18n.tr("settings.color-scheme.templates.programs.cava.description-missing", { + "app": "cava" + }) + checked: Settings.data.templates.cava + enabled: ProgramCheckerService.cavaAvailable + opacity: ProgramCheckerService.cavaAvailable ? 1.0 : 0.6 + onToggled: checked => { + if (ProgramCheckerService.cavaAvailable) { + Settings.data.templates.cava = checked; + AppThemeService.generate(); + } + } + } } // Miscellaneous NCollapsible { diff --git a/Services/System/ProgramCheckerService.qml b/Services/System/ProgramCheckerService.qml index a0c9d644..a3d0e701 100644 --- a/Services/System/ProgramCheckerService.qml +++ b/Services/System/ProgramCheckerService.qml @@ -28,6 +28,7 @@ Singleton { property bool gnomeCalendarAvailable: false property bool spicetifyAvailable: false property bool telegramAvailable: false + property bool cavaAvailable: false // Discord client auto-detection property var availableDiscordClients: [] @@ -183,7 +184,8 @@ Singleton { "codeAvailable": ["which", "code"], "gnomeCalendarAvailable": ["which", "gnome-calendar"], "spicetifyAvailable": ["which", "spicetify"], - "telegramAvailable": ["which", "telegram-desktop"] + "telegramAvailable": ["which", "telegram-desktop"], + "cavaAvailable": ["which","cava"] }) // Internal tracking diff --git a/Services/Theming/TemplateRegistry.qml b/Services/Theming/TemplateRegistry.qml index 4322ba44..1f18349d 100644 --- a/Services/Theming/TemplateRegistry.qml +++ b/Services/Theming/TemplateRegistry.qml @@ -208,6 +208,18 @@ Singleton { } ], "postProcess": () => `spicetify -q apply --no-restart` + }, + { + "id": "cava", + "name": "Cava", + "category": "applications", + "input": "cava.ini", + "outputs": [ + { + "path": "~/.config/cava/themes/noctalia" + } + ], + "postProcess": () => `pkill -USR1 cava` } ] From 002df77b78492e52952d69b4298a2f92975b981d Mon Sep 17 00:00:00 2001 From: Aiser <2912778691@qq.com> Date: Mon, 24 Nov 2025 02:23:21 +0800 Subject: [PATCH 2/2] Matugen: Adjust cava's posthook --- Bin/colors-apply.sh | 38 ++++++++++++++++++++++++++- Services/Theming/TemplateRegistry.qml | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Bin/colors-apply.sh b/Bin/colors-apply.sh index 0c4bff32..d6733fc7 100755 --- a/Bin/colors-apply.sh +++ b/Bin/colors-apply.sh @@ -4,7 +4,7 @@ if [ "$#" -ne 1 ]; then # Print usage information to standard error. echo "Error: No application specified." >&2 - echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox}" >&2 + echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox|cava}" >&2 exit 1 fi @@ -200,6 +200,42 @@ pywalfox) pywalfox update ;; +cava) + echo "🎨 Applying 'noctalia' theme to cava..." + CONFIG_FILE="$HOME/.config/cava/config" + + # Check if the config file exists. + if [ -f "$CONFIG_FILE" ]; then + # Check if [color] section exists + if grep -q '^\[color\]' "$CONFIG_FILE"; then + echo "[color] section found, checking theme setting..." + + # Check if theme is already set to noctalia under [color] + if sed -n '/^\[color\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^theme = "noctalia"'; then + echo "Theme already set to noctalia under [color], skipping modification." + else + # Check if theme line exists under [color] section + if sed -n '/^\[color\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^theme = '; then + # Replace existing theme line under [color] + sed -i '/^\[color\]/,/^\[/{s/^theme = .*/theme = "noctalia"/}' "$CONFIG_FILE" + else + # Add theme line after [color] + sed -i '/^\[color\]/a theme = "noctalia"' "$CONFIG_FILE" + fi + fi + else + echo "[color] section not found, adding it with theme..." + # Add [color] section with theme at the end of file + echo "" >>"$CONFIG_FILE" + echo "[color]" >>"$CONFIG_FILE" + echo 'theme = "noctalia"' >>"$CONFIG_FILE" + fi + else + echo "Error: cava config file not found at $CONFIG_FILE" >&2 + exit 1 + fi + ;; + *) # Handle unknown application names. echo "Error: Unknown application '$APP_NAME'." >&2 diff --git a/Services/Theming/TemplateRegistry.qml b/Services/Theming/TemplateRegistry.qml index 1f18349d..a15b3033 100644 --- a/Services/Theming/TemplateRegistry.qml +++ b/Services/Theming/TemplateRegistry.qml @@ -219,7 +219,7 @@ Singleton { "path": "~/.config/cava/themes/noctalia" } ], - "postProcess": () => `pkill -USR1 cava` + "postProcess": () => `${colorsApplyScript} cava` } ]