From dd4641eedde6a4870671bd6fe67eedec6495d709 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Fri, 12 Sep 2025 22:55:13 -0400 Subject: [PATCH 1/3] CompositorService: improved Hyprland detection so there is no warning on Niri. --- Services/CompositorService.qml | 79 +++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/Services/CompositorService.qml b/Services/CompositorService.qml index ed8f9b6..615cb82 100644 --- a/Services/CompositorService.qml +++ b/Services/CompositorService.qml @@ -15,6 +15,8 @@ Singleton { property bool isHyprland: false property bool isNiri: false + readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE") + // Generic workspace and window data property ListModel workspaces: ListModel {} property var windows: [] @@ -50,42 +52,49 @@ Singleton { } // Hyprland connections - Connections { - target: Hyprland.workspaces - enabled: isHyprland - function onValuesChanged() { - try { - updateHyprlandWorkspaces() - workspaceChanged() - } catch (e) { - Logger.error("Compositor", "Error in workspaces onValuesChanged:", e) - } - } - } + Loader { + active: isHyprland + sourceComponent: Component { + Item { + Connections { + target: Hyprland.workspaces + enabled: isHyprland + function onValuesChanged() { + try { + updateHyprlandWorkspaces() + workspaceChanged() + } catch (e) { + Logger.error("Compositor", "Error in workspaces onValuesChanged:", e) + } + } + } - Connections { - target: Hyprland.toplevels - enabled: isHyprland - function onValuesChanged() { - try { - // Use debounced update to prevent too frequent calls - updateTimer.restart() - } catch (e) { - Logger.error("Compositor", "Error in toplevels onValuesChanged:", e) - } - } - } + Connections { + target: Hyprland.toplevels + enabled: isHyprland + function onValuesChanged() { + try { + // Use debounced update to prevent too frequent calls + updateTimer.restart() + } catch (e) { + Logger.error("Compositor", "Error in toplevels onValuesChanged:", e) + } + } + } - Connections { - target: Hyprland - enabled: isHyprland - function onRawEvent(event) { - try { - updateHyprlandWorkspaces() - workspaceChanged() - updateTimer.restart() - } catch (e) { - Logger.error("Compositor", "Error in rawEvent:", e) + Connections { + target: Hyprland + enabled: isHyprland + function onRawEvent(event) { + try { + updateHyprlandWorkspaces() + workspaceChanged() + updateTimer.restart() + } catch (e) { + Logger.error("Compositor", "Error in rawEvent:", e) + } + } + } } } } @@ -93,7 +102,7 @@ Singleton { function detectCompositor() { try { // Try Hyprland first - if (Hyprland.eventSocketPath) { + if (hyprlandSignature && hyprlandSignature.length > 0) { compositorType = "hyprland" isHyprland = true isNiri = false From 335e38d461cd9ded0806e03a00b128473fa56639 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Sat, 13 Sep 2025 10:16:54 -0400 Subject: [PATCH 2/3] Floating Bar: simplified settings --- Commons/Settings.qml | 7 +- Modules/Bar/Bar.qml | 10 +- Modules/SettingsPanel/Tabs/BarTab.qml | 143 +++----------------------- 3 files changed, 24 insertions(+), 136 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index faf0a87..92b2f7a 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -269,11 +269,8 @@ Singleton { // Floating bar settings property bool floating: false - property real rounding: 12.0 - property real marginTop: 16.0 - property real marginBottom: 16.0 - property real marginLeft: 16.0 - property real marginRight: 16.0 + property real marginVertical: 0.25 + property real marginHorizontal: 0.25 property bool showActiveWindowIcon: true // TODO: delete property bool alwaysShowBatteryPercentage: false // TODO: delete diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index e7abf78..579e854 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -46,10 +46,10 @@ Variants { // Floating bar margins - only apply when floating is enabled margins { - top: Settings.data.bar.floating ? Settings.data.bar.marginTop : 0 - bottom: Settings.data.bar.floating ? Settings.data.bar.marginBottom : 0 - left: Settings.data.bar.floating ? Settings.data.bar.marginLeft : 0 - right: Settings.data.bar.floating ? Settings.data.bar.marginRight : 0 + top: Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0 + bottom: Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0 + left: Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0 + right: Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0 } Item { @@ -64,7 +64,7 @@ Variants { color: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity) // Floating bar rounded corners - radius: Settings.data.bar.floating ? Settings.data.bar.rounding : 0 + radius: Settings.data.bar.floating ? Style.radiusL : 0 } // ------------------------------ diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index ae502ce..966bf26 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -98,72 +98,23 @@ ColumnLayout { // Floating bar options - only show when floating is enabled ColumnLayout { visible: Settings.data.bar.floating - spacing: Style.marginXXS * scaling + spacing: Style.marginS * scaling Layout.fillWidth: true - NText { - text: "Rounding" - font.pointSize: Style.fontSizeL * scaling - font.weight: Style.fontWeightBold - color: Color.mOnSurface - } - - NText { - text: "Adjust the corner rounding of the floating bar." - font.pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap - Layout.fillWidth: true + NLabel { + label: "Margins" + description: "Adjust the margins around the floating bar." } RowLayout { - NSlider { - Layout.fillWidth: true - from: 0 - to: 50 - stepSize: 1 - value: Settings.data.bar.rounding - onMoved: Settings.data.bar.rounding = value - cutoutColor: Color.mSurface - } - - NText { - text: Math.round(Settings.data.bar.rounding) + "px" - Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: Style.marginS * scaling - Layout.preferredWidth: 50 - horizontalAlignment: Text.AlignRight - color: Color.mOnSurface - } - } - - NText { - text: "Margins" - font.pointSize: Style.fontSizeL * scaling - font.weight: Style.fontWeightBold - color: Color.mOnSurface - Layout.topMargin: Style.marginM * scaling - } - - NText { - text: "Adjust the margins around the floating bar." - font.pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap Layout.fillWidth: true - } - - GridLayout { - columns: 2 - Layout.fillWidth: true - rowSpacing: Style.marginS * scaling - columnSpacing: Style.marginS * scaling + spacing: Style.marginL * scaling ColumnLayout { spacing: Style.marginXXS * scaling NText { - text: "Top" + text: "Vertical" font.pointSize: Style.fontSizeXS * scaling color: Color.mOnSurfaceVariant } @@ -172,44 +123,15 @@ ColumnLayout { NSlider { Layout.fillWidth: true from: 0 - to: 50 - stepSize: 1 - value: Settings.data.bar.marginTop - onMoved: Settings.data.bar.marginTop = value + to: 1 + stepSize: 0.01 + value: Settings.data.bar.marginVertical + onMoved: Settings.data.bar.marginVertical = value cutoutColor: Color.mSurface } NText { - text: Math.round(Settings.data.bar.marginTop) + "px" - Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: Style.marginXS * scaling - color: Color.mOnSurface - } - } - } - - ColumnLayout { - spacing: Style.marginXXS * scaling - - NText { - text: "Bottom" - font.pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - } - - RowLayout { - NSlider { - Layout.fillWidth: true - from: 0 - to: 50 - stepSize: 1 - value: Settings.data.bar.marginBottom - onMoved: Settings.data.bar.marginBottom = value - cutoutColor: Color.mSurface - } - - NText { - text: Math.round(Settings.data.bar.marginBottom) + "px" + text: Math.round(Settings.data.bar.marginVertical * 100) + "%" Layout.alignment: Qt.AlignVCenter Layout.leftMargin: Style.marginXS * scaling Layout.preferredWidth: 50 @@ -223,7 +145,7 @@ ColumnLayout { spacing: Style.marginXXS * scaling NText { - text: "Left" + text: "Horizontal" font.pointSize: Style.fontSizeXS * scaling color: Color.mOnSurfaceVariant } @@ -232,46 +154,15 @@ ColumnLayout { NSlider { Layout.fillWidth: true from: 0 - to: 50 - stepSize: 1 - value: Settings.data.bar.marginLeft - onMoved: Settings.data.bar.marginLeft = value + to: 1 + stepSize: 0.01 + value: Settings.data.bar.marginHorizontal + onMoved: Settings.data.bar.marginHorizontal = value cutoutColor: Color.mSurface } NText { - text: Math.round(Settings.data.bar.marginLeft) + "px" - Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: Style.marginXS * scaling - Layout.preferredWidth: 50 - horizontalAlignment: Text.AlignRight - color: Color.mOnSurface - } - } - } - - ColumnLayout { - spacing: Style.marginXXS * scaling - - NText { - text: "Right" - font.pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - } - - RowLayout { - NSlider { - Layout.fillWidth: true - from: 0 - to: 50 - stepSize: 1 - value: Settings.data.bar.marginRight - onMoved: Settings.data.bar.marginRight = value - cutoutColor: Color.mSurface - } - - NText { - text: Math.round(Settings.data.bar.marginRight) + "px" + text: Math.round(Settings.data.bar.marginHorizontal * 100) + "%" Layout.alignment: Qt.AlignVCenter Layout.leftMargin: Style.marginXS * scaling Layout.preferredWidth: 50 From acae2b8c21e62a588b82640ad7e11505a256aa33 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Sat, 13 Sep 2025 11:09:55 -0400 Subject: [PATCH 3/3] Dock: border alpha follows bg opacity --- Modules/Dock/Dock.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Dock/Dock.qml b/Modules/Dock/Dock.qml index 9b4150b..c216392 100644 --- a/Modules/Dock/Dock.qml +++ b/Modules/Dock/Dock.qml @@ -209,7 +209,7 @@ Variants { anchors.centerIn: parent radius: Style.radiusL * scaling border.width: Math.max(1, Style.borderS * scaling) - border.color: Color.mOutline + border.color: Qt.alpha(Color.mOutline, Settings.data.dock.backgroundOpacity) MouseArea { id: dockMouseArea