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

View file

@ -139,16 +139,19 @@ PanelWindow {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
maximumLineCount: 1 maximumLineCount: 1
} }
}
Loader {
active: true
anchors.top: parent.top
sourceComponent: Item {
Corners { Corners {
id: activeCornerRight id: activeCornerRight
position: "bottomleft" position: "bottomleft"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
offsetX: activeWindowTitleContainer.x + activeWindowTitleContainer.width - 34 anchors.top: parent.top
offsetX: activeWindowTitleContainer.width - 34
offsetY: -1 offsetY: -1
anchors.top: activeWindowTitleContainer.top
} }
Corners { Corners {
@ -156,9 +159,13 @@ PanelWindow {
position: "bottomright" position: "bottomright"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
anchors.top: activeWindowTitleContainer.top anchors.top: parent.top
x: activeWindowTitleContainer.x + 34 - width offsetX: 34
offsetY: -1 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 { Corners {
id: launcherCornerRight id: launcherCornerRight
position: "bottomleft" position: "bottomleft"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
anchors.top: root.top anchors.top: parent.top
offsetX: 416 offsetX: 427
offsetY: 0 offsetY: 0
} }
@ -841,10 +847,12 @@ PanelWithOverlay {
position: "bottomright" position: "bottomright"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
anchors.top: root.top anchors.top: parent.top
offsetX: -416 offsetX: -427
offsetY: 0 offsetY: 0
} }
} }
} }
}
}
} }

View file

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

View file

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

View file

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

View file

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