From 0498c2f3cb5832b5a23612a4fd301d69d1b3c0d6 Mon Sep 17 00:00:00 2001 From: Amaro Lopes Date: Tue, 14 Oct 2025 00:56:52 -0300 Subject: [PATCH] Fix some styling, make some components bound --- Common/CalendarComponent.qml | 6 +++++- Common/NotificationWrapper.qml | 9 +++++---- Common/Settings.qml | 5 +---- NotificationsWidget.qml | 2 ++ Services/HyprlandService.qml | 18 ++++++++---------- Services/NotificationService.qml | 5 ++--- Widgets/WindowSwitcher.qml | 7 +++---- Workspaces.qml | 1 - 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Common/CalendarComponent.qml b/Common/CalendarComponent.qml index 527cec3..1ee73cb 100644 --- a/Common/CalendarComponent.qml +++ b/Common/CalendarComponent.qml @@ -1,4 +1,5 @@ -// CalendarComponent.qml (For one month) +pragma ComponentBehavior: Bound + import QtQuick import qs.Common import qs.Common.Styled @@ -74,6 +75,8 @@ Item { Repeater { model: root.getLocalizedDayHeaders() StyledText { + required property var modelData + text: modelData horizontalAlignment: Text.AlignHCenter width: 18 @@ -84,6 +87,7 @@ Item { Repeater { model: root.layoutData.days StyledText { + required property var modelData text: modelData horizontalAlignment: Text.AlignHCenter width: 18 diff --git a/Common/NotificationWrapper.qml b/Common/NotificationWrapper.qml index 6d42f1b..f5433ff 100644 --- a/Common/NotificationWrapper.qml +++ b/Common/NotificationWrapper.qml @@ -33,7 +33,9 @@ BackgroundRectangle { height: collapsed ? 0 : contentHeight - Component.onCompleted: { root.collapsed = false } + Component.onCompleted: { + root.collapsed = false; + } Behavior on height { SequentialAnimation { @@ -49,7 +51,7 @@ BackgroundRectangle { root.timedout(); } } - } + } } clip: true @@ -65,7 +67,7 @@ BackgroundRectangle { Timer { id: notifTimer - interval: timerDuration + interval: root.timerDuration running: root.startTimer repeat: false @@ -86,7 +88,6 @@ BackgroundRectangle { margins: 10 } - IconImage { id: iconImage diff --git a/Common/Settings.qml b/Common/Settings.qml index 8464d3d..4a80ad0 100644 --- a/Common/Settings.qml +++ b/Common/Settings.qml @@ -1,12 +1,9 @@ - pragma Singleton import Quickshell Singleton { - id:root + id: root readonly property string time: "oi" - - } diff --git a/NotificationsWidget.qml b/NotificationsWidget.qml index 6c7e19c..316ac18 100644 --- a/NotificationsWidget.qml +++ b/NotificationsWidget.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import QtQuick import Quickshell import Quickshell.Widgets diff --git a/Services/HyprlandService.qml b/Services/HyprlandService.qml index 69bbbe5..fbd5652 100644 --- a/Services/HyprlandService.qml +++ b/Services/HyprlandService.qml @@ -3,9 +3,7 @@ pragma Singleton import QtQuick import Quickshell import Quickshell.Hyprland -import Quickshell.Wayland import Quickshell.Io -import qs.Common Singleton { id: root @@ -24,15 +22,18 @@ Singleton { const sorted = topLevels.sort((a, b) => { if (a.monitor && b.monitor) { const monitorCompare = a.monitor.name.localeCompare(b.monitor.name); - if (monitorCompare !== 0) return monitorCompare; + if (monitorCompare !== 0) + return monitorCompare; } if (a.workspace && b.workspace) { const workspaceCompare = a.workspace.id - b.workspace.id; - if (workspaceCompare !== 0) return workspaceCompare; + if (workspaceCompare !== 0) + return workspaceCompare; } if (a.lastIpcObject?.at && b.lastIpcObject?.at) { const xCompare = a.lastIpcObject.at[0] - b.lastIpcObject.at[0]; - if (Math.abs(xCompare) > 10) return xCompare; + if (Math.abs(xCompare) > 10) + return xCompare; return a.lastIpcObject.at[1] - b.lastIpcObject.at[1]; } if (a.title && b.title) @@ -52,11 +53,11 @@ Singleton { id: retryTimer interval: 300 repeat: false - onTriggered: refreshSortedDesktopApplications() + onTriggered: root.refreshSortedDesktopApplications() } function refreshSortedDesktopApplications() { - if (!Hyprland.toplevels || Hyprland.toplevels.size === 0) + if (!Hyprland.toplevels) return; try { @@ -73,8 +74,6 @@ Singleton { desktopEntry: entry }); } - - } catch (err) { retryTimer.restart(); } @@ -109,4 +108,3 @@ Singleton { } } } - diff --git a/Services/NotificationService.qml b/Services/NotificationService.qml index 280229f..b31aa74 100644 --- a/Services/NotificationService.qml +++ b/Services/NotificationService.qml @@ -12,7 +12,7 @@ Singleton { readonly property var notificationServer: notificationServer readonly property var notificationsNumber: notificationServer.trackedNotifications.values.length - readonly property var maxShown: 3 + readonly property int maxShown: 3 property bool receivingLock: false property bool manualNotificationsMuted: false @@ -31,7 +31,7 @@ Singleton { return; notif.tracked = true; - root.addNotification(trackedNotifications, notif); + root.addNotification(root.trackedNotifications, notif); if (notif.lastGeneration) return; @@ -150,7 +150,6 @@ Singleton { Quickshell.screens.filter(screen => screen.name == HyprlandService.focusedMon.name)[0]; } anchors.top: true - margins.top: screen.height / 100 exclusiveZone: 0 implicitWidth: 400 implicitHeight: screen.height diff --git a/Widgets/WindowSwitcher.qml b/Widgets/WindowSwitcher.qml index 17ba573..6051a36 100644 --- a/Widgets/WindowSwitcher.qml +++ b/Widgets/WindowSwitcher.qml @@ -28,7 +28,7 @@ PanelWindow { WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand - exclusionMode:ExclusionMode.Ignore + exclusionMode: ExclusionMode.Ignore ScreencopyView { id: raveel @@ -43,7 +43,7 @@ PanelWindow { blurEnabled: true blurMax: 32 blur: 1.0 - } + } MouseArea { anchors.fill: parent @@ -59,7 +59,6 @@ PanelWindow { color: "transparent" - ListView { id: listview @@ -136,7 +135,7 @@ PanelWindow { } property int workspaceId: parent.modelData.topLevel.workspace.id - property var desktopEntry: parent.modelData.desktopEntry? parent.modelData.desktopEntry:null + property var desktopEntry: parent.modelData.desktopEntry ? parent.modelData.desktopEntry : null width: 30 height: 30 diff --git a/Workspaces.qml b/Workspaces.qml index dcc2f9b..a77889d 100644 --- a/Workspaces.qml +++ b/Workspaces.qml @@ -127,7 +127,6 @@ WrapperMouseArea { if (workspacesRectangle.workspace.id === Hyprland.focusedWorkspace.id) { return; } - ; Hyprland.dispatch("workspace " + workspacesRectangle.workspace.id); PopUpHover.exit(); }