Merge branch 'main' into auto-night-mode

This commit is contained in:
Leopold Luley
2025-10-16 17:42:47 +02:00
67 changed files with 372 additions and 376 deletions
+4 -4
View File
@@ -118,7 +118,7 @@ Variants {
sourceSize: undefined
onStatusChanged: {
if (status === Image.Error) {
Logger.warn("Current wallpaper failed to load:", source)
Logger.w("Current wallpaper failed to load:", source)
} else if (status === Image.Ready && !dimensionsCalculated) {
dimensionsCalculated = true
const optimalSize = calculateOptimalWallpaperSize(implicitWidth, implicitHeight)
@@ -147,7 +147,7 @@ Variants {
sourceSize: undefined
onStatusChanged: {
if (status === Image.Error) {
Logger.warn("Next wallpaper failed to load:", source)
Logger.w("Next wallpaper failed to load:", source)
} else if (status === Image.Ready && !dimensionsCalculated) {
dimensionsCalculated = true
const optimalSize = calculateOptimalWallpaperSize(implicitWidth, implicitHeight)
@@ -336,7 +336,7 @@ Variants {
dim = Qt.size(h * imageAspectRatio, h)
}
Logger.log("Background", `Wallpaper resized on ${modelData.name} ${screenWidth}x${screenHeight} @ ${compositorScale}x`, "src:", wpWidth, wpHeight, "dst:", dim.width, dim.height)
Logger.d("Background", `Wallpaper resized on ${modelData.name} ${screenWidth}x${screenHeight} @ ${compositorScale}x`, "src:", wpWidth, wpHeight, "dst:", dim.width, dim.height)
return dim
}
@@ -425,7 +425,7 @@ Variants {
transitionType = "fade"
}
//Logger.log("Background", "New wallpaper: ", futureWallpaper, "On:", modelData.name, "Transition:", transitionType)
//Logger.i("Background", "New wallpaper: ", futureWallpaper, "On:", modelData.name, "Transition:", transitionType)
switch (transitionType) {
case "none":
setWallpaperImmediate(futureWallpaper)
+1 -1
View File
@@ -20,7 +20,7 @@ Variants {
Component.onCompleted: {
if (modelData) {
Logger.log("Overview", "Loading Overview component for Niri on", modelData.name)
Logger.d("Overview", "Loading Overview component for Niri on", modelData.name)
}
setWallpaperInitial()
}
+2 -2
View File
@@ -51,7 +51,7 @@ Item {
item.onLoaded()
}
//Logger.log("BarWidgetLoader", "Loaded", widgetId, "on screen", item.screen.name)
//Logger.i("BarWidgetLoader", "Loaded", widgetId, "on screen", item.screen.name)
}
Component.onDestruction: {
@@ -67,7 +67,7 @@ Item {
// Error handling
onWidgetIdChanged: {
if (widgetId && !BarWidgetRegistry.hasWidget(widgetId)) {
Logger.warn("BarWidgetLoader", "Widget not found in registry:", widgetId)
Logger.w("BarWidgetLoader", "Widget not found in registry:", widgetId)
}
}
}
+2 -2
View File
@@ -30,12 +30,12 @@ PopupWindow {
function showAt(item, x, y) {
if (!item) {
Logger.warn("TrayMenu", "anchorItem is undefined, won't show menu.")
Logger.w("TrayMenu", "anchorItem is undefined, won't show menu.")
return
}
if (!opener.children || opener.children.values.length === 0) {
//Logger.warn("TrayMenu", "Menu not ready, delaying show")
//Logger.w("TrayMenu", "Menu not ready, delaying show")
Qt.callLater(() => showAt(item, x, y))
return
}
+5 -5
View File
@@ -72,7 +72,7 @@ Item {
return iconResult
}
} catch (iconError) {
Logger.warn("ActiveWindow", "Error getting icon from CompositorService:", iconError)
Logger.w("ActiveWindow", "Error getting icon from CompositorService:", iconError)
}
}
@@ -90,14 +90,14 @@ Item {
}
}
} catch (fallbackError) {
Logger.warn("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError)
Logger.w("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError)
}
}
}
return ThemeIcons.iconFromName(fallbackIcon)
} catch (e) {
Logger.warn("ActiveWindow", "Error in getAppIcon:", e)
Logger.w("ActiveWindow", "Error in getAppIcon:", e)
return ThemeIcons.iconFromName(fallbackIcon)
}
}
@@ -367,7 +367,7 @@ Item {
windowIcon.source = Qt.binding(getAppIcon)
windowIconVertical.source = Qt.binding(getAppIcon)
} catch (e) {
Logger.warn("ActiveWindow", "Error in onActiveWindowChanged:", e)
Logger.w("ActiveWindow", "Error in onActiveWindowChanged:", e)
}
}
function onWindowListChanged() {
@@ -375,7 +375,7 @@ Item {
windowIcon.source = Qt.binding(getAppIcon)
windowIconVertical.source = Qt.binding(getAppIcon)
} catch (e) {
Logger.warn("ActiveWindow", "Error in onWindowListChanged:", e)
Logger.w("ActiveWindow", "Error in onWindowListChanged:", e)
}
}
}
+3 -3
View File
@@ -112,7 +112,7 @@ Item {
function onClicked() {
if (leftClickExec) {
Quickshell.execDetached(["sh", "-c", leftClickExec])
Logger.log("CustomButton", `Executing command: ${leftClickExec}`)
Logger.i("CustomButton", `Executing command: ${leftClickExec}`)
} else if (!hasExec) {
// No script was defined, open settings
var settingsPanel = PanelService.getPanel("settingsPanel")
@@ -124,14 +124,14 @@ Item {
function onRightClicked() {
if (rightClickExec) {
Quickshell.execDetached(["sh", "-c", rightClickExec])
Logger.log("CustomButton", `Executing command: ${rightClickExec}`)
Logger.i("CustomButton", `Executing command: ${rightClickExec}`)
}
}
function onMiddleClicked() {
if (middleClickExec) {
Quickshell.execDetached(["sh", "-c", middleClickExec])
Logger.log("CustomButton", `Executing command: ${middleClickExec}`)
Logger.i("CustomButton", `Executing command: ${middleClickExec}`)
}
}
}
+2 -2
View File
@@ -51,7 +51,7 @@ Item {
Connections {
target: AudioService.source?.audio ? AudioService.source?.audio : null
function onVolumeChanged() {
// Logger.log("Bar:Microphone", "onInputVolumeChanged")
// Logger.i("Bar:Microphone", "onInputVolumeChanged")
if (!firstInputVolumeReceived) {
// Ignore the first volume change
firstInputVolumeReceived = true
@@ -66,7 +66,7 @@ Item {
Connections {
target: AudioService.source?.audio ? AudioService.source?.audio : null
function onMutedChanged() {
// Logger.log("Bar:Microphone", "onInputMutedChanged")
// Logger.i("Bar:Microphone", "onInputMutedChanged")
if (!firstInputVolumeReceived) {
// Ignore the first mute change
firstInputVolumeReceived = true
+2 -2
View File
@@ -168,13 +168,13 @@ Rectangle {
try {
CompositorService.focusWindow(taskbarItem.modelData)
} catch (error) {
Logger.error("Taskbar", "Failed to activate toplevel: " + error)
Logger.e("Taskbar", "Failed to activate toplevel: " + error)
}
} else if (mouse.button === Qt.RightButton) {
try {
CompositorService.closeWindow(taskbarItem.modelData)
} catch (error) {
Logger.error("Taskbar", "Failed to close toplevel: " + error)
Logger.e("Taskbar", "Failed to close toplevel: " + error)
}
}
}
+5 -5
View File
@@ -43,7 +43,7 @@ Rectangle {
if (!str || !rule) {
return false
}
Logger.log("Tray", "wildCardMatch - Input str:", str, "rule:", rule)
Logger.i("Tray", "wildCardMatch - Input str:", str, "rule:", rule)
// Escape all special regex characters in the rule
let escapedRule = rule.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
@@ -52,15 +52,15 @@ Rectangle {
// Add ^ and $ to match the entire string
pattern = '^' + pattern + '$'
Logger.log("Tray", "wildCardMatch - Generated pattern:", pattern)
Logger.i("Tray", "wildCardMatch - Generated pattern:", pattern)
try {
const regex = new RegExp(pattern, 'i')
// 'i' for case-insensitive
Logger.log("Tray", "wildCardMatch - Regex test result:", regex.test(str))
Logger.i("Tray", "wildCardMatch - Regex test result:", regex.test(str))
return regex.test(str)
} catch (e) {
Logger.warn("Tray", "Invalid regex pattern for wildcard match:", rule, e.message)
Logger.w("Tray", "Invalid regex pattern for wildcard match:", rule, e.message)
return false // If regex is invalid, it won't match
}
}
@@ -252,7 +252,7 @@ Rectangle {
trayMenu.item.menu = modelData.menu
trayMenu.item.showAt(parent, menuX, menuY)
} else {
Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set")
Logger.i("Tray", "No menu available for", modelData.id, "or trayMenu not set")
}
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ Item {
Connections {
target: AudioService.sink?.audio ? AudioService.sink?.audio : null
function onVolumeChanged() {
// Logger.log("Bar:Volume", "onVolumeChanged")
// Logger.i("Bar:Volume", "onVolumeChanged")
if (!firstVolumeReceived) {
// Ignore the first volume change
firstVolumeReceived = true
+1 -1
View File
@@ -37,7 +37,7 @@ NIconButton {
}
return connected ? NetworkService.signalIcon(signalStrength) : "wifi-off"
} catch (error) {
Logger.error("Wi-Fi", "Error getting icon:", error)
Logger.e("Wi-Fi", "Error getting icon:", error)
return "signal_wifi_bad"
}
}
@@ -46,7 +46,7 @@ Item {
item.onLoaded()
}
//Logger.log("ControlCenterWidgetLoader", "Loaded", widgetId, "on screen", item.screen.name)
//Logger.i("ControlCenterWidgetLoader", "Loaded", widgetId, "on screen", item.screen.name)
}
Component.onDestruction: {
@@ -58,7 +58,7 @@ Item {
// Error handling
onWidgetIdChanged: {
if (widgetId && !ControlCenterWidgetRegistry.hasWidget(widgetId)) {
Logger.warn("ControlCenterWidgetLoader", "Widget not found in registry:", widgetId)
Logger.w("ControlCenterWidgetLoader", "Widget not found in registry:", widgetId)
}
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ NIconButtonHot {
}
return connected ? NetworkService.signalIcon(signalStrength) : "wifi-off"
} catch (error) {
Logger.error("Wi-Fi", "Error getting icon:", error)
Logger.e("Wi-Fi", "Error getting icon:", error)
return "signal_wifi_bad"
}
}
+2 -2
View File
@@ -121,7 +121,7 @@ PopupWindow {
function show(item, toplevelData) {
if (!item) {
Logger.warn("DockMenu", "anchorItem is undefined, won't show menu.")
Logger.w("DockMenu", "anchorItem is undefined, won't show menu.")
return
}
@@ -176,7 +176,7 @@ PopupWindow {
Qt.callLater(root.onAppClosed)
}
} else {
Logger.warn("DockMenu", "Cannot close app - invalid toplevel reference")
Logger.w("DockMenu", "Cannot close app - invalid toplevel reference")
}
root.hide()
root.requestClose()
+6 -6
View File
@@ -127,27 +127,27 @@ NPanel {
const appsPlugin = Qt.createComponent("Plugins/ApplicationsPlugin.qml").createObject(this)
if (appsPlugin) {
registerPlugin(appsPlugin)
Logger.log("Launcher", "Registered: ApplicationsPlugin")
Logger.d("Launcher", "Registered: ApplicationsPlugin")
} else {
Logger.error("Launcher", "Failed to load ApplicationsPlugin")
Logger.e("Launcher", "Failed to load ApplicationsPlugin")
}
// Load calculator plugin
const calcPlugin = Qt.createComponent("Plugins/CalculatorPlugin.qml").createObject(this)
if (calcPlugin) {
registerPlugin(calcPlugin)
Logger.log("Launcher", "Registered: CalculatorPlugin")
Logger.d("Launcher", "Registered: CalculatorPlugin")
} else {
Logger.error("Launcher", "Failed to load CalculatorPlugin")
Logger.e("Launcher", "Failed to load CalculatorPlugin")
}
// Load clipboard history plugin
const clipboardPlugin = Qt.createComponent("Plugins/ClipboardPlugin.qml").createObject(this)
if (clipboardPlugin) {
registerPlugin(clipboardPlugin)
Logger.log("Launcher", "Registered: ClipboardPlugin")
Logger.d("Launcher", "Registered: ClipboardPlugin")
} else {
Logger.error("Launcher", "Failed to load ClipboardPlugin")
Logger.e("Launcher", "Failed to load ClipboardPlugin")
}
}
@@ -54,7 +54,7 @@ Item {
function loadApplications() {
if (typeof DesktopEntries === 'undefined') {
Logger.warn("ApplicationsPlugin", "DesktopEntries service not available")
Logger.w("ApplicationsPlugin", "DesktopEntries service not available")
return
}
@@ -64,7 +64,7 @@ Item {
app.executableName = getExecutableName(app)
return app
})
Logger.log("ApplicationsPlugin", `Loaded ${entries.length} applications`)
Logger.d("ApplicationsPlugin", `Loaded ${entries.length} applications`)
}
function getExecutableName(app) {
@@ -198,12 +198,12 @@ Item {
// Ensures we are not preventing the future focusing of the app
launcher.close()
Logger.log("ApplicationsPlugin", `Launching: ${app.name}`)
Logger.d("ApplicationsPlugin", `Launching: ${app.name}`)
// Record usage and persist asynchronously
if (Settings.data.appLauncher.sortByMostUsed)
recordUsage(app)
if (Settings.data.appLauncher.useApp2Unit && app.id) {
Logger.log("ApplicationsPlugin", `Using app2unit for: ${app.id}`)
Logger.d("ApplicationsPlugin", `Using app2unit for: ${app.id}`)
if (app.runInTerminal)
Quickshell.execDetached(["app2unit", "--", app.id + ".desktop"])
else
@@ -212,7 +212,7 @@ Item {
// Fallback logic when app2unit is not used
if (app.runInTerminal) {
// If app.execute() fails for terminal apps, we handle it manually.
Logger.log("ApplicationsPlugin", "Executing terminal app manually: " + app.name)
Logger.d("ApplicationsPlugin", "Executing terminal app manually: " + app.name)
const terminal = Settings.data.appLauncher.terminalCommand.split(" ")
const command = terminal.concat(app.command)
Quickshell.execDetached(command)
@@ -220,7 +220,7 @@ Item {
// Default execution for GUI apps
app.execute()
} else {
Logger.log("ApplicationsPlugin", `Could not launch: ${app.name}. No valid launch method.`)
Logger.w("ApplicationsPlugin", `Could not launch: ${app.name}. No valid launch method.`)
}
}
}
+2 -2
View File
@@ -40,7 +40,7 @@ Item {
// Initialize plugin
function init() {
Logger.log("ClipboardPlugin", "Initialized")
Logger.i("ClipboardPlugin", "Initialized")
// Pre-load clipboard data if service is active
if (ClipboardService.active) {
ClipboardService.list(100)
@@ -189,7 +189,7 @@ Item {
})
}
//Logger.log("ClipboardPlugin", `Returning ${results.length} results for query: "${query}"`)
//Logger.i("ClipboardPlugin", `Returning ${results.length} results for query: "${query}"`)
return results
}
+9 -9
View File
@@ -33,7 +33,7 @@ Scope {
errorMessage = ""
showFailure = false
Logger.log("LockContext", "Starting PAM authentication for user:", pam.user)
Logger.i("LockContext", "Starting PAM authentication for user:", pam.user)
pam.start()
}
@@ -43,7 +43,7 @@ Scope {
user: Quickshell.env("USER")
onPamMessage: {
Logger.log("LockContext", "PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired)
Logger.i("LockContext", "PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired)
if (messageIsError) {
errorMessage = message
@@ -52,26 +52,26 @@ Scope {
}
if (responseRequired) {
Logger.log("LockContext", "Responding to PAM with password")
Logger.i("LockContext", "Responding to PAM with password")
respond(root.currentText)
}
}
onResponseRequiredChanged: {
Logger.log("LockContext", "Response required changed:", responseRequired)
Logger.i("LockContext", "Response required changed:", responseRequired)
if (responseRequired && root.unlockInProgress) {
Logger.log("LockContext", "Automatically responding to PAM")
Logger.i("LockContext", "Automatically responding to PAM")
respond(root.currentText)
}
}
onCompleted: result => {
Logger.log("LockContext", "PAM completed with result:", result)
Logger.i("LockContext", "PAM completed with result:", result)
if (result === PamResult.Success) {
Logger.log("LockContext", "Authentication successful")
Logger.i("LockContext", "Authentication successful")
root.unlocked()
} else {
Logger.log("LockContext", "Authentication failed")
Logger.i("LockContext", "Authentication failed")
errorMessage = "Authentication failed"
showFailure = true
root.failed()
@@ -80,7 +80,7 @@ Scope {
}
onError: {
Logger.log("LockContext", "PAM error:", error, "message:", message)
Logger.i("LockContext", "PAM error:", error, "message:", message)
errorMessage = message || "Authentication error"
showFailure = true
root.unlockInProgress = false
+3 -3
View File
@@ -344,14 +344,14 @@ ColumnLayout {
newArray.splice(toIndex, 0, item)
Settings.data.bar.widgets[section] = newArray
//Logger.log("BarTab", "Widget reordered. New array:", JSON.stringify(newArray))
//Logger.i("BarTab", "Widget reordered. New array:", JSON.stringify(newArray))
}
}
function _updateWidgetSettingsInSection(section, index, settings) {
// Update the widget settings in the Settings data
Settings.data.bar.widgets[section][index] = settings
//Logger.log("BarTab", `Updated widget settings for ${settings.id} in ${section} section`)
//Logger.i("BarTab", `Updated widget settings for ${settings.id} in ${section} section`)
}
function _moveWidgetBetweenSections(fromSection, index, toSection) {
@@ -369,7 +369,7 @@ ColumnLayout {
targetArray.push(widget)
Settings.data.bar.widgets[toSection] = targetArray
//Logger.log("BarTab", `Moved widget ${widget.id} from ${fromSection} to ${toSection}`)
//Logger.i("BarTab", `Moved widget ${widget.id} from ${fromSection} to ${toSection}`)
}
}
+2 -2
View File
@@ -139,7 +139,7 @@ ColumnLayout {
var jsonData = JSON.parse(text())
root.schemeLoaded(schemeName, jsonData)
} catch (e) {
Logger.warn("ColorSchemeTab", "Failed to parse JSON for scheme:", schemeName, e)
Logger.w("ColorSchemeTab", "Failed to parse JSON for scheme:", schemeName, e)
root.schemeLoaded(schemeName, null)
}
}
@@ -401,7 +401,7 @@ ColumnLayout {
cursorShape: Qt.PointingHandCursor
onClicked: {
Settings.data.colorSchemes.useWallpaperColors = false
Logger.log("ColorSchemeTab", "Disabled wallpaper colors")
Logger.i("ColorSchemeTab", "Disabled wallpaper colors")
Settings.data.colorSchemes.predefinedScheme = schemeItem.schemeName
ColorSchemeService.applyScheme(Settings.data.colorSchemes.predefinedScheme)
+3 -3
View File
@@ -180,7 +180,7 @@ ColumnLayout {
root.handleDragEnd()
}
onItemToggled: function (index, enabled) {
//Logger.log("ControlCenterTab", "Item", index, "toggled to", enabled)
//Logger.i("ControlCenterTab", "Item", index, "toggled to", enabled)
var newModel = cardsModel.slice()
newModel[index] = Object.assign({}, newModel[index], {
"enabled": enabled
@@ -189,7 +189,7 @@ ColumnLayout {
saveCards()
}
onItemsReordered: function (fromIndex, toIndex) {
//Logger.log("ControlCenterTab", "Item moved from", fromIndex, "to", toIndex)
//Logger.i("ControlCenterTab", "Item moved from", fromIndex, "to", toIndex)
var newModel = cardsModel.slice()
var item = newModel.splice(fromIndex, 1)[0]
newModel.splice(toIndex, 0, item)
@@ -324,7 +324,7 @@ ColumnLayout {
targetArray.push(widget)
Settings.data.controlCenter.shortcuts[toSection] = targetArray
//Logger.log("BarTab", `Moved widget ${widget.id} from ${fromSection} to ${toSection}`)
//Logger.i("BarTab", `Moved widget ${widget.id} from ${fromSection} to ${toSection}`)
}
}
+2 -2
View File
@@ -36,13 +36,13 @@ ColumnLayout {
var value = jsonData || {}
schemeColorsCache[schemeName] = value
cacheVersion++
Logger.log("SetupAppearanceStep", `Loaded scheme ${schemeName}`)
Logger.i("SetupAppearanceStep", `Loaded scheme ${schemeName}`)
}
Connections {
target: ColorSchemeService
function onSchemesChanged() {
Logger.log("SetupAppearanceStep", `Color schemes changed: ${ColorSchemeService.schemes.length}`)
Logger.i("SetupAppearanceStep", `Color schemes changed: ${ColorSchemeService.schemes.length}`)
schemeColorsCache = {}
cacheVersion++
}
+3 -3
View File
@@ -363,7 +363,7 @@ NPanel {
}
function completeSetup() {
Logger.log("SetupWizard", "Completing setup with selected options")
Logger.i("SetupWizard", "Completing setup with selected options")
if (selectedWallpaperDirectory !== Settings.data.wallpaper.directory) {
Settings.data.wallpaper.directory = selectedWallpaperDirectory
@@ -380,7 +380,7 @@ NPanel {
Settings.data.setupCompleted = true
Settings.saveImmediate()
Logger.log("SetupWizard", "Setup completed successfully")
Logger.i("SetupWizard", "Setup completed successfully")
root.close()
}
@@ -402,7 +402,7 @@ NPanel {
}
Component.onCompleted: {
Logger.log("SetupWizard", "Setup wizard opened")
Logger.i("SetupWizard", "Setup wizard opened")
// Initialize selections from existing settings to avoid overwriting user config
if (Settings && Settings.data) {
selectedScaleRatio = Settings.data.general.scaleRatio
+2 -2
View File
@@ -44,11 +44,11 @@ Item {
function enqueueToast(toastData) {
// Safe logging - fix the substring bug
var descPreview = (toastData.description || "").substring(0, 100).replace(/\n/g, " ")
Logger.log("ToastScreen", "Queuing", toastData.type, ":", toastData.message, descPreview)
Logger.i("ToastScreen", "Queuing", toastData.type, ":", toastData.message, descPreview)
// Bounded queue to prevent unbounded memory growth
if (messageQueue.length >= maxQueueSize) {
Logger.log("ToastScreen", "Queue full, dropping oldest toast")
Logger.i("ToastScreen", "Queue full, dropping oldest toast")
messageQueue.shift()
}