Fix WiFi, Bluetooth and Battery symbol visibility states
This commit is contained in:
parent
5a90d28003
commit
f8f1e789d4
1 changed files with 25 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.UPower
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
|
@ -63,6 +64,12 @@ Variants {
|
|||
id: leftWidgetLoader
|
||||
sourceComponent: widgetLoader.getWidgetComponent(modelData)
|
||||
active: true
|
||||
visible: {
|
||||
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
|
||||
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
|
||||
if (modelData === "Battery" && !shouldShowBattery()) return false
|
||||
return true
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onStatusChanged: {
|
||||
if (status === Loader.Error) {
|
||||
|
|
@ -90,6 +97,12 @@ Variants {
|
|||
id: centerWidgetLoader
|
||||
sourceComponent: widgetLoader.getWidgetComponent(modelData)
|
||||
active: true
|
||||
visible: {
|
||||
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
|
||||
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
|
||||
if (modelData === "Battery" && !shouldShowBattery()) return false
|
||||
return true
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onStatusChanged: {
|
||||
if (status === Loader.Error) {
|
||||
|
|
@ -118,6 +131,11 @@ Variants {
|
|||
id: rightWidgetLoader
|
||||
sourceComponent: widgetLoader.getWidgetComponent(modelData)
|
||||
active: true
|
||||
visible: {
|
||||
if (modelData === "WiFi" && !Settings.data.network.wifiEnabled) return false
|
||||
if (modelData === "Bluetooth" && !Settings.data.network.bluetoothEnabled) return false
|
||||
return true
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onStatusChanged: {
|
||||
if (status === Loader.Error) {
|
||||
|
|
@ -131,6 +149,13 @@ Variants {
|
|||
}
|
||||
}
|
||||
|
||||
// Helper function to check if battery widget should be visible (same logic as Battery.qml)
|
||||
function shouldShowBattery() {
|
||||
// For now, always show battery widget and let it handle its own visibility
|
||||
// The Battery widget has its own testMode and visibility logic
|
||||
return true
|
||||
}
|
||||
|
||||
// Widget loader instance
|
||||
WidgetLoader {
|
||||
id: widgetLoader
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue