Revert "Background: revert to old version which fixed the RAM issue"

This reverts commit b391d03967.
This commit is contained in:
Ly-sec
2025-10-03 14:49:31 +02:00
parent b391d03967
commit d2a5150f10
5 changed files with 91 additions and 126 deletions
+69 -69
View File
@@ -9,76 +9,76 @@ import qs.Commons
// - Assets/Matugen/templates/
// - ~/.config/matugen/ (when enableUserTemplates is true)
Singleton {
id: root
id: root
// Build the base TOML using current settings
function buildConfigToml() {
var lines = []
lines.push("[config]")
var mode = Settings.data.colorSchemes.darkMode ? "dark" : "light"
// 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"')
// Build the base TOML using current settings
function buildConfigToml() {
var lines = [];
lines.push("[config]");
var mode = Settings.data.colorSchemes.darkMode ? "dark" : "light";
// 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"')
lines.push("post_hook = 'gsettings set org.gnome.desktop.interface color-scheme prefer-" + mode + "'")
}
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"')
lines.push("post_hook = 'gsettings set org.gnome.desktop.interface color-scheme prefer-" + mode + "'")
}
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'")
}
if (Settings.data.matugen.ghostty) {
lines.push("\n[templates.ghostty]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/ghostty.conf"')
lines.push('output_path = "~/.config/ghostty/themes/noctalia"')
lines.push("post_hook = \"grep -q '^theme *= *' ~/.config/ghostty/config; and sed -i 's/^theme *= *.*/theme = noctalia/' ~/.config/ghostty/config; or echo 'theme = noctalia' >> ~/.config/ghostty/config; and pkill -SIGUSR2 ghostty\"")
}
if (Settings.data.matugen.foot) {
lines.push("\n[templates.foot]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/foot.conf"')
lines.push('output_path = "~/.config/foot/themes/noctalia"')
lines.push('post_hook = "sed -i /themes/d ~/.config/foot/foot.ini && echo include=~/.config/foot/themes/noctalia >> ~/.config/foot/foot.ini"')
}
if (Settings.data.matugen.fuzzel) {
lines.push("\n[templates.fuzzel]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/fuzzel.conf"')
lines.push('output_path = "~/.config/fuzzel/themes/noctalia"')
lines.push('post_hook = "sed -i /themes/d ~/.config/fuzzel/fuzzel.ini && echo include=~/.config/fuzzel/themes/noctalia >> ~/.config/fuzzel/fuzzel.ini"')
}
if (Settings.data.matugen.vesktop) {
lines.push("\n[templates.vesktop]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/vesktop.css"')
lines.push('output_path = "~/.config/vesktop/themes/noctalia.theme.css"')
}
if (Settings.data.matugen.pywalfox) {
lines.push("\n[templates.pywalfox]")
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/pywalfox.json"')
lines.push('output_path = "~/.cache/wal/colors.json"')
lines.push('post_hook = "pywalfox update"')
}
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"');
lines.push("post_hook = 'gsettings set org.gnome.desktop.interface color-scheme prefer-" + mode + "'");
}
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"');
lines.push("post_hook = 'gsettings set org.gnome.desktop.interface color-scheme prefer-" + mode + "'");
}
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'");
}
if (Settings.data.matugen.ghostty) {
lines.push("\n[templates.ghostty]");
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/ghostty.conf"');
lines.push('output_path = "~/.config/ghostty/themes/noctalia"');
lines.push("post_hook = \"grep -q '^theme *= *' ~/.config/ghostty/config; and sed -i 's/^theme *= *.*/theme = noctalia/' ~/.config/ghostty/config; or echo 'theme = noctalia' >> ~/.config/ghostty/config; and pkill -SIGUSR2 ghostty\"");
}
if (Settings.data.matugen.foot) {
lines.push("\n[templates.foot]");
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/foot.conf"');
lines.push('output_path = "~/.config/foot/themes/noctalia"');
lines.push('post_hook = "sed -i /themes/d ~/.config/foot/foot.ini && echo include=~/.config/foot/themes/noctalia >> ~/.config/foot/foot.ini"');
}
if (Settings.data.matugen.fuzzel) {
lines.push("\n[templates.fuzzel]");
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/fuzzel.conf"');
lines.push('output_path = "~/.config/fuzzel/themes/noctalia"');
lines.push('post_hook = "sed -i /themes/d ~/.config/fuzzel/fuzzel.ini && echo include=~/.config/fuzzel/themes/noctalia >> ~/.config/fuzzel/fuzzel.ini"');
}
if (Settings.data.matugen.vesktop) {
lines.push("\n[templates.vesktop]");
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/vesktop.css"');
lines.push('output_path = "~/.config/vesktop/themes/noctalia.theme.css"');
}
if (Settings.data.matugen.pywalfox) {
lines.push("\n[templates.pywalfox]");
lines.push('input_path = "' + Quickshell.shellDir + '/Assets/Matugen/templates/pywalfox.json"');
lines.push('output_path = "~/.cache/wal/colors.json"');
lines.push('post_hook = "pywalfox update"');
}
return lines.join("\n") + "\n"
}
return lines.join("\n") + "\n";
}
}
+20 -30
View File
@@ -13,7 +13,7 @@ Variants {
required property ShellScreen modelData
active: Settings.isLoaded && modelData && Settings.data.wallpaper.enabled
active: modelData && Settings.data.wallpaper.enabled
sourceComponent: PanelWindow {
id: root
@@ -41,29 +41,10 @@ Variants {
property string futureWallpaper: ""
// Fillmode default is "crop"
property real fillMode: 1.0
property real fillMode: WallpaperService.getFillModeUniform()
property vector4d fillColor: Qt.vector4d(Settings.data.wallpaper.fillColor.r, Settings.data.wallpaper.fillColor.g, Settings.data.wallpaper.fillColor.b, 1.0)
// On startup, defer assigning wallpaper until the service cache is ready
function _startWallpaperOnceReady() {
if (!modelData) {
Qt.callLater(_startWallpaperOnceReady)
return
}
var cacheReady = WallpaperService && WallpaperService.currentWallpapers && Object.keys(WallpaperService.currentWallpapers).length > 0
if (!cacheReady) {
// Try again on the next tick until WallpaperService.init() populates cache
Qt.callLater(_startWallpaperOnceReady)
return
}
fillMode = WallpaperService.getFillModeUniform()
var path = WallpaperService.getWallpaper(modelData.name)
setWallpaperImmediate(path)
}
Component.onCompleted: _startWallpaperOnceReady()
Component.onCompleted: setWallpaperInitial()
Connections {
target: Settings.data.wallpaper
@@ -77,7 +58,6 @@ Variants {
target: WallpaperService
function onWallpaperChanged(screenName, path) {
if (screenName === modelData.name) {
// Update wallpaper display
// Set wallpaper immediately on startup
futureWallpaper = path
@@ -243,9 +223,7 @@ Variants {
easing.type: Easing.InOutCubic
onFinished: {
// Swap images after transition completes
if (currentWallpaper.source !== "") {
currentWallpaper.source = ""
}
currentWallpaper.source = ""
currentWallpaper.source = nextWallpaper.source
nextWallpaper.source = ""
transitionProgress = 0.0
@@ -255,12 +233,20 @@ Variants {
}
}
function setWallpaperInitial() {
// On startup, defer assigning wallpaper until the service cache is ready, retries every tick
if (!WallpaperService || !WallpaperService.isInitialized) {
Qt.callLater(setWallpaperInitial)
return
}
setWallpaperImmediate(WallpaperService.getWallpaper(modelData.name))
}
function setWallpaperImmediate(source) {
transitionAnimation.stop()
transitionProgress = 0.0
if (currentWallpaper.source !== "") {
currentWallpaper.source = ""
}
currentWallpaper.source = ""
currentWallpaper.source = source
nextWallpaper.source = ""
}
@@ -274,8 +260,12 @@ Variants {
// We are interrupting a transition
transitionAnimation.stop()
transitionProgress = 0
currentWallpaper.source = nextWallpaper.source
const newCurrentSource = nextWallpaper.source
currentWallpaper.source = ""
nextWallpaper.source = ""
currentWallpaper.source = newCurrentSource
}
nextWallpaper.source = source
+2 -2
View File
@@ -12,7 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
active: CompositorService.isNiri && CompositorService.niriOverviewActive && modelData && Settings.data.wallpaper.enabled
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
property string wallpaper: ""
@@ -37,7 +37,7 @@ Variants {
}
}
}
Connections {
target: WallpaperService
function onIsInitializedChanged() {
-13
View File
@@ -17,9 +17,6 @@ Singleton {
property ListModel windows: ListModel {}
property int focusedWindowIndex: -1
// Niri-specific properties
property bool niriOverviewActive: false
// Generic events
signal workspaceChanged
signal activeWindowChanged
@@ -105,20 +102,10 @@ Singleton {
focusedWindowIndex = backend.focusedWindowIndex
})
// Niri-specific property bindings
if (isNiri && backend.overviewActiveChanged) {
backend.overviewActiveChanged.connect(() => {
niriOverviewActive = backend.overviewActive
})
}
// Initial sync
syncWorkspaces()
syncWindows()
focusedWindowIndex = backend.focusedWindowIndex
if (isNiri && backend.overviewActive !== undefined) {
niriOverviewActive = backend.overviewActive
}
}
function syncWorkspaces() {
-12
View File
@@ -13,7 +13,6 @@ Item {
property ListModel workspaces: ListModel {}
property var windows: []
property int focusedWindowIndex: -1
property bool overviewActive: false
// Signals that match the facade interface
signal workspaceChanged
@@ -128,8 +127,6 @@ Item {
handleWindowFocusChanged(event.WindowFocusChanged)
} else if (event.WindowLayoutsChanged) {
handleWindowLayoutsChanged(event.WindowLayoutsChanged)
} else if (event.OverviewOpenedOrClosed) {
handleOverviewOpenedOrClosed(event.OverviewOpenedOrClosed)
}
} catch (e) {
Logger.error("NiriService", "Error parsing event stream:", e, data)
@@ -321,15 +318,6 @@ Item {
}
}
function handleOverviewOpenedOrClosed(eventData) {
try {
overviewActive = eventData.is_open
Logger.log("NiriService", "Overview opened or closed:", eventData.is_open)
} catch (e) {
Logger.error("NiriService", "Error handling OverviewOpenedOrClosed:", e)
}
}
// Public functions
function switchToWorkspace(workspaceId) {
try {