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
} }
}
}
} }
PanelWindow { Loader {
id: topLeftPanel active: Settings.settings.showCorners && (Settings.settings.barMonitors.includes(modelData.name) || (Settings.settings.barMonitors.length === 0))
anchors.top: true
anchors.left: true
color: "transparent" sourceComponent: Item {
screen: modelData PanelWindow {
margins.top: 36 id: topLeftPanel
WlrLayershell.exclusionMode: ExclusionMode.Ignore
visible: Settings.settings.barMonitors.includes(modelData.name) || anchors.top: true
(Settings.settings.barMonitors.length === 0) anchors.left: true
WlrLayershell.layer: WlrLayer.Background color: "transparent"
aboveWindows: false screen: modelData
WlrLayershell.namespace: "swww-daemon" margins.top: 36
implicitHeight: 24 WlrLayershell.exclusionMode: ExclusionMode.Ignore
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
}
}
PanelWindow {
id: topRightPanel
anchors.top: true
anchors.right: true
color: "transparent"
screen: modelData
margins.top: 36
WlrLayershell.exclusionMode: ExclusionMode.Ignore
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
}
}
PanelWindow {
id: bottomLeftPanel
anchors.bottom: true
anchors.left: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
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
}
}
PanelWindow {
id: bottomRightPanel
anchors.bottom: true
anchors.right: true
color: "transparent"
screen: modelData
WlrLayershell.exclusionMode: ExclusionMode.Ignore
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
}
}
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.namespace: "swww-daemon"
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.namespace: "swww-daemon"
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.namespace: "swww-daemon"
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

@ -20,20 +20,20 @@ PanelWindow {
property int barHeight: 36 property int barHeight: 36
color: "transparent" color: "transparent"
function getIcon() { function getIcon() {
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true); var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
if (!icon) { if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId, true); icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title.toLowerCase(), "application-x-executable");
}
return icon;
} }
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title, true);
}
if (!icon) {
icon = Quickshell.iconPath(ToplevelManager.activeToplevel.title.toLowerCase(), "application-x-executable");
}
return icon;
}
Item { Item {
id: activeWindowWrapper id: activeWindowWrapper
@ -139,26 +139,33 @@ PanelWindow {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
maximumLineCount: 1 maximumLineCount: 1
} }
Loader {
active: true
anchors.top: parent.top
sourceComponent: Item {
Corners {
id: activeCornerRight
position: "bottomleft"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: parent.top
offsetX: activeWindowTitleContainer.width - 34
offsetY: -1
}
Corners {
id: activeCornerLeft
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: parent.top
offsetX: 34
offsetY: -1
}
}
}
} }
Corners {
id: activeCornerRight
position: "bottomleft"
size: 1.1
fillColor: Theme.backgroundPrimary
offsetX: activeWindowTitleContainer.x + activeWindowTitleContainer.width - 34
offsetY: -1
anchors.top: activeWindowTitleContainer.top
}
Corners {
id: activeCornerLeft
position: "bottomright"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: activeWindowTitleContainer.top
x: activeWindowTitleContainer.x + 34 - width
offsetY: -1
}
} }
} }

View file

@ -826,24 +826,32 @@ PanelWithOverlay {
} }
} }
Corners { Loader {
id: launcherCornerRight active: Settings.settings.showCorners
position: "bottomleft" anchors.top: parent.top
size: 1.1 anchors.left: parent.left
fillColor: Theme.backgroundPrimary anchors.right: parent.right
anchors.top: root.top sourceComponent: Item {
offsetX: 416 Corners {
offsetY: 0 id: launcherCornerRight
} position: "bottomleft"
size: 1.1
fillColor: Theme.backgroundPrimary
anchors.top: parent.top
offsetX: 427
offsetY: 0
}
Corners { Corners {
id: launcherCornerLeft id: launcherCornerLeft
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,28 +294,33 @@ WlSessionLock {
} }
} }
Corners { Loader {
id: topRightCorner active: Settings.settings.showCorners
position: "bottomleft" anchors.fill: parent
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: screen.width / 2 + 38
offsetY: 0
anchors.top: parent.top
visible: Settings.settings.showCorners
z: 50
}
Corners { sourceComponent: Item {
id: topLeftCorner Corners {
position: "bottomright" id: topRightCorner
size: 1.3 position: "bottomleft"
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" size: 1.3
offsetX: -Screen.width / 2 - 38 fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetY: 0 offsetX: screen.width / 2 + 53
anchors.top: parent.top offsetY: 0
visible: Settings.settings.showCorners anchors.top: parent.top
z: 51 z: 50
}
Corners {
id: topLeftCorner
position: "bottomright"
size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: -Screen.width / 2 - 53
offsetY: 0
anchors.top: parent.top
z: 51
}
}
} }
Rectangle { Rectangle {

View file

@ -428,39 +428,44 @@ PanelWithOverlay {
} }
} }
Corners { Loader {
id: sidebarCornerLeft active: Settings.settings.showCorners
position: "bottomright" anchors.fill: parent
size: 1.1 sourceComponent: Item {
fillColor: Theme.backgroundPrimary Corners {
anchors.top: mainRectangle.top id: sidebarCornerLeft
offsetX: -447 + sidebarPopupRect.slideOffset position: "bottomright"
offsetY: 0 size: 1.1
visible: Settings.settings.showCorners fillColor: Theme.backgroundPrimary
anchors.top: parent.top
offsetX: -447 + sidebarPopupRect.slideOffset
offsetY: 0
Behavior on offsetX { Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating enabled: !sidebarPopupRect.isAnimating
NumberAnimation { NumberAnimation {
duration: 300 duration: 300
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
}
}
} }
}
}
Corners { Corners {
id: sidebarCornerBottom id: sidebarCornerBottom
position: "bottomright" position: "bottomright"
size: 1.1 size: 1.1
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
offsetX: 33 + sidebarPopupRect.slideOffset anchors.bottom: sidebarPopupRect.bottom
offsetY: 46 offsetX: 33 + sidebarPopupRect.slideOffset
visible: Settings.settings.showCorners offsetY: 46
Behavior on offsetX { Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating enabled: !sidebarPopupRect.isAnimating
NumberAnimation { NumberAnimation {
duration: 300 duration: 300
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
}
}
} }
} }
} }

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