From 37c3dacff46f00eb65dcfd83f86453e803c65caa Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Tue, 12 Aug 2025 19:35:50 +0200 Subject: [PATCH] Add wallust support --- Assets/Wallust/Templates/noctalia.json | 26 ------ Assets/Wallust/templates/noctalia.json | 26 ++++++ Assets/Wallust/wallust.toml | 2 +- Modules/Background/Background.qml | 4 +- Modules/Settings/Tabs/Wallpaper.qml | 2 +- Services/Audio.qml | 2 +- Services/Colors.qml | 112 ++++++++++++++++++++----- Services/Settings.qml | 2 +- Services/Wallpapers.qml | 10 +-- Templates/templates/noctalia.json | 28 ------- Templates/wallust.toml | 47 ----------- 11 files changed, 126 insertions(+), 135 deletions(-) delete mode 100644 Assets/Wallust/Templates/noctalia.json create mode 100644 Assets/Wallust/templates/noctalia.json delete mode 100644 Templates/templates/noctalia.json delete mode 100644 Templates/wallust.toml diff --git a/Assets/Wallust/Templates/noctalia.json b/Assets/Wallust/Templates/noctalia.json deleted file mode 100644 index f10f03e..0000000 --- a/Assets/Wallust/Templates/noctalia.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "backgroundPrimary": "{{ background }}", - "backgroundSecondary": "{{ background | lighten(0.05) }}", - "backgroundTertiary": "{{ background | lighten(0.1) }}", - - "surface": "{{ background | lighten(0.08) }}", - "surfaceVariant": "{{ background | lighten(0.15) }}", - - "textPrimary": "{{ foreground }}", - "textSecondary": "{{ foreground | darken(0.1) }}", - "textDisabled": "{{ foreground | darken(0.4) }}", - - "accentPrimary": "{{ color4 }}", - "accentSecondary": "{{ color4 | lighten(0.2) }}", - "accentTertiary": "{{ color4 | darken(0.2) }}", - - "error": "{{ color5 | lighten(0.1) }}", - "warning": "{{ color5 | lighten(0.3) }}", - - "highlight": "{{ color4 | lighten(0.4) }}", - "onAccent": "{{ background }}", - "outline": "{{ background | lighten(0.3) }}", - - "shadow": "{{ background }}", - "overlay": "{{ background }}" -} \ No newline at end of file diff --git a/Assets/Wallust/templates/noctalia.json b/Assets/Wallust/templates/noctalia.json new file mode 100644 index 0000000..dd3e547 --- /dev/null +++ b/Assets/Wallust/templates/noctalia.json @@ -0,0 +1,26 @@ +{ + "backgroundPrimary": "{{ background }}", + "backgroundSecondary": "{{ background | lighten(0.03) }}", + "backgroundTertiary": "{{ background | lighten(0.06) }}", + + "surface": "{{ background | lighten(0.04) }}", + "surfaceVariant": "{{ background | lighten(0.08) }}", + + "textPrimary": "{{ foreground | darken(0.1) }}", + "textSecondary": "{{ foreground | darken(0.3) }}", + "textDisabled": "{{ foreground | darken(0.5) }}", + + "accentPrimary": "{{ color4 | darken(0.3) | saturate(0.4) }}", + "accentSecondary": "{{ color1 | darken(0.4) | saturate(0.3) }}", + "accentTertiary": "{{ color3 | darken(0.35) | saturate(0.35) }}", + + "error": "{{ color5 | darken(0.25) | saturate(0.5) }}", + "warning": "{{ color6 | darken(0.3) | saturate(0.4) }}", + + "hover": "{{ color4 | darken(0.2) | saturate(0.3) }}", + "onAccent": "{{ background }}", + "outline": "{{ background | lighten(0.15) }}", + + "shadow": "{{ background }}", + "overlay": "{{ background }}" +} \ No newline at end of file diff --git a/Assets/Wallust/wallust.toml b/Assets/Wallust/wallust.toml index e50c5bb..6c1b8f2 100644 --- a/Assets/Wallust/wallust.toml +++ b/Assets/Wallust/wallust.toml @@ -44,4 +44,4 @@ check_contrast = true # target: ABSOLUTE path in which to place a file with generated templated values. # ¡ If either one is a directory, then both SHOULD be one. ! # zathura = { template = 'zathura', target = '~/.config/zathura/zathurarc' } -Quickshell = { template = 'quickshell.json', target = '~/.config/Noctalia/Theme.json' } \ No newline at end of file +Noctalia = { template = 'noctalia.json', target = '~/.config/noctalia/Theme.json' } \ No newline at end of file diff --git a/Modules/Background/Background.qml b/Modules/Background/Background.qml index 20752c9..1b2a185 100644 --- a/Modules/Background/Background.qml +++ b/Modules/Background/Background.qml @@ -15,9 +15,9 @@ Variants { // Force update when SWWW setting changes onVisibleChanged: { if (visible) { - console.log("Background: Showing wallpaper:", wallpaperSource) + } else { - console.log("Background: Hiding wallpaper (SWWW enabled)") + } } color: "transparent" diff --git a/Modules/Settings/Tabs/Wallpaper.qml b/Modules/Settings/Tabs/Wallpaper.qml index 430b636..d121236 100644 --- a/Modules/Settings/Tabs/Wallpaper.qml +++ b/Modules/Settings/Tabs/Wallpaper.qml @@ -61,7 +61,7 @@ ColumnLayout { NText { text: "Path to your wallpaper folder" - font.pointSize: Style.fontSizeSmall * scaling + font.pointSize: 12 color: Colors.textSecondary wrapMode: Text.WordWrap Layout.fillWidth: true diff --git a/Services/Audio.qml b/Services/Audio.qml index 1a3c8fa..4f4641e 100644 --- a/Services/Audio.qml +++ b/Services/Audio.qml @@ -49,7 +49,7 @@ Singleton { vol = 0 } root._volume = vol - console.log("[Audio] onVolumeChanged: " + root._volume.toFixed(2)) + } function onMutedChanged() { diff --git a/Services/Colors.qml b/Services/Colors.qml index 0bd125a..c5376a1 100644 --- a/Services/Colors.qml +++ b/Services/Colors.qml @@ -9,47 +9,113 @@ Singleton { id: root // Backgrounds - property color backgroundPrimary: themeData.backgroundPrimary - property color backgroundSecondary: themeData.backgroundSecondary - property color backgroundTertiary: themeData.backgroundTertiary + property color backgroundPrimary: useWallust ? wallustTheme.backgroundPrimary : defaultTheme.backgroundPrimary + property color backgroundSecondary: useWallust ? wallustTheme.backgroundSecondary : defaultTheme.backgroundSecondary + property color backgroundTertiary: useWallust ? wallustTheme.backgroundTertiary : defaultTheme.backgroundTertiary // Surfaces & Elevation - property color surface: themeData.surface - property color surfaceVariant: themeData.surfaceVariant + property color surface: useWallust ? wallustTheme.surface : defaultTheme.surface + property color surfaceVariant: useWallust ? wallustTheme.surfaceVariant : defaultTheme.surfaceVariant // Text Colors - property color textPrimary: themeData.textPrimary - property color textSecondary: themeData.textSecondary - property color textDisabled: themeData.textDisabled + property color textPrimary: useWallust ? wallustTheme.textPrimary : defaultTheme.textPrimary + property color textSecondary: useWallust ? wallustTheme.textSecondary : defaultTheme.textSecondary + property color textDisabled: useWallust ? wallustTheme.textDisabled : defaultTheme.textDisabled // Accent Colors - property color accentPrimary: themeData.accentPrimary - property color accentSecondary: themeData.accentSecondary - property color accentTertiary: themeData.accentTertiary + property color accentPrimary: useWallust ? wallustTheme.accentPrimary : defaultTheme.accentPrimary + property color accentSecondary: useWallust ? wallustTheme.accentSecondary : defaultTheme.accentSecondary + property color accentTertiary: useWallust ? wallustTheme.accentTertiary : defaultTheme.accentTertiary // Error/Warning - property color error: themeData.error - property color warning: themeData.warning + property color error: useWallust ? wallustTheme.error : defaultTheme.error + property color warning: useWallust ? wallustTheme.warning : defaultTheme.warning // Hover - property color hover: themeData.hover + property color hover: useWallust ? wallustTheme.hover : defaultTheme.hover // Additional Theme Properties - property color onAccent: themeData.onAccent - property color outline: themeData.outline + property color onAccent: useWallust ? wallustTheme.onAccent : defaultTheme.onAccent + property color outline: useWallust ? wallustTheme.outline : defaultTheme.outline // Shadows & Overlays - property color shadow: applyOpacity(themeData.shadow, "B3") - property color overlay: applyOpacity(themeData.overlay, "66") + property color shadow: applyOpacity(useWallust ? wallustTheme.shadow : defaultTheme.shadow, "B3") + property color overlay: applyOpacity(useWallust ? wallustTheme.overlay : defaultTheme.overlay, "66") + + // Check if we should use Wallust theme + property bool useWallust: Settings.data.wallpaper.generateTheme && wallustFile.loaded function applyOpacity(color, opacity) { - return color.replace("#", "#" + opacity) + // Convert color to string and apply opacity + return color.toString().replace("#", "#" + opacity) } - // FileView to load theme data from JSON file + // Default theme colors + QtObject { + id: defaultTheme + + property color backgroundPrimary: "#191724" + property color backgroundSecondary: "#1f1d2e" + property color backgroundTertiary: "#26233a" + + property color surface: "#1f1d2e" + property color surfaceVariant: "#37354c" + + property color textPrimary: "#e0def4" + property color textSecondary: "#908caa" + property color textDisabled: "#6e6a86" + + property color accentPrimary: "#ebbcba" + property color accentSecondary: "#31748f" + property color accentTertiary: "#9ccfd8" + + property color error: "#eb6f92" + property color warning: "#f6c177" + + property color hover: "#c4a7e7" + + property color onAccent: "#191724" + property color outline: "#44415a" + + property color shadow: "#191724" + property color overlay: "#191724" + } + + // Wallust theme colors (loaded from Theme.json) + QtObject { + id: wallustTheme + + property color backgroundPrimary: wallustData.backgroundPrimary + property color backgroundSecondary: wallustData.backgroundSecondary + property color backgroundTertiary: wallustData.backgroundTertiary + + property color surface: wallustData.surface + property color surfaceVariant: wallustData.surfaceVariant + + property color textPrimary: wallustData.textPrimary + property color textSecondary: wallustData.textSecondary + property color textDisabled: wallustData.textDisabled + + property color accentPrimary: wallustData.accentPrimary + property color accentSecondary: wallustData.accentSecondary + property color accentTertiary: wallustData.accentTertiary + + property color error: wallustData.error + property color warning: wallustData.warning + + property color hover: wallustData.hover + + property color onAccent: wallustData.onAccent + property color outline: wallustData.outline + + property color shadow: wallustData.shadow + property color overlay: wallustData.overlay + } + + // FileView to load Wallust theme data from Theme.json FileView { - id: themeFile - path: Settings.colorsFile + id: wallustFile + path: Settings.configDir + "Theme.json" watchChanges: true onFileChanged: reload() onAdapterUpdated: writeAdapter() @@ -60,7 +126,7 @@ Singleton { } } JsonAdapter { - id: themeData + id: wallustData // Backgrounds property string backgroundPrimary: "#191724" diff --git a/Services/Settings.qml b/Services/Settings.qml index 7e7b0b4..9c8ab95 100644 --- a/Services/Settings.qml +++ b/Services/Settings.qml @@ -53,7 +53,7 @@ Singleton { onLoaded: function () { Qt.callLater(function () { if (adapter.wallpaper.current !== "") { - console.log("Settings: Initializing wallpaper to:", adapter.wallpaper.current) + Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true) } }) diff --git a/Services/Wallpapers.qml b/Services/Wallpapers.qml index e586a09..ca9ee48 100644 --- a/Services/Wallpapers.qml +++ b/Services/Wallpapers.qml @@ -39,7 +39,7 @@ Singleton { } function setCurrentWallpaper(path, isInitial) { - console.log("Wallpapers: Setting wallpaper to:", path, "isInitial:", isInitial) + currentWallpaper = path if (!isInitial) { Settings.data.wallpaper.current = path @@ -50,7 +50,7 @@ Singleton { } else { transitionType = Settings.data.wallpaper.swww.transitionType } - console.log("SWWW: Changing wallpaper with transition type:", transitionType) + changeWallpaperProcess.running = true } else { // Fallback: update the settings directly for non-SWWW mode @@ -140,11 +140,11 @@ Singleton { running: false onStarted: { - console.log("SWWW: Process started with command:", command.join(" ")) + } onExited: function(exitCode, exitStatus) { - console.log("SWWW: Process finished with exit code:", exitCode, "status:", exitStatus) + if (exitCode !== 0) { console.log("SWWW: Process failed. Make sure swww-daemon is running with: swww-daemon") console.log("SWWW: You can start it with: swww-daemon --format xrgb") @@ -154,7 +154,7 @@ Singleton { Process { id: generateThemeProcess - command: ["wallust", "run", currentWallpaper, "-u", "-k", "-d", "Templates"] + command: ["wallust", "run", currentWallpaper, "-u", "-k", "-d", "Assets/Wallust"] workingDirectory: Quickshell.shellDir running: false } diff --git a/Templates/templates/noctalia.json b/Templates/templates/noctalia.json deleted file mode 100644 index 16aef1c..0000000 --- a/Templates/templates/noctalia.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "backgroundPrimary": "{{ background }}", - "backgroundSecondary": "{{ background | lighten(0.05) }}", - "backgroundTertiary": "{{ background | lighten(0.1) }}", - - "surface": "{{ background | lighten(0.08) }}", - "surfaceVariant": "{{ background | lighten(0.15) }}", - - "textPrimary": "{{ foreground }}", - "textSecondary": "{{ foreground | darken(0.1) }}", - "textDisabled": "{{ foreground | darken(0.4) }}", - - "accentPrimary": "{{ color4 }}", - "accentSecondary": "{{ color4 | lighten(0.2) }}", - "accentTertiary": "{{ color4 | darken(0.2) }}", - - "error": "{{ color5 | lighten(0.1) }}", - "warning": "{{ color5 | lighten(0.3) }}", - - "highlight": "{{ color4 | lighten(0.4) }}", - "rippleEffect": "{{ color4 | lighten(0.1) }}", - - "onAccent": "{{ background }}", - "outline": "{{ background | lighten(0.3) }}", - - "shadow": "{{ background }}", - "overlay": "{{ background }}" -} diff --git a/Templates/wallust.toml b/Templates/wallust.toml deleted file mode 100644 index cbd3593..0000000 --- a/Templates/wallust.toml +++ /dev/null @@ -1,47 +0,0 @@ -# wallust v3.4 -# -# You can copy this file to ~/.config/wallust/wallust.toml (keep in mind is a sample config) - -# SIMPLE TUTORIAL, or `man wallust.5`: -# https://explosion-mental.codeberg.page/wallust/ -# -# If comming from v2: https://explosion-mental.codeberg.page/wallust/v3.html#wallusttoml - -# Global section - values below can be overwritten by command line flags - -# How the image is parse, in order to get the colors: -# full - resized - wal - thumb - fastresize - kmeans -backend = "fastresize" - -# What color space to use to produce and select the most prominent colors: -# lab - labmixed - lch - lchmixed -color_space = "lch" - -# Use the most prominent colors in a way that makes sense, a scheme color palette: -# dark - dark16 - darkcomp - darkcomp16 -# light - light16 - lightcomp - lightcomp16 -# harddark - harddark16 - harddarkcomp - harddarkcomp16 -# softdark - softdark16 - softdarkcomp - softdarkcomp16 -# softlight - softlight16 - softlightcomp - softlightcomp16 -palette = "dark" - -# Ensures a "readable contrast" (OPTIONAL, disabled by default) -# Should only be enabled when you notice an unreadable contrast frequently happening -# with your images. The reference color for the contrast is the background color. -#check_contrast = true - -# Color saturation, between [1% and 100%] (OPTIONAL, disabled by default) -# usually something higher than 50 increases the saturation and below -# decreases it (on a scheme with strong and vivid colors) -#saturation = 35 - -# Alpha value for templating, by default 100 (no other use whatsoever) -#alpha = 100 - -[templates] -# NOTE: prefer '' over "" for paths, avoids escaping. -# template: A RELATIVE path that points to `~/.config/wallust/template` (depends on platform) -# target: ABSOLUTE path in which to place a file with generated templated values. -# ¡ If either one is a directory, then both SHOULD be one. ! -# zathura = { template = 'zathura', target = '~/.config/zathura/zathurarc' } -Noctalia = { template = 'noctalia.json', target = '~/.config/noctalia/Theme.json' }