Create separate matugen toggles, add MatugenService

Matugen: add Matugen.qml as central place for templates, add
MatugenService to take care of .toml generation
Notification: possible fix for "children of null"
This commit is contained in:
Ly-sec 2025-08-28 13:27:49 +02:00
parent 85b92d9c6f
commit f510c1922d
10 changed files with 610 additions and 501 deletions

View file

@ -0,0 +1,52 @@
pragma Singleton
import QtQuick
import Quickshell
import qs.Commons
// Central place to define which templates we generate and where they write.
// Users can extend it by dropping additional templates into:
// - Assets/Matugen/templates/
Singleton {
id: root
// Build the base TOML using current settings
function buildConfigToml() {
var lines = []
lines.push("[config]")
// Always include noctalia colors output for the shell
lines.push("[templates.noctalia]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/noctalia.json"')
lines.push('output_path = "' + Settings.configDir + 'colors.json"')
if (Settings.data.matugen.gtk4) {
lines.push("\n[templates.gtk4]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/gtk4.css"')
lines.push('output_path = "~/.config/gtk-4.0/gtk.css"')
}
if (Settings.data.matugen.gtk3) {
lines.push("\n[templates.gtk3]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/gtk3.css"')
lines.push('output_path = "~/.config/gtk-3.0/gtk.css"')
}
if (Settings.data.matugen.qt6) {
lines.push("\n[templates.qt6]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/qtct.conf"')
lines.push('output_path = "~/.config/qt6ct/colors/noctalia.conf"')
}
if (Settings.data.matugen.qt5) {
lines.push("\n[templates.qt5]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/qtct.conf"')
lines.push('output_path = "~/.config/qt5ct/colors/noctalia.conf"')
}
if (Settings.data.matugen.kitty) {
lines.push("\n[templates.kitty]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/kitty.conf"')
lines.push('output_path = "~/.config/kitty/themes/noctalia.conf"')
lines.push("post_hook = 'kitty +kitten themes --reload-in=all noctalia'")
}
return lines.join("\n") + "\n"
}
}

View file

@ -1,6 +0,0 @@
# Base: only write Noctalia colors.json for the shell
[config]
[templates.noctalia]
input_path = "templates/noctalia.json"
output_path = "~/.config/noctalia/colors.json"

View file

@ -1,31 +0,0 @@
# This file configures how matugen generates colors from wallpapers for Noctalia
[config]
[templates.noctalia]
input_path = "templates/noctalia.json"
output_path = "~/.config/noctalia/colors.json"
# GTK 4 (libadwaita) variables override
[templates.gtk4]
input_path = "templates/gtk4.css"
output_path = "~/.config/gtk-4.0/gtk.css"
# GTK 3 named-colors fallback for legacy apps
[templates.gtk3]
input_path = "templates/gtk3.css"
output_path = "~/.config/gtk-3.0/gtk.css"
# Qt6ct color scheme (can also be used by qt5ct in many distros)
[templates.qt6]
input_path = "templates/qtct.conf"
output_path = "~/.config/qt6ct/colors/noctalia.conf"
[templates.qt5]
input_path = "templates/qtct.conf"
output_path = "~/.config/qt5ct/colors/noctalia.conf"
[templates.kitty]
input_path = "templates/kitty.conf"
output_path = "~/.config/kitty/themes/noctalia.conf"
post_hook = 'kitty +kitten themes --reload-in=all noctalia'