Merge branch 'main' of github.com:noctalia-dev/noctalia-shell
This commit is contained in:
commit
e3d62388f7
4 changed files with 37 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ import qs.Commons
|
||||||
// Central place to define which templates we generate and where they write.
|
// Central place to define which templates we generate and where they write.
|
||||||
// Users can extend it by dropping additional templates into:
|
// Users can extend it by dropping additional templates into:
|
||||||
// - Assets/Matugen/templates/
|
// - Assets/Matugen/templates/
|
||||||
|
// - ~/.config/matugen/ (when enableUserTemplates is true)
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,7 @@ Singleton {
|
||||||
property bool foot: false
|
property bool foot: false
|
||||||
property bool fuzzel: false
|
property bool fuzzel: false
|
||||||
property bool vesktop: false
|
property bool vesktop: false
|
||||||
|
property bool enableUserTemplates: false
|
||||||
}
|
}
|
||||||
|
|
||||||
// night light
|
// night light
|
||||||
|
|
|
||||||
|
|
@ -466,5 +466,22 @@ ColumnLayout {
|
||||||
MatugenService.generateFromWallpaper()
|
MatugenService.generateFromWallpaper()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NDivider {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: Style.marginM * scaling
|
||||||
|
Layout.bottomMargin: Style.marginM * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
NCheckbox {
|
||||||
|
label: "User Templates"
|
||||||
|
description: "Enable user-defined Matugen config from ~/.config/matugen/config.toml"
|
||||||
|
checked: Settings.data.matugen.enableUserTemplates
|
||||||
|
onToggled: checked => {
|
||||||
|
Settings.data.matugen.enableUserTemplates = checked
|
||||||
|
if (Settings.data.colorSchemes.useWallpaperColors)
|
||||||
|
MatugenService.generateFromWallpaper()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,22 @@ Singleton {
|
||||||
var pathEsc = dynamicConfigPath.replace(/'/g, "'\\''")
|
var pathEsc = dynamicConfigPath.replace(/'/g, "'\\''")
|
||||||
var extraRepo = (Quickshell.shellDir + "/Assets/Matugen/extra").replace(/'/g, "'\\''")
|
var extraRepo = (Quickshell.shellDir + "/Assets/Matugen/extra").replace(/'/g, "'\\''")
|
||||||
var extraUser = (Settings.configDir + "matugen.d").replace(/'/g, "'\\''")
|
var extraUser = (Settings.configDir + "matugen.d").replace(/'/g, "'\\''")
|
||||||
|
|
||||||
|
// Build the main script
|
||||||
var script = "cat > '" + pathEsc + "' << 'EOF'\n" + content + "EOF\n" + "for d in '" + extraRepo + "' '" + extraUser
|
var script = "cat > '" + pathEsc + "' << 'EOF'\n" + content + "EOF\n" + "for d in '" + extraRepo + "' '" + extraUser
|
||||||
+ "'; do\n" + " if [ -d \"$d\" ]; then\n"
|
+ "'; do\n" + " if [ -d \"$d\" ]; then\n"
|
||||||
+ " for f in \"$d\"/*.toml; do\n" + " [ -f \"$f\" ] && { echo; echo \"# extra: $f\"; cat \"$f\"; } >> '"
|
+ " for f in \"$d\"/*.toml; do\n" + " [ -f \"$f\" ] && { echo; echo \"# extra: $f\"; cat \"$f\"; } >> '"
|
||||||
+ pathEsc + "'\n" + " done\n" + " fi\n" + "done\n" + "matugen image '" + wp + "' --config '" + pathEsc + "' --mode " + mode
|
+ pathEsc + "'\n" + " done\n" + " fi\n" + "done\n" + "matugen image '" + wp + "' --config '" + pathEsc + "' --mode " + mode
|
||||||
|
|
||||||
|
// Add user config execution if enabled
|
||||||
|
if (Settings.data.matugen.enableUserTemplates) {
|
||||||
|
var userConfigDir = (Quickshell.env("HOME") + "/.config/matugen/").replace(/'/g, "'\\''")
|
||||||
|
script += "\n# Execute user config if it exists\nif [ -f '" + userConfigDir + "config.toml' ]; then\n"
|
||||||
|
script += " matugen image '" + wp + "' --config '" + userConfigDir + "config.toml' --mode " + mode + "\n"
|
||||||
|
script += "fi"
|
||||||
|
}
|
||||||
|
|
||||||
|
script += "\n"
|
||||||
generateProcess.command = ["bash", "-lc", script]
|
generateProcess.command = ["bash", "-lc", script]
|
||||||
generateProcess.running = true
|
generateProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
@ -53,12 +65,13 @@ Singleton {
|
||||||
id: generateProcess
|
id: generateProcess
|
||||||
workingDirectory: Quickshell.shellDir
|
workingDirectory: Quickshell.shellDir
|
||||||
running: false
|
running: false
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: Logger.log("Matugen", "Completed colors generation")
|
|
||||||
}
|
|
||||||
stderr: StdioCollector {
|
stderr: StdioCollector {
|
||||||
onStreamFinished: if (this.text !== "")
|
onStreamFinished: {
|
||||||
Logger.error(this.text)
|
if (this.text !== "") {
|
||||||
|
Logger.warn("MatugenService", "Matugen stderr:", this.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue