add check for laptop and update workspace logic + several errors fixed

This commit is contained in:
lucy 2026-01-15 17:43:03 +01:00
parent 0a0a333472
commit 9e97d6c2e3
5 changed files with 46 additions and 29 deletions

View File

@ -7,6 +7,7 @@ import QtQuick.Layouts
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
delegate: PanelWindow { delegate: PanelWindow {
id: root id: root
required property var modelData required property var modelData
@ -23,7 +24,7 @@ Variants {
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Workspaces { Workspaces {
screen: root.screen property var screen: modelData
} }
} }
@ -36,8 +37,8 @@ Variants {
} }
Row { Row {
spacing: 10
id: rightStuff id: rightStuff
spacing: 10
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Volume {} Volume {}

View File

@ -6,31 +6,35 @@ import "../../reusables/"
import "../../" import "../../"
import "../../settings/" import "../../settings/"
Item { Loader {
id: root id: batLoader
implicitWidth: batRow.implicitWidth active: UPower.displayDevice.isLaptopBattery
implicitHeight: Settings.config.barHeight
Rectangle {
id: batRow
implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
color: "transparent"
sourceComponent: Item {
id: root
implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row { Rectangle {
anchors.centerIn: batRow id: batRow
anchors.verticalCenter: batRow.verticalCenter implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
CustomText { color: "transparent"
id: batText
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
}
IconImage { implicitHeight: Settings.config.barHeight
Row {
anchors.centerIn: batRow
anchors.verticalCenter: batRow.verticalCenter anchors.verticalCenter: batRow.verticalCenter
id: batIcon CustomText {
source: Quickshell.iconPath(UPower.displayDevice.iconName) id: batText
implicitSize: 14 text: Math.round(UPower.displayDevice.percentage * 100) + "%"
} }
IconImage {
id: batIcon
anchors.verticalCenter: batRow.verticalCenter
source: Quickshell.iconPath(UPower.displayDevice.iconName)
implicitSize: 14
}
}
} }
} }
} }

View File

@ -13,6 +13,6 @@ Item {
id: text id: text
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: Hyprland.activeToplevel.activated ? Hyprland.activeToplevel.title : "sigma" text: Hyprland.activeToplevel ? Hyprland.activeToplevel.title : "Desktop"
} }
} }

View File

@ -10,7 +10,6 @@ Item {
id: root id: root
implicitWidth: workspaceRow.implicitWidth implicitWidth: workspaceRow.implicitWidth
height: 30 height: 30
required property var screen
Row { Row {
id: workspaceRow id: workspaceRow
anchors.centerIn: parent anchors.centerIn: parent
@ -22,7 +21,18 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
Rectangle { Rectangle {
id: workspaceNumber id: workspaceNumber
property bool isOnMon: modelData.monitor == Hyprland.monitorFor(root.screen) property bool isOnMon: {
if (!modelData)
return false;
if (!modelData.monitor)
return false;
if (!root.screen)
return false;
return modelData.monitor.name === root.screen.name;
}
required property var modelData required property var modelData
width: isOnMon ? Settings.config.barHeight + 10 : 0 width: isOnMon ? Settings.config.barHeight + 10 : 0
height: isOnMon ? Settings.config.barHeight : 0 height: isOnMon ? Settings.config.barHeight : 0

View File

@ -7,8 +7,10 @@ Variants {
id: root id: root
model: Quickshell.screens model: Quickshell.screens
delegate: WlrLayershell { delegate: WlrLayershell {
required property var modelData
id: wpShell id: wpShell
required property var modelData
screen: modelData
anchors { anchors {
left: true left: true
top: true top: true
@ -19,8 +21,8 @@ Variants {
Image { Image {
fillMode: Image.Stretch fillMode: Image.Stretch
source: Settings.config.currentWall source: Settings.config.currentWall
width: modelData.width width: wpShell.modelData.width
height: modelData.height height: wpShell.modelData.height
} }
} }
} }