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 pragma ComponentBehavior: Bound
import qs.services
import qs.config import qs.config
import "popouts" as BarPopouts import "popouts" as BarPopouts
import Quickshell import Quickshell

View file

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