Merge pull request #93 from quadbyte/my-dev

Corners: improve memory usage when disabled
This commit is contained in:
Lysec 2025-08-06 18:01:36 +02:00 committed by GitHub
commit b84d5d08ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 259 additions and 217 deletions

View file

@ -1,27 +1,30 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
import QtQuick.Effects
import qs.Bar.Modules
import qs.Settings
import qs.Services
import qs.Components
import qs.Helpers
import qs.Services
import qs.Settings
import qs.Widgets
import qs.Widgets.Notification
import qs.Widgets.Sidebar
import qs.Widgets.Sidebar.Panel
import qs.Widgets.Notification
// Main bar component - creates panels on selected monitors with widgets and corners
Scope {
id: rootScope
property var shell
property alias visible: barRootItem.visible
Item {
id: barRootItem
anchors.fill: parent
Variants {
@ -32,18 +35,18 @@ Scope {
PanelWindow {
id: panel
screen: modelData
color: "transparent"
implicitHeight: barBackground.height
anchors.top: true
anchors.left: true
anchors.right: true
visible: Settings.settings.barMonitors.includes(modelData.name) ||
(Settings.settings.barMonitors.length === 0)
visible: Settings.settings.barMonitors.includes(modelData.name) || (Settings.settings.barMonitors.length === 0)
Rectangle {
id: barBackground
width: parent.width
height: 36
color: Theme.backgroundPrimary
@ -53,6 +56,7 @@ Scope {
Row {
id: leftWidgetsRow
anchors.verticalCenter: barBackground.verticalCenter
anchors.left: barBackground.left
anchors.leftMargin: 18
@ -69,6 +73,7 @@ Scope {
Taskbar {
anchors.verticalCenter: parent.verticalCenter
}
}
ActiveWindow {
@ -77,6 +82,7 @@ Scope {
Workspace {
id: workspace
screen: modelData
anchors.horizontalCenter: barBackground.horizontalCenter
anchors.verticalCenter: barBackground.verticalCenter
@ -84,6 +90,7 @@ Scope {
Row {
id: rightWidgetsRow
anchors.verticalCenter: barBackground.verticalCenter
anchors.right: barBackground.right
anchors.rightMargin: 18
@ -91,6 +98,7 @@ Scope {
SystemTray {
id: systemTrayModule
shell: rootScope.shell
anchors.verticalCenter: parent.verticalCenter
bar: panel
@ -116,17 +124,20 @@ Scope {
Battery {
id: widgetsBattery
anchors.verticalCenter: parent.verticalCenter
}
Brightness {
id: widgetsBrightness
screen: modelData
anchors.verticalCenter: parent.verticalCenter
}
Volume {
id: widgetsVolume
shell: rootScope.shell
anchors.verticalCenter: parent.verticalCenter
}
@ -138,6 +149,7 @@ Scope {
PanelPopup {
id: sidebarPopup
shell: rootScope.shell
}
@ -147,124 +159,129 @@ Scope {
screen: modelData
sidebarPopup: sidebarPopup
}
}
}
}
Loader {
active: Settings.settings.showCorners && (Settings.settings.barMonitors.includes(modelData.name) || (Settings.settings.barMonitors.length === 0))
sourceComponent: Item {
PanelWindow {
id: topLeftPanel
anchors.top: true
anchors.left: true
color: "transparent"
screen: modelData
margins.top: 36
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: Settings.settings.barMonitors.includes(modelData.name) ||
(Settings.settings.barMonitors.length === 0)
WlrLayershell.layer: WlrLayer.Background
aboveWindows: false
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "swww-daemon"
aboveWindows: false
implicitHeight: 24
Corners {
id: topLeftCorner
position: "bottomleft"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -39
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
}
}
PanelWindow {
id: topRightPanel
anchors.top: true
anchors.right: true
color: "transparent"
screen: modelData
margins.top: 36
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: Settings.settings.barMonitors.includes(modelData.name) ||
(Settings.settings.barMonitors.length === 0)
WlrLayershell.layer: WlrLayer.Background
aboveWindows: false
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "swww-daemon"
aboveWindows: false
implicitHeight: 24
Corners {
id: topRightCorner
position: "bottomright"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: 39
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
}
}
PanelWindow {
id: bottomLeftPanel
anchors.bottom: true
anchors.left: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: Settings.settings.barMonitors.includes(modelData.name) ||
(Settings.settings.barMonitors.length === 0)
WlrLayershell.layer: WlrLayer.Background
aboveWindows: false
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "swww-daemon"
aboveWindows: false
implicitHeight: 24
Corners {
id: bottomLeftCorner
position: "topleft"
size: 1.3
fillColor: Theme.backgroundPrimary
offsetX: -39
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
}
}
PanelWindow {
id: bottomRightPanel
anchors.bottom: true
anchors.right: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: Settings.settings.barMonitors.includes(modelData.name) ||
(Settings.settings.barMonitors.length === 0)
WlrLayershell.layer: WlrLayer.Background
aboveWindows: false
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "swww-daemon"
aboveWindows: false
implicitHeight: 24
Corners {
id: bottomRightCorner
position: "topright"
size: 1.3
fillColor: Theme.backgroundPrimary
offsetX: 39
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
}
}
}
}
}
property alias visible: barRootItem.visible
}
}
}
}
}
}
}

View file

@ -139,16 +139,19 @@ PanelWindow {
verticalAlignment: Text.AlignVCenter
maximumLineCount: 1
}
}
Loader {
active: true
anchors.top: parent.top
sourceComponent: Item {
Corners {
id: activeCornerRight
position: "bottomleft"
size: 1.1
fillColor: Theme.backgroundPrimary
offsetX: activeWindowTitleContainer.x + activeWindowTitleContainer.width - 34
anchors.top: parent.top
offsetX: activeWindowTitleContainer.width - 34
offsetY: -1
anchors.top: activeWindowTitleContainer.top
}
Corners {
@ -156,9 +159,13 @@ PanelWindow {
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: activeWindowTitleContainer.top
x: activeWindowTitleContainer.x + 34 - width
anchors.top: parent.top
offsetX: 34
offsetY: -1
}
}
}
}
}
}

View file

@ -826,13 +826,19 @@ PanelWithOverlay {
}
}
Loader {
active: Settings.settings.showCorners
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
sourceComponent: Item {
Corners {
id: launcherCornerRight
position: "bottomleft"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: root.top
offsetX: 416
anchors.top: parent.top
offsetX: 427
offsetY: 0
}
@ -841,10 +847,12 @@ PanelWithOverlay {
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: root.top
offsetX: -416
anchors.top: parent.top
offsetX: -427
offsetY: 0
}
}
}
}
}
}

View file

@ -48,7 +48,7 @@ Singleton {
property bool showActiveWindow: true
property bool showActiveWindowIcon: false
property bool showSystemInfoInBar: false
property bool showCorners: true
property bool showCorners: false
property bool showTaskbar: true
property bool showMediaInBar: false
property bool useSWWW: false

View file

@ -294,15 +294,19 @@ WlSessionLock {
}
}
Loader {
active: Settings.settings.showCorners
anchors.fill: parent
sourceComponent: Item {
Corners {
id: topRightCorner
position: "bottomleft"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: screen.width / 2 + 38
offsetX: screen.width / 2 + 53
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
z: 50
}
@ -311,12 +315,13 @@ WlSessionLock {
position: "bottomright"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -Screen.width / 2 - 38
offsetX: -Screen.width / 2 - 53
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
z: 51
}
}
}
Rectangle {
width: infoColumn.width + 32

View file

@ -428,15 +428,18 @@ PanelWithOverlay {
}
}
Loader {
active: Settings.settings.showCorners
anchors.fill: parent
sourceComponent: Item {
Corners {
id: sidebarCornerLeft
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: mainRectangle.top
anchors.top: parent.top
offsetX: -447 + sidebarPopupRect.slideOffset
offsetY: 0
visible: Settings.settings.showCorners
Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating
@ -452,9 +455,9 @@ PanelWithOverlay {
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.bottom: sidebarPopupRect.bottom
offsetX: 33 + sidebarPopupRect.slideOffset
offsetY: 46
visible: Settings.settings.showCorners
Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating
@ -466,3 +469,5 @@ PanelWithOverlay {
}
}
}
}
}

View file

@ -57,6 +57,9 @@ Scope {
Quickshell.shell = root;
}
Background {}
Overview {}
Bar {
id: bar
shell: root
@ -72,9 +75,6 @@ Scope {
}
}
Background {}
Overview {}
Applauncher {
id: appLauncherPanel
visible: false