This commit is contained in:
Ly-sec
2025-09-29 16:32:00 +02:00
20 changed files with 65 additions and 81 deletions
+15 -28
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
@@ -243,9 +224,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 +234,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 = ""
}
+1 -1
View File
@@ -12,7 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
active: Settings.isLoaded && CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
property string wallpaper: ""
+1 -1
View File
@@ -28,7 +28,7 @@ Variants {
}
}
active: Settings.isLoaded && BarService.isVisible && modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)) : false
active: BarService.isVisible && modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)) : false
sourceComponent: PanelWindow {
screen: modelData || null
+1 -1
View File
@@ -29,7 +29,7 @@ Item {
id: loader
anchors.fill: parent
active: Settings.isLoaded && widgetId !== ""
active: widgetId !== ""
sourceComponent: {
if (!active) {
return null
+2 -2
View File
@@ -61,7 +61,7 @@ Rectangle {
spacing: Settings.data.bar.showCapsule ? -4 * scaling : -2 * scaling
Repeater {
id: repeater
model: Qt.formatDateTime(now, formatHorizontal.trim()).split("\\n")
model: Qt.locale().toString(now, formatHorizontal.trim()).split("\\n")
NText {
visible: text !== ""
text: modelData
@@ -91,7 +91,7 @@ Rectangle {
anchors.centerIn: parent
spacing: -2 * scaling
Repeater {
model: Qt.formatDateTime(now, formatVertical.trim()).split(" ")
model: Qt.locale().toString(now, formatVertical.trim()).split(" ")
delegate: NText {
visible: text !== ""
text: modelData
+1 -1
View File
@@ -88,7 +88,7 @@ NBox {
NText {
text: {
var weatherDate = new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/"))
return Qt.formatDateTime(weatherDate, "ddd")
return Qt.locale().toString(weatherDate, "ddd")
}
color: Color.mOnSurface
Layout.alignment: Qt.AlignHCenter
+3 -11
View File
@@ -55,15 +55,7 @@ Variants {
// Initial update when component is ready
Component.onCompleted: {
if (Settings.isLoaded && ToplevelManager) {
updateDockApps()
}
}
// Update when Settings are loaded
Connections {
target: Settings
function onSettingsLoaded() {
if (ToplevelManager) {
updateDockApps()
}
}
@@ -198,7 +190,7 @@ Variants {
// PEEK WINDOW - Always visible when auto-hide is enabled
Loader {
active: Settings.isLoaded && barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && autoHide
active: barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && autoHide
sourceComponent: PanelWindow {
id: peekWindow
@@ -244,7 +236,7 @@ Variants {
// DOCK WINDOW
Loader {
active: Settings.isLoaded && barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && dockLoaded && ToplevelManager && (dockApps.length > 0)
active: barIsReady && modelData && Settings.data.dock.monitors.includes(modelData.name) && dockLoaded && ToplevelManager && (dockApps.length > 0)
sourceComponent: PanelWindow {
id: dockWindow
+2 -2
View File
@@ -27,12 +27,12 @@ Loader {
}
function formatTime() {
return Settings.data.location.use12hourFormat ? Qt.formatDateTime(new Date(), "h:mm A") : Qt.formatDateTime(new Date(), "HH:mm")
return Settings.data.location.use12hourFormat ? Qt.locale().toString(new Date(), "h:mm A") : Qt.locale().toString(new Date(), "HH:mm")
}
function formatDate() {
// For full text date, day is always before month, so we use this format for everybody: Wednesday, September 17.
return Qt.formatDateTime(new Date(), "dddd, MMMM d")
return Qt.locale().toString(new Date(), "dddd, MMMM d")
}
function scheduleUnloadAfterUnlock() {
+3 -3
View File
@@ -22,7 +22,7 @@ Variants {
property ListModel notificationModel: NotificationService.activeList
// If no notification display activated in settings, then show them all
active: Settings.isLoaded && modelData && (Settings.data.notifications.monitors.includes(modelData.name) || (Settings.data.notifications.monitors.length === 0))
active: modelData && (Settings.data.notifications.monitors.includes(modelData.name) || (Settings.data.notifications.monitors.length === 0))
Connections {
target: ScalingService
@@ -37,11 +37,11 @@ Variants {
screen: modelData
WlrLayershell.namespace: "noctalia-notifications"
WlrLayershell.layer: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.alwaysOnTop) ? WlrLayer.Overlay : WlrLayer.Top
WlrLayershell.layer: (Settings.data.notifications && Settings.data.notifications.alwaysOnTop) ? WlrLayer.Overlay : WlrLayer.Top
color: Color.transparent
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property string location: (Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: location.indexOf("_left") >= 0
+2 -2
View File
@@ -22,7 +22,7 @@ Variants {
property ListModel notificationModel: NotificationService.activeList
// If no notification display activated in settings, then show them all
property bool canShowOnThisScreen: Settings.isLoaded && modelData && (Settings.data.osd.monitors.includes(modelData.name) || (Settings.data.osd.monitors.length === 0))
property bool canShowOnThisScreen: modelData && (Settings.data.osd.monitors.includes(modelData.name) || (Settings.data.osd.monitors.length === 0))
// Loader is only active when actually showing something
active: false
@@ -104,7 +104,7 @@ Variants {
id: panel
screen: modelData
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.osd && Settings.data.osd.location) ? Settings.data.osd.location : "top_right"
readonly property string location: (Settings.data.osd && Settings.data.osd.location) ? Settings.data.osd.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: (location.indexOf("_left") >= 0) || (location === "left")
@@ -182,7 +182,7 @@ ColumnLayout {
// Horizontal
Repeater {
Layout.topMargin: Style.marginM * scaling
model: Qt.formatDateTime(now, valueFormatHorizontal.trim()).split("\\n")
model: Qt.locale().toString(now, valueFormatHorizontal.trim()).split("\\n")
delegate: NText {
visible: text !== ""
text: modelData
@@ -213,7 +213,7 @@ ColumnLayout {
Repeater {
Layout.topMargin: Style.marginM * scaling
model: Qt.formatDateTime(now, valueFormatVertical.trim()).split(" ")
model: Qt.locale().toString(now, valueFormatVertical.trim()).split(" ")
delegate: NText {
visible: text !== ""
text: modelData
+1 -1
View File
@@ -16,6 +16,6 @@ Variants {
scaling: ScalingService.getScreenScale(modelData)
// Only activate on enabled screens
active: Settings.isLoaded && modelData && (Settings.data.notifications.monitors.includes(modelData.name) || Settings.data.notifications.monitors.length === 0)
active: modelData && (Settings.data.notifications.monitors.includes(modelData.name) || Settings.data.notifications.monitors.length === 0)
}
}
+1 -1
View File
@@ -128,7 +128,7 @@ Item {
screen: root.screen
readonly property string location: (Settings.isLoaded && Settings.data && Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property string location: (Settings.data.notifications && Settings.data.notifications.location) ? Settings.data.notifications.location : "top_right"
readonly property bool isTop: (location === "top") || (location.length >= 3 && location.substring(0, 3) === "top")
readonly property bool isBottom: (location === "bottom") || (location.length >= 6 && location.substring(0, 6) === "bottom")
readonly property bool isLeft: location.indexOf("_left") >= 0
+12
View File
@@ -4,6 +4,7 @@ import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import qs.Commons
import qs.Modules.Settings
import qs.Services
import qs.Widgets
import "../../Helpers/FuzzySort.js" as FuzzySort
@@ -63,6 +64,17 @@ NPanel {
Layout.fillWidth: true
}
NIconButton {
icon: "settings"
tooltipText: I18n.tr("settings.wallpaper.settings.section.label")
baseSize: Style.baseWidgetSize * 0.8
onClicked: {
var settingsPanel = PanelService.getPanel("settingsPanel")
settingsPanel.requestedTab = SettingsPanel.Tab.Wallpaper
settingsPanel.open()
}
}
NIconButton {
icon: "refresh"
tooltipText: I18n.tr("tooltips.refresh-wallpaper-list")
+1 -1
View File
@@ -10,7 +10,7 @@ Singleton {
id: root
// Public API
property bool active: Settings.isLoaded && Settings.data.appLauncher.enableClipboardHistory && cliphistAvailable
property bool active: Settings.data.appLauncher.enableClipboardHistory && cliphistAvailable
property bool loading: false
property var items: [] // [{id, preview, mime, isImage}]
+1 -6
View File
@@ -10,7 +10,7 @@ import qs.Services
Singleton {
id: root
property string dynamicConfigPath: Settings.isLoaded ? Settings.cacheDir + "matugen.dynamic.toml" : ""
property string dynamicConfigPath: Settings.cacheDir + "matugen.dynamic.toml"
// External state management
Connections {
@@ -47,11 +47,6 @@ Singleton {
// Generate colors using current wallpaper and settings
function generateFromWallpaper() {
if (!Settings.isLoaded) {
Logger.log("Matugen", "Settings not loaded yet, skipping wallpaper color generation")
return
}
Logger.log("Matugen", "Generating from wallpaper on screen:", Screen.name)
var wp = WallpaperService.getWallpaper(Screen.name).replace(/'/g, "'\\''")
if (wp === "") {
+7 -13
View File
@@ -15,19 +15,13 @@ Singleton {
Component.onCompleted: {
Logger.log("Scaling", "Service started")
}
Connections {
target: Settings
function onSettingsLoaded() {
// Initialize cache from Settings once they are loaded on startup
var monitors = Settings.data.ui.monitorsScaling || []
for (var i = 0; i < monitors.length; i++) {
if (monitors[i].name && monitors[i].scale !== undefined) {
currentScales[monitors[i].name] = monitors[i].scale
root.scaleChanged(monitors[i].name, monitors[i].scale)
Logger.log("Scaling", "Caching scaling for", monitors[i].name, ":", monitors[i].scale)
}
// Initialize cache from Settings once they are loaded on startup
var monitors = Settings.data.ui.monitorsScaling || []
for (var i = 0; i < monitors.length; i++) {
if (monitors[i].name && monitors[i].scale !== undefined) {
currentScales[monitors[i].name] = monitors[i].scale
root.scaleChanged(monitors[i].name, monitors[i].scale)
Logger.log("Scaling", "Caching scaling for", monitors[i].name, ":", monitors[i].scale)
}
}
}
+5 -1
View File
@@ -26,6 +26,8 @@ Singleton {
// Cache for current wallpapers - can be updated directly since we use signals for notifications
property var currentWallpapers: ({})
property bool isInitialized: false
// Signals for reactive UI updates
signal wallpaperChanged(string screenName, string path)
// Emitted when a wallpaper changes
@@ -75,6 +77,8 @@ Singleton {
function init() {
Logger.log("Wallpaper", "Service started")
translateModels()
// Rebuild cache from persisted settings
var monitors = Settings.data.wallpaper.monitors || []
currentWallpapers = ({})
@@ -86,7 +90,7 @@ Singleton {
}
}
translateModels()
isInitialized = true
}
// -------------------------------------------------
+1 -1
View File
@@ -312,7 +312,7 @@ Rectangle {
NText {
anchors.centerIn: parent
text: Qt.formatDateTime(root.sampleDate, modelData.token)
text: Qt.locale().toString(root.sampleDate, modelData.token)
color: tokenMouseArea.containsMouse ? Color.mOnPrimary : Color.mSurfaceVariant
font.pointSize: Style.fontSizeS * scaling
+3 -3
View File
@@ -82,12 +82,12 @@ ShellRoot {
PanelService.lockScreen = lockScreen
Logger.log("Shell", "---------------------------")
WallpaperService.init()
MatugenService.init()
ColorSchemeService.init()
BarWidgetRegistry.init()
LocationService.init()
NightLightService.apply()
ColorSchemeService.init()
MatugenService.init()
WallpaperService.init()
FontService.init()
HooksService.init()
BluetoothService.init()