Skip to content

Commit 39dbe42

Browse files
committed
quickshell: fix some warnings
1 parent b9dccce commit 39dbe42

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

home/services/quickshell/bar/Bluetooth.qml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ HoverTooltip {
99
id: root
1010

1111
property var adapter: Bluetooth.defaultAdapter
12-
property var state: adapter.state
13-
property var connected: adapter.devices.values.filter(d => d.state == BluetoothDeviceState.Connected)
14-
property var connecting: adapter.devices.values.filter(d => d.state == BluetoothDeviceState.Connecting)
12+
property var state: adapter?.state
13+
property var connected: adapter?.devices.values.filter(d => d.state == BluetoothDeviceState.Connected)
14+
property var connecting: adapter?.devices.values.filter(d => d.state == BluetoothDeviceState.Connecting)
1515

1616
visible: !!adapter
1717

1818
readonly property string iconState: {
19-
if (adapter.state === BluetoothAdapterState.Disabled)
19+
if (adapter?.state === BluetoothAdapterState.Disabled)
2020
return "disabled";
21-
if (connecting.length)
21+
if (connecting?.length)
2222
return "acquiring";
23-
if (connected.length)
23+
if (connected?.length)
2424
return "active";
25-
if (adapter.state === BluetoothAdapterState.Enabled)
25+
if (adapter?.state === BluetoothAdapterState.Enabled)
2626
return "disconnected";
2727
return "acquiring"; // fallback/unknown
2828
}
@@ -32,10 +32,10 @@ HoverTooltip {
3232
if (state == BluetoothAdapterState.Disabled)
3333
return "Bluetooth disabled";
3434

35-
if (connecting.length)
35+
if (connecting?.length)
3636
return `Connecting to ${connecting[0].name}`;
3737

38-
if (connected.length) {
38+
if (connected?.length) {
3939
if (connected.length > 1) {
4040
return `Connected to ${connected.length} devices`;
4141
}

home/services/quickshell/utils/BrightnessState.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Singleton {
1010

1111
PersistentProperties {
1212
id: persist
13+
reloadableId: "persistedBrightness"
1314
property string screenInterface: ""
14-
property string path: `/sys/class/backlight/${screenInterface}`
15-
property int rawBrightness: Number(getRawBrightness.text());
16-
property int max: Number(getMaxBrightness.text());
17-
property real brightness: rawBrightness / max;
15+
readonly property string path: `/sys/class/backlight/${screenInterface}`
16+
readonly property int rawBrightness: Number(getRawBrightness.text());
17+
readonly property int max: Number(getMaxBrightness.text());
18+
readonly property real brightness: rawBrightness / max;
1819
}
1920

2021
Process {
@@ -24,7 +25,6 @@ Singleton {
2425
command: ["sh", "-c", "ls -w1 /sys/class/backlight | head -1"]
2526
stdout: SplitParser {
2627
onRead: data => {
27-
console.log(`found brightness interface ${data}`);
2828
persist.screenInterface = data;
2929
}
3030
}

0 commit comments

Comments
 (0)