Corners: wrapped them all in loaders to save a lot of memory when not enabled.
This commit is contained in:
parent
691974c1ba
commit
a68907d324
7 changed files with 260 additions and 216 deletions
245
Bar/Bar.qml
245
Bar/Bar.qml
|
|
@ -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,122 +159,129 @@ Scope {
|
|||
screen: modelData
|
||||
sidebarPopup: sidebarPopup
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: topLeftPanel
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
Loader {
|
||||
active: Settings.settings.showCorners && (Settings.settings.barMonitors.includes(modelData.name) || (Settings.settings.barMonitors.length === 0))
|
||||
|
||||
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
|
||||
sourceComponent: Item {
|
||||
PanelWindow {
|
||||
id: topLeftPanel
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: 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: 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@ PanelWindow {
|
|||
property int barHeight: 36
|
||||
color: "transparent"
|
||||
|
||||
function getIcon() {
|
||||
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
|
||||
if (!icon) {
|
||||
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;
|
||||
function getIcon() {
|
||||
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
|
||||
if (!icon) {
|
||||
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;
|
||||
}
|
||||
|
||||
Item {
|
||||
id: activeWindowWrapper
|
||||
|
|
@ -139,26 +139,33 @@ 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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -826,24 +826,32 @@ PanelWithOverlay {
|
|||
}
|
||||
}
|
||||
|
||||
Corners {
|
||||
id: launcherCornerRight
|
||||
position: "bottomleft"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.top: root.top
|
||||
offsetX: 416
|
||||
offsetY: 0
|
||||
}
|
||||
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: parent.top
|
||||
offsetX: 427
|
||||
offsetY: 0
|
||||
}
|
||||
|
||||
Corners {
|
||||
id: launcherCornerLeft
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.top: root.top
|
||||
offsetX: -416
|
||||
offsetY: 0
|
||||
Corners {
|
||||
id: launcherCornerLeft
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.top: parent.top
|
||||
offsetX: -427
|
||||
offsetY: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -294,28 +294,33 @@ WlSessionLock {
|
|||
}
|
||||
}
|
||||
|
||||
Corners {
|
||||
id: topRightCorner
|
||||
position: "bottomleft"
|
||||
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
|
||||
}
|
||||
Loader {
|
||||
active: Settings.settings.showCorners
|
||||
anchors.fill: parent
|
||||
|
||||
Corners {
|
||||
id: topLeftCorner
|
||||
position: "bottomright"
|
||||
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: 51
|
||||
sourceComponent: Item {
|
||||
Corners {
|
||||
id: topRightCorner
|
||||
position: "bottomleft"
|
||||
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: 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 {
|
||||
|
|
|
|||
|
|
@ -428,39 +428,44 @@ PanelWithOverlay {
|
|||
}
|
||||
}
|
||||
|
||||
Corners {
|
||||
id: sidebarCornerLeft
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.top: mainRectangle.top
|
||||
offsetX: -447 + sidebarPopupRect.slideOffset
|
||||
offsetY: 0
|
||||
visible: Settings.settings.showCorners
|
||||
Loader {
|
||||
active: Settings.settings.showCorners
|
||||
anchors.fill: parent
|
||||
sourceComponent: Item {
|
||||
Corners {
|
||||
id: sidebarCornerLeft
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.top: parent.top
|
||||
offsetX: -447 + sidebarPopupRect.slideOffset
|
||||
offsetY: 0
|
||||
|
||||
Behavior on offsetX {
|
||||
enabled: !sidebarPopupRect.isAnimating
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
Behavior on offsetX {
|
||||
enabled: !sidebarPopupRect.isAnimating
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Corners {
|
||||
id: sidebarCornerBottom
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
offsetX: 33 + sidebarPopupRect.slideOffset
|
||||
offsetY: 46
|
||||
visible: Settings.settings.showCorners
|
||||
Corners {
|
||||
id: sidebarCornerBottom
|
||||
position: "bottomright"
|
||||
size: 1.1
|
||||
fillColor: Theme.backgroundPrimary
|
||||
anchors.bottom: sidebarPopupRect.bottom
|
||||
offsetX: 33 + sidebarPopupRect.slideOffset
|
||||
offsetY: 46
|
||||
|
||||
Behavior on offsetX {
|
||||
enabled: !sidebarPopupRect.isAnimating
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
Behavior on offsetX {
|
||||
enabled: !sidebarPopupRect.isAnimating
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue