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 {
model: Quickshell.screens
delegate: PanelWindow {
id: root
required property var modelData
@ -23,7 +24,7 @@ Variants {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
Workspaces {
screen: root.screen
property var screen: modelData
}
}
@ -36,8 +37,8 @@ Variants {
}
Row {
spacing: 10
id: rightStuff
spacing: 10
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
Volume {}

View File

@ -6,31 +6,35 @@ import "../../reusables/"
import "../../"
import "../../settings/"
Item {
id: root
implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight
Rectangle {
id: batRow
implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
color: "transparent"
Loader {
id: batLoader
active: UPower.displayDevice.isLaptopBattery
sourceComponent: Item {
id: root
implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight
Row {
anchors.centerIn: batRow
anchors.verticalCenter: batRow.verticalCenter
CustomText {
id: batText
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
}
Rectangle {
id: batRow
implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
color: "transparent"
IconImage {
implicitHeight: Settings.config.barHeight
Row {
anchors.centerIn: batRow
anchors.verticalCenter: batRow.verticalCenter
id: batIcon
source: Quickshell.iconPath(UPower.displayDevice.iconName)
implicitSize: 14
}
CustomText {
id: batText
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
anchors.horizontalCenter: parent.horizontalCenter
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
implicitWidth: workspaceRow.implicitWidth
height: 30
required property var screen
Row {
id: workspaceRow
anchors.centerIn: parent
@ -22,7 +21,18 @@ Item {
anchors.centerIn: parent
Rectangle {
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
width: isOnMon ? Settings.config.barHeight + 10 : 0
height: isOnMon ? Settings.config.barHeight : 0

View File

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