lock/fetch: hide user when bat and smol

This commit is contained in:
2 * r + 2 * t 2025-08-13 15:00:22 +10:00
parent 775410393e
commit ec9d0359d5
2 changed files with 18 additions and 21 deletions

View file

@ -1,6 +1,5 @@
pragma ComponentBehavior: Bound
import qs.services
import qs.config
import "popouts" as BarPopouts
import Quickshell

View file

@ -48,7 +48,7 @@ ColumnLayout {
elide: Text.ElideRight
}
Loader {
WrappedLoader {
Layout.fillHeight: true
asynchronous: true
active: !iconLoader.active
@ -66,14 +66,11 @@ ColumnLayout {
Layout.fillHeight: false
spacing: height * 0.15
Loader {
WrappedLoader {
id: iconLoader
Layout.fillHeight: true
asynchronous: true
active: root.width > 320
visible: active
sourceComponent: IconImage {
source: Quickshell.iconPath(SysInfo.logo)
@ -88,43 +85,42 @@ ColumnLayout {
Layout.leftMargin: iconLoader.active ? 0 : width * 0.1
spacing: Appearance.spacing.normal
Loader {
WrappedLoader {
Layout.fillWidth: true
asynchronous: true
active: !batLoader.active && root.height > 200
visible: active
sourceComponent: FetchText {
text: `OS : ${SysInfo.osPrettyName || SysInfo.osName}`
}
}
Loader {
WrappedLoader {
Layout.fillWidth: true
asynchronous: true
active: root.height > (batLoader.active ? 200 : 110)
visible: active
sourceComponent: FetchText {
text: `WM : ${SysInfo.wm}`
}
}
FetchText {
text: `USER: ${SysInfo.user}`
WrappedLoader {
Layout.fillWidth: true
active: !batLoader.active || root.height > 110
sourceComponent: FetchText {
text: `USER: ${SysInfo.user}`
}
}
FetchText {
text: `UP : ${SysInfo.uptime}`
}
Loader {
WrappedLoader {
id: batLoader
Layout.fillWidth: true
asynchronous: true
active: UPower.displayDevice.isLaptopBattery
visible: active
sourceComponent: FetchText {
text: `BATT: ${UPower.onBattery ? "" : "(+) "}${Math.round(UPower.displayDevice.percentage * 100)}%`
@ -133,12 +129,9 @@ ColumnLayout {
}
}
Loader {
WrappedLoader {
Layout.alignment: Qt.AlignHCenter
asynchronous: true
active: root.height > 180
visible: active
sourceComponent: RowLayout {
spacing: Appearance.spacing.large
@ -158,6 +151,11 @@ ColumnLayout {
}
}
component WrappedLoader: Loader {
asynchronous: true
visible: active
}
component FetchText: MonoText {
Layout.fillWidth: true
font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal