From 8a16b6b7f567416668ee51c18864a0306a9588fb Mon Sep 17 00:00:00 2001 From: quadbyte Date: Tue, 12 Aug 2025 12:07:51 -0400 Subject: [PATCH 1/2] Formatting --- Modules/Background/Background.qml | 5 +- Modules/Background/Overview.qml | 3 +- Modules/Settings/SettingsWindow.qml | 6 +- Modules/Settings/Tabs/Display.qml | 2 +- Modules/Settings/Tabs/ScreenRecorder.qml | 2 +- Services/Settings.qml | 12 +- Services/Wallpapers.qml | 12 +- Services/Workspaces.qml | 277 ++++++++++++----------- 8 files changed, 163 insertions(+), 156 deletions(-) diff --git a/Modules/Background/Background.qml b/Modules/Background/Background.qml index 20752c9..4e2175e 100644 --- a/Modules/Background/Background.qml +++ b/Modules/Background/Background.qml @@ -8,10 +8,11 @@ Variants { delegate: PanelWindow { required property ShellScreen modelData - property string wallpaperSource: Wallpapers.currentWallpaper !== "" && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" + property string wallpaperSource: Wallpapers.currentWallpaper !== "" + && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled - + // Force update when SWWW setting changes onVisibleChanged: { if (visible) { diff --git a/Modules/Background/Overview.qml b/Modules/Background/Overview.qml index d2a7aad..1f64f7c 100644 --- a/Modules/Background/Overview.qml +++ b/Modules/Background/Overview.qml @@ -9,7 +9,8 @@ Variants { delegate: PanelWindow { required property ShellScreen modelData - property string wallpaperSource: Wallpapers.currentWallpaper !== "" && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" + property string wallpaperSource: Wallpapers.currentWallpaper !== "" + && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled color: "transparent" diff --git a/Modules/Settings/SettingsWindow.qml b/Modules/Settings/SettingsWindow.qml index c05e32b..cae584f 100644 --- a/Modules/Settings/SettingsWindow.qml +++ b/Modules/Settings/SettingsWindow.qml @@ -46,13 +46,11 @@ NLoader { "label": "Wallpaper", "icon": "image", "source": "Tabs/Wallpaper.qml" - }, - { + }, { "label": "Wallpaper Selector", "icon": "wallpaper_slideshow", "source": "Tabs/WallpaperSelector.qml" - }, - { + }, { "label": "Misc", "icon": "more_horiz", "source": "Tabs/Misc.qml" diff --git a/Modules/Settings/Tabs/Display.qml b/Modules/Settings/Tabs/Display.qml index 86dea3d..ea587d7 100644 --- a/Modules/Settings/Tabs/Display.qml +++ b/Modules/Settings/Tabs/Display.qml @@ -116,4 +116,4 @@ Item { Layout.fillHeight: true } } -} \ No newline at end of file +} diff --git a/Modules/Settings/Tabs/ScreenRecorder.qml b/Modules/Settings/Tabs/ScreenRecorder.qml index d102ce9..286908f 100644 --- a/Modules/Settings/Tabs/ScreenRecorder.qml +++ b/Modules/Settings/Tabs/ScreenRecorder.qml @@ -324,4 +324,4 @@ ColumnLayout { } } } -} \ No newline at end of file +} diff --git a/Services/Settings.qml b/Services/Settings.qml index 7e7b0b4..9420b82 100644 --- a/Services/Settings.qml +++ b/Services/Settings.qml @@ -188,8 +188,14 @@ Singleton { Connections { target: adapter.wallpaper - function onIsRandomChanged() { Wallpapers.toggleRandomWallpaper() } - function onRandomIntervalChanged() { Wallpapers.restartRandomWallpaperTimer() } - function onDirectoryChanged() { Wallpapers.loadWallpapers() } + function onIsRandomChanged() { + Wallpapers.toggleRandomWallpaper() + } + function onRandomIntervalChanged() { + Wallpapers.restartRandomWallpaperTimer() + } + function onDirectoryChanged() { + Wallpapers.loadWallpapers() + } } } diff --git a/Services/Wallpapers.qml b/Services/Wallpapers.qml index e586a09..f087da4 100644 --- a/Services/Wallpapers.qml +++ b/Services/Wallpapers.qml @@ -138,12 +138,12 @@ Singleton { ), "--transition-type", transitionType, "--transition-duration", Settings.data.wallpaper.swww.transitionDuration.toString( ), currentWallpaper] running: false - + onStarted: { console.log("SWWW: Process started with command:", command.join(" ")) } - - onExited: function(exitCode, exitStatus) { + + 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") @@ -163,12 +163,12 @@ Singleton { id: startDaemonProcess command: ["swww-daemon", "--format", "xrgb"] running: false - + onStarted: { console.log("SWWW: Daemon start process initiated") } - - onExited: function(exitCode, exitStatus) { + + onExited: function (exitCode, exitStatus) { console.log("SWWW: Daemon start process finished with exit code:", exitCode) if (exitCode === 0) { console.log("SWWW: Daemon started successfully") diff --git a/Services/Workspaces.qml b/Services/Workspaces.qml index 9bedc6b..b73713d 100644 --- a/Services/Workspaces.qml +++ b/Services/Workspaces.qml @@ -1,5 +1,6 @@ pragma Singleton -pragma ComponentBehavior: Bound + +pragma ComponentBehavior import QtQuick import Quickshell @@ -8,149 +9,149 @@ import Quickshell.Hyprland import qs.Services Singleton { - id: root + id: root - property ListModel workspaces: ListModel {} - property bool isHyprland: false - property bool isNiri: false - property var hlWorkspaces: Hyprland.workspaces.values - // Detect which compositor we're using - Component.onCompleted: { - console.log("WorkspaceManager initializing..."); - detectCompositor(); - } + property ListModel workspaces: ListModel {} + property bool isHyprland: false + property bool isNiri: false + property var hlWorkspaces: Hyprland.workspaces.values + // Detect which compositor we're using + Component.onCompleted: { + console.log("WorkspaceManager initializing...") + detectCompositor() + } - function detectCompositor() { - try { - try { - if (Hyprland.eventSocketPath) { - console.log("Detected Hyprland compositor"); - isHyprland = true; - isNiri = false; - initHyprland(); - return; - } - } catch (e) { - console.log("Hyprland not available:", e); - } - - if (typeof Niri !== "undefined") { - console.log("Detected Niri service"); - isHyprland = false; - isNiri = true; - initNiri(); - return; - } - - console.log("No supported compositor detected"); - } catch (e) { - console.error("Error detecting compositor:", e); + function detectCompositor() { + try { + try { + if (Hyprland.eventSocketPath) { + console.log("Detected Hyprland compositor") + isHyprland = true + isNiri = false + initHyprland() + return } - } + } catch (e) { + console.log("Hyprland not available:", e) + } - // Initialize Hyprland integration - function initHyprland() { - try { - // Fixes the odd workspace issue. - Hyprland.refreshWorkspaces(); - // hlWorkspaces = Hyprland.workspaces.values; - // updateHyprlandWorkspaces(); - return true; - } catch (e) { - console.error("Error initializing Hyprland:", e); - isHyprland = false; - return false; + if (typeof Niri !== "undefined") { + console.log("Detected Niri service") + isHyprland = false + isNiri = true + initNiri() + return + } + + console.log("No supported compositor detected") + } catch (e) { + console.error("Error detecting compositor:", e) + } + } + + // Initialize Hyprland integration + function initHyprland() { + try { + // Fixes the odd workspace issue. + Hyprland.refreshWorkspaces() + // hlWorkspaces = Hyprland.workspaces.values; + // updateHyprlandWorkspaces(); + return true + } catch (e) { + console.error("Error initializing Hyprland:", e) + isHyprland = false + return false + } + } + + onHlWorkspacesChanged: { + updateHyprlandWorkspaces() + } + + Connections { + target: Hyprland.workspaces + function onValuesChanged() { + updateHyprlandWorkspaces() + } + } + + Connections { + target: Hyprland + function onRawEvent(event) { + updateHyprlandWorkspaces() + } + } + + function updateHyprlandWorkspaces() { + workspaces.clear() + try { + for (var i = 0; i < hlWorkspaces.length; i++) { + const ws = hlWorkspaces[i] + // Only append workspaces with id >= 1 + if (ws.id >= 1) { + workspaces.append({ + "id": i, + "idx": ws.id, + "name": ws.name || "", + "output": ws.monitor?.name || "", + "isActive": ws.active === true, + "isFocused": ws.focused === true, + "isUrgent": ws.urgent === true + }) } + } + workspacesChanged() + } catch (e) { + console.error("Error updating Hyprland workspaces:", e) + } + } + + function initNiri() { + updateNiriWorkspaces() + } + + Connections { + target: Niri + function onWorkspacesChanged() { + updateNiriWorkspaces() + } + } + + function updateNiriWorkspaces() { + const niriWorkspaces = Niri.workspaces || [] + workspaces.clear() + for (var i = 0; i < niriWorkspaces.length; i++) { + const ws = niriWorkspaces[i] + workspaces.append({ + "id": ws.id, + "idx": ws.idx || 1, + "name": ws.name || "", + "output": ws.output || "", + "isFocused": ws.isFocused === true, + "isActive": ws.isActive === true, + "isUrgent": ws.isUrgent === true, + "isOccupied": ws.isOccupied === true + }) } - onHlWorkspacesChanged: { - updateHyprlandWorkspaces(); - } + workspacesChanged() + } - Connections { - target: Hyprland.workspaces - function onValuesChanged() { - updateHyprlandWorkspaces(); - } + function switchToWorkspace(workspaceId) { + if (isHyprland) { + try { + Hyprland.dispatch(`workspace ${workspaceId}`) + } catch (e) { + console.error("Error switching Hyprland workspace:", e) + } + } else if (isNiri) { + try { + Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()]) + } catch (e) { + console.error("Error switching Niri workspace:", e) + } + } else { + console.warn("No supported compositor detected for workspace switching") } - - Connections { - target: Hyprland - function onRawEvent(event) { - updateHyprlandWorkspaces(); - } - } - - function updateHyprlandWorkspaces() { - workspaces.clear(); - try { - for (let i = 0; i < hlWorkspaces.length; i++) { - const ws = hlWorkspaces[i]; - // Only append workspaces with id >= 1 - if (ws.id >= 1) { - workspaces.append({ - id: i, - idx: ws.id, - name: ws.name || "", - output: ws.monitor?.name || "", - isActive: ws.active === true, - isFocused: ws.focused === true, - isUrgent: ws.urgent === true - }); - } - } - workspacesChanged(); - } catch (e) { - console.error("Error updating Hyprland workspaces:", e); - } - } - - function initNiri() { - updateNiriWorkspaces(); - } - - Connections { - target: Niri - function onWorkspacesChanged() { - updateNiriWorkspaces(); - } - } - - function updateNiriWorkspaces() { - const niriWorkspaces = Niri.workspaces || []; - workspaces.clear(); - for (let i = 0; i < niriWorkspaces.length; i++) { - const ws = niriWorkspaces[i]; - workspaces.append({ - id: ws.id, - idx: ws.idx || 1, - name: ws.name || "", - output: ws.output || "", - isFocused: ws.isFocused === true, - isActive: ws.isActive === true, - isUrgent: ws.isUrgent === true, - isOccupied: ws.isOccupied === true, - }); - } - - workspacesChanged(); - } - - function switchToWorkspace(workspaceId) { - if (isHyprland) { - try { - Hyprland.dispatch(`workspace ${workspaceId}`); - } catch (e) { - console.error("Error switching Hyprland workspace:", e); - } - } else if (isNiri) { - try { - Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()]); - } catch (e) { - console.error("Error switching Niri workspace:", e); - } - } else { - console.warn("No supported compositor detected for workspace switching"); - } - } -} \ No newline at end of file + } +} From a7d4e0ec1d1d2ce252491336c0daf19e4683ca93 Mon Sep 17 00:00:00 2001 From: quadbyte Date: Tue, 12 Aug 2025 13:22:15 -0400 Subject: [PATCH 2/2] Replaced all NWidgets callback by proper signals --- Modules/Bar/Bar.qml | 4 +-- Modules/Bar/Clock.qml | 6 ++--- Modules/Bar/Volume.qml | 2 +- Modules/Bar/WiFi.qml | 2 +- Modules/Bar/WiFiMenu.qml | 4 +-- Modules/Calendar/Calendar.qml | 4 +-- Modules/DemoPanel/DemoPanel.qml | 9 ++++--- Modules/Notification/Notification.qml | 2 +- Modules/Settings/SettingsWindow.qml | 4 +-- Modules/Settings/Tabs/General.qml | 2 +- Modules/Settings/Tabs/ScreenRecorder.qml | 2 +- Modules/Settings/Tabs/TimeWeather.qml | 2 +- Modules/Settings/Tabs/Wallpaper.qml | 2 +- Modules/Settings/Tabs/WallpaperSelector.qml | 19 +++++++------- Modules/SidePanel/Cards/PowerProfilesCard.qml | 12 ++++++--- Modules/SidePanel/Cards/ProfileCard.qml | 2 +- Services/Github.qml | 4 +-- Services/Location.qml | 2 +- Services/Settings.qml | 4 +-- Widgets/NClock.qml | 13 +++++----- Widgets/NComboBox.qml | 5 ++-- Widgets/NIconButton.qml | 13 +++++----- Widgets/NPanel.qml | 17 ++++++------ Widgets/NPill.qml | 26 +++++++++---------- Widgets/NSlider.qml | 9 +------ Widgets/NTextInput.qml | 5 ++-- Widgets/NToggle.qml | 5 ++-- 27 files changed, 93 insertions(+), 88 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 4db35a7..9ad9815 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -109,7 +109,7 @@ Variants { sizeMultiplier: 0.8 showBorder: false anchors.verticalCenter: parent.verticalCenter - onClicked: function () { + onClicked: { demoPanel.isLoaded = !demoPanel.isLoaded } } @@ -121,7 +121,7 @@ Variants { sizeMultiplier: 0.8 showBorder: false anchors.verticalCenter: parent.verticalCenter - onClicked: function () { + onClicked: { // Map this button's center to the screen and open the side panel below it const localCenterX = width / 2 const localCenterY = height / 2 diff --git a/Modules/Bar/Clock.qml b/Modules/Bar/Clock.qml index 6e05d79..19d25e8 100644 --- a/Modules/Bar/Clock.qml +++ b/Modules/Bar/Clock.qml @@ -12,15 +12,15 @@ NClock { target: root } - onEntered: function () { + onEntered: { if (!calendar.isLoaded) { tooltip.show() } } - onExited: function () { + onExited: { tooltip.hide() } - onClicked: function () { + onClicked: { tooltip.hide() calendar.isLoaded = !calendar.isLoaded } diff --git a/Modules/Bar/Volume.qml b/Modules/Bar/Volume.qml index f8f69d7..ee7b690 100644 --- a/Modules/Bar/Volume.qml +++ b/Modules/Bar/Volume.qml @@ -70,7 +70,7 @@ Item { Audio.volumeDecrement() } } - onClicked: function () { + onClicked: { audioDeviceSelector.isLoaded = !audioDeviceSelector.isLoaded } } diff --git a/Modules/Bar/WiFi.qml b/Modules/Bar/WiFi.qml index 059736f..f494a76 100644 --- a/Modules/Bar/WiFi.qml +++ b/Modules/Bar/WiFi.qml @@ -24,7 +24,7 @@ NIconButton { return connected ? network.signalIcon(parent.currentSignal) : "wifi_off" } tooltipText: "WiFi Networks" - onClicked: function () { + onClicked: { if (!wifiMenuLoader.active) { wifiMenuLoader.isLoaded = true } diff --git a/Modules/Bar/WiFiMenu.qml b/Modules/Bar/WiFiMenu.qml index dad6c9d..6431007 100644 --- a/Modules/Bar/WiFiMenu.qml +++ b/Modules/Bar/WiFiMenu.qml @@ -78,7 +78,7 @@ NLoader { NIconButton { icon: "refresh" sizeMultiplier: 0.8 - onClicked: function () { + onClicked: { network.refreshNetworks() } } @@ -86,7 +86,7 @@ NLoader { NIconButton { icon: "close" sizeMultiplier: 0.8 - onClicked: function () { + onClicked: { wifiPanel.visible = false network.onMenuClosed() } diff --git a/Modules/Calendar/Calendar.qml b/Modules/Calendar/Calendar.qml index ad05d47..fba498f 100644 --- a/Modules/Calendar/Calendar.qml +++ b/Modules/Calendar/Calendar.qml @@ -47,7 +47,7 @@ NLoader { NIconButton { icon: "chevron_left" - onClicked: function () { + onClicked: { let newDate = new Date(grid.year, grid.month - 1, 1) grid.year = newDate.getFullYear() grid.month = newDate.getMonth() @@ -65,7 +65,7 @@ NLoader { NIconButton { icon: "chevron_right" - onClicked: function () { + onClicked: { let newDate = new Date(grid.year, grid.month + 1, 1) grid.year = newDate.getFullYear() grid.month = newDate.getMonth() diff --git a/Modules/DemoPanel/DemoPanel.qml b/Modules/DemoPanel/DemoPanel.qml index 634ebda..0d37f4e 100644 --- a/Modules/DemoPanel/DemoPanel.qml +++ b/Modules/DemoPanel/DemoPanel.qml @@ -73,17 +73,17 @@ NLoader { stepSize: 0.01 value: Scaling.overrideScale implicitWidth: bgRect.width * 0.75 - onMoved: function () { + onMoved: { Scaling.overrideScale = value } - onPressedChanged: function () { + onPressedChanged: { Scaling.overrideEnabled = true } } NIconButton { icon: "refresh" fontPointSize: Style.fontSizeXL * scaling - onClicked: function () { + onClicked: { Scaling.overrideEnabled = false Scaling.overrideScale = 1.0 } @@ -171,8 +171,9 @@ NLoader { NTextInput { text: "Type anything" Layout.fillWidth: true - onEditingFinished: function () {} + onEditingFinished: { + } NDivider { Layout.fillWidth: true } diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 7adaf9c..40a3cff 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -191,7 +191,7 @@ PanelWindow { anchors.right: parent.right anchors.margins: Style.marginSmall * scaling icon: "close" - onClicked: function () { + onClicked: { animateOut() } } diff --git a/Modules/Settings/SettingsWindow.qml b/Modules/Settings/SettingsWindow.qml index cae584f..ca8a4da 100644 --- a/Modules/Settings/SettingsWindow.qml +++ b/Modules/Settings/SettingsWindow.qml @@ -60,7 +60,7 @@ NLoader { "source": "Tabs/About.qml" }] - onVisibleChanged: function () { + onVisibleChanged: { if (visible) currentTabIndex = 0 } @@ -188,7 +188,7 @@ NLoader { icon: "close" tooltipText: "Close settings panel" Layout.alignment: Qt.AlignVCenter - onClicked: function () { + onClicked: { settingsWindow.isLoaded = !settingsWindow.isLoaded } } diff --git a/Modules/Settings/Tabs/General.qml b/Modules/Settings/Tabs/General.qml index 2d71032..9e4e08f 100644 --- a/Modules/Settings/Tabs/General.qml +++ b/Modules/Settings/Tabs/General.qml @@ -84,7 +84,7 @@ ColumnLayout { text: Settings.data.general.avatarImage placeholderText: "/home/user/.face" Layout.fillWidth: true - onEditingFinished: function () { + onEditingFinished: { Settings.data.general.avatarImage = text } } diff --git a/Modules/Settings/Tabs/ScreenRecorder.qml b/Modules/Settings/Tabs/ScreenRecorder.qml index 286908f..6376087 100644 --- a/Modules/Settings/Tabs/ScreenRecorder.qml +++ b/Modules/Settings/Tabs/ScreenRecorder.qml @@ -65,7 +65,7 @@ ColumnLayout { NTextInput { text: Settings.data.screenRecorder.directory Layout.fillWidth: true - onEditingFinished: function () { + onEditingFinished: { Settings.data.screenRecorder.directory = text } } diff --git a/Modules/Settings/Tabs/TimeWeather.qml b/Modules/Settings/Tabs/TimeWeather.qml index a5f1b1f..f8d43d7 100644 --- a/Modules/Settings/Tabs/TimeWeather.qml +++ b/Modules/Settings/Tabs/TimeWeather.qml @@ -58,7 +58,7 @@ ColumnLayout { text: Settings.data.location.name placeholderText: "Enter city name" Layout.fillWidth: true - onEditingFinished: function () { + onEditingFinished: { Settings.data.location.name = text } } diff --git a/Modules/Settings/Tabs/Wallpaper.qml b/Modules/Settings/Tabs/Wallpaper.qml index 430b636..609efe6 100644 --- a/Modules/Settings/Tabs/Wallpaper.qml +++ b/Modules/Settings/Tabs/Wallpaper.qml @@ -70,7 +70,7 @@ ColumnLayout { NTextInput { text: Settings.data.wallpaper.directory Layout.fillWidth: true - onEditingFinished: function () { + onEditingFinished: { Settings.data.wallpaper.directory = text } } diff --git a/Modules/Settings/Tabs/WallpaperSelector.qml b/Modules/Settings/Tabs/WallpaperSelector.qml index 281887d..2f743d0 100644 --- a/Modules/Settings/Tabs/WallpaperSelector.qml +++ b/Modules/Settings/Tabs/WallpaperSelector.qml @@ -83,9 +83,8 @@ Item { } NText { - text: Settings.data.wallpaper.swww.enabled ? - "Wallpapers will change with " + Settings.data.wallpaper.swww.transitionType + " transition" : - "Wallpapers will change instantly" + text: Settings.data.wallpaper.swww.enabled ? "Wallpapers will change with " + Settings.data.wallpaper.swww.transitionType + + " transition" : "Wallpapers will change instantly" color: Colors.textSecondary font.pointSize: Style.fontSizeSmall * scaling visible: Settings.data.wallpaper.swww.enabled @@ -128,13 +127,13 @@ Item { anchors.fill: parent clip: true model: folderModel - + // Fixed 5 items per row - more aggressive sizing property int itemSize: Math.floor((width - leftMargin - rightMargin - (4 * Style.marginSmall * scaling)) / 5) - + cellWidth: Math.floor((width - leftMargin - rightMargin) / 5) cellHeight: Math.floor(itemSize * 0.67) + Style.marginSmall * scaling - + leftMargin: Style.marginSmall * scaling rightMargin: Style.marginSmall * scaling topMargin: Style.marginSmall * scaling @@ -191,9 +190,11 @@ Item { color: Colors.textPrimary opacity: mouseArea.containsMouse ? 0.1 : 0 radius: parent.radius - + Behavior on opacity { - NumberAnimation { duration: 150 } + NumberAnimation { + duration: 150 + } } } @@ -249,4 +250,4 @@ Item { } } } -} \ No newline at end of file +} diff --git a/Modules/SidePanel/Cards/PowerProfilesCard.qml b/Modules/SidePanel/Cards/PowerProfilesCard.qml index 6fd612d..6b74b24 100644 --- a/Modules/SidePanel/Cards/PowerProfilesCard.qml +++ b/Modules/SidePanel/Cards/PowerProfilesCard.qml @@ -21,17 +21,23 @@ NBox { // Performance NIconButton { icon: "speed" - onClicked: function () {/* TODO: hook to power profile */ } + onClicked: { + + /* TODO: hook to power profile */ } } // Balanced NIconButton { icon: "balance" - onClicked: function () {/* TODO: hook to power profile */ } + onClicked: { + + /* TODO: hook to power profile */ } } // Eco NIconButton { icon: "eco" - onClicked: function () {/* TODO: hook to power profile */ } + onClicked: { + + /* TODO: hook to power profile */ } } Item { Layout.fillWidth: true diff --git a/Modules/SidePanel/Cards/ProfileCard.qml b/Modules/SidePanel/Cards/ProfileCard.qml index 9d7f638..ac9041a 100644 --- a/Modules/SidePanel/Cards/ProfileCard.qml +++ b/Modules/SidePanel/Cards/ProfileCard.qml @@ -59,7 +59,7 @@ NBox { } NIconButton { icon: "settings" - onClicked: function () { + onClicked: { if (!root.settingsWindow) { const comp = Qt.createComponent("../../Settings/SettingsWindow.qml") if (comp.status === Component.Ready) { diff --git a/Services/Github.qml b/Services/Github.qml index a1409a6..8a4bc1e 100644 --- a/Services/Github.qml +++ b/Services/Github.qml @@ -23,10 +23,10 @@ Singleton { watchChanges: true onFileChanged: reload() onAdapterUpdated: writeAdapter() - Component.onCompleted: function () { + Component.onCompleted: { reload() } - onLoaded: function () { + onLoaded: { loadFromCache() } onLoadFailed: function (error) { diff --git a/Services/Location.qml b/Services/Location.qml index 1c6e3cd..70587b4 100644 --- a/Services/Location.qml +++ b/Services/Location.qml @@ -16,7 +16,7 @@ Singleton { FileView { path: locationFile onAdapterUpdated: writeAdapter() - onLoaded: function () { + onLoaded: { updateWeather() } onLoadFailed: function (error) { diff --git a/Services/Settings.qml b/Services/Settings.qml index 9420b82..e85f471 100644 --- a/Services/Settings.qml +++ b/Services/Settings.qml @@ -47,10 +47,10 @@ Singleton { watchChanges: true onFileChanged: reload() onAdapterUpdated: writeAdapter() - Component.onCompleted: function () { + Component.onCompleted: { reload() } - onLoaded: function () { + onLoaded: { Qt.callLater(function () { if (adapter.wallpaper.current !== "") { console.log("Settings: Initializing wallpaper to:", adapter.wallpaper.current) diff --git a/Widgets/NClock.qml b/Widgets/NClock.qml index e1c4bd8..c249c01 100644 --- a/Widgets/NClock.qml +++ b/Widgets/NClock.qml @@ -6,9 +6,10 @@ Rectangle { id: root readonly property real scaling: Scaling.scale(screen) - property var onEntered: function () {} - property var onExited: function () {} - property var onClicked: function () {} + + signal entered + signal exited + signal clicked width: textItem.paintedWidth height: textItem.paintedHeight @@ -26,8 +27,8 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor hoverEnabled: true - onEntered: root.onEntered() - onExited: root.onExited() - onClicked: root.onClicked() + onEntered: root.entered() + onExited: root.exited() + onClicked: root.clicked() } } diff --git a/Widgets/NComboBox.qml b/Widgets/NComboBox.qml index 0eba662..0b27fa6 100644 --- a/Widgets/NComboBox.qml +++ b/Widgets/NComboBox.qml @@ -13,7 +13,8 @@ ComboBox { property list optionsKeys: [] property list optionsLabels: [] property string currentKey: '' - property var onSelected: function (string) {} + + signal selected(string key) Layout.fillWidth: true Layout.preferredHeight: height @@ -21,7 +22,7 @@ ComboBox { model: optionsKeys currentIndex: model.indexOf(currentKey) onActivated: { - root.onSelected(model[currentIndex]) + root.selected(model[currentIndex]) } // Rounded background diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index 04de320..b42f2ec 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -15,12 +15,13 @@ Rectangle { property bool showBorder: true property bool enabled: true property bool hovering: false - property var onEntered: function () {} - property var onExited: function () {} - property var onClicked: function () {} property real fontPointSize: Style.fontSizeMedium property string fontFamily: "Material Symbols Outlined" + signal entered + signal exited + signal clicked + implicitWidth: size implicitHeight: size @@ -62,20 +63,20 @@ Rectangle { if (tooltipText) { tooltip.show() } - root.onEntered() + root.entered() } onExited: { hovering = false if (tooltipText) { tooltip.hide() } - root.onExited() + root.exited() } onClicked: { if (tooltipText) { tooltip.hide() } - root.onClicked() + root.clicked() } } } diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index f0613f5..704defc 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -4,26 +4,27 @@ import Quickshell.Wayland import qs.Services PanelWindow { - id: outerPanel + id: root readonly property real scaling: Scaling.scale(screen) property bool showOverlay: Settings.data.general.dimDesktop property int topMargin: Style.barHeight * scaling property color overlayColor: showOverlay ? Colors.overlay : "transparent" + signal dismissed function hide() { //visible = false - dismissed() + root.dismissed() } function show() { // Ensure only one panel is visible at a time using Settings as ephemeral store try { - if (Settings.openPanel && Settings.openPanel !== outerPanel && Settings.openPanel.hide) { + if (Settings.openPanel && Settings.openPanel !== root && Settings.openPanel.hide) { Settings.openPanel.hide() } - Settings.openPanel = outerPanel + Settings.openPanel = root } catch (e) { // ignore @@ -45,7 +46,7 @@ PanelWindow { MouseArea { anchors.fill: parent - onClicked: outerPanel.hide() + onClicked: root.hide() } Behavior on color { @@ -57,16 +58,16 @@ PanelWindow { Component.onDestruction: { try { - if (visible && Settings.openPanel === outerPanel) + if (visible && Settings.openPanel === root) Settings.openPanel = null } catch (e) { } } - onVisibleChanged: function () { + onVisibleChanged: { try { - if (!visible && Settings.openPanel === outerPanel) + if (!visible && Settings.openPanel === root) Settings.openPanel = null } catch (e) { diff --git a/Widgets/NPill.qml b/Widgets/NPill.qml index 3a6ac0e..05c3a3e 100644 --- a/Widgets/NPill.qml +++ b/Widgets/NPill.qml @@ -18,10 +18,12 @@ Item { property real sizeMultiplier: 0.8 property bool autoHide: false - property var onEntered: function () {} - property var onExited: function () {} - property var onClicked: function () {} - property var onWheel: function (delta) {} + signal shown + signal hidden + signal entered + signal exited + signal clicked + signal wheel(int delta) // Internal state property bool showPill: false @@ -34,10 +36,6 @@ Item { readonly property int pillOverlap: iconSize * 0.5 readonly property int maxPillWidth: Math.max(1, textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap) - // TBC, do we use those ? - signal shown - signal hidden - width: iconSize + (showPill ? maxPillWidth - pillOverlap : 0) height: pillHeight @@ -127,7 +125,7 @@ Item { } onStopped: { delayedHideAnim.start() - shown() + root.shown() } } @@ -166,7 +164,7 @@ Item { onStopped: { showPill = false shouldAnimateHide = false - hidden() + root.hidden() } } @@ -194,18 +192,18 @@ Item { onEntered: { showDelayed() tooltip.show() - root.onEntered() + root.entered() } onExited: { hide() tooltip.hide() - root.onExited() + root.exited() } onClicked: { - root.onClicked() + root.clicked() } onWheel: wheel => { - root.onWheel(wheel.angleDelta.y) + root.wheel(wheel.angleDelta.y) } } diff --git a/Widgets/NSlider.qml b/Widgets/NSlider.qml index 3afc394..2e9e6d1 100644 --- a/Widgets/NSlider.qml +++ b/Widgets/NSlider.qml @@ -35,14 +35,6 @@ Slider { height: parent.height color: Colors.accentPrimary radius: parent.radius - - // Feels more responsive without animation - // Behavior on width { - // NumberAnimation { - // duration: 50 - // easing.type: Easing.OutQuad - // } - // } } // Circular cutout @@ -84,6 +76,7 @@ Slider { color: root.pressed ? Colors.surfaceVariant : Colors.surface border.color: Colors.accentPrimary border.width: Math.max(1, Style.borderThick * scaling) + // Press feedback halo (using accent color, low opacity) Rectangle { anchors.centerIn: parent diff --git a/Widgets/NTextInput.qml b/Widgets/NTextInput.qml index b2e00bf..cceadcf 100644 --- a/Widgets/NTextInput.qml +++ b/Widgets/NTextInput.qml @@ -13,7 +13,8 @@ Item { property alias placeholderText: input.placeholderText property bool readOnly: false property bool enabled: true - property var onEditingFinished: function () {} + + signal editingFinished // Sizing implicitHeight: Style.baseWidgetSize * 1.25 * scaling @@ -55,7 +56,7 @@ Item { placeholderTextColor: Colors.textSecondary background: null font.pointSize: Style.fontSizeSmall * scaling - onEditingFinished: root.onEditingFinished() + onEditingFinished: root.editingFinished() // Text changes are observable via the aliased 'text' property (root.text) and its 'textChanged' signal. // No additional callback is invoked here to avoid conflicts with QML's onTextChanged handler semantics. } diff --git a/Widgets/NToggle.qml b/Widgets/NToggle.qml index 5150cd2..55d4e2e 100644 --- a/Widgets/NToggle.qml +++ b/Widgets/NToggle.qml @@ -12,7 +12,8 @@ RowLayout { property bool value: false property bool hovering: false property int baseSize: Style.baseWidgetSize - property var onToggled: function (value) {} + + signal toggled(bool balue) Layout.fillWidth: true @@ -72,7 +73,7 @@ RowLayout { onExited: hovering = false onClicked: { value = !value - root.onToggled(value) + root.toggled(value) } } }