quickshell: fix some warnings

This commit is contained in:
end-4
2025-08-27 17:59:35 +07:00
parent 20d9561143
commit 8c737f2ca4
6 changed files with 13 additions and 10 deletions
@@ -29,7 +29,7 @@ Variants {
// Hide when fullscreen // Hide when fullscreen
property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace=>workspace.monitor && workspace.monitor.name == monitor.name) property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace=>workspace.monitor && workspace.monitor.name == monitor.name)
property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace=>((workspace.toplevels.values.filter(window=>window.wayland.fullscreen)[0] != undefined) && workspace.active))[0] property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace=>((workspace.toplevels.values.filter(window=>window.wayland?.fullscreen)[0] != undefined) && workspace.active))[0]
visible: GlobalStates.screenLocked || (!(activeWorkspaceWithFullscreen != undefined)) || !Config?.options.background.hideWhenFullscreen visible: GlobalStates.screenLocked || (!(activeWorkspaceWithFullscreen != undefined)) || !Config?.options.background.hideWhenFullscreen
// Workspaces // Workspaces
@@ -307,8 +307,8 @@ Item { // Bar content region
color: rightSidebarButton.colText color: rightSidebarButton.colText
} }
MaterialSymbol { MaterialSymbol {
readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter.enabled readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter?.enabled
readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter.devices.values.find(device => device.connected) readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter?.devices.values.find(device => device.connected)
readonly property bool bluetoothConnected: bluetoothDevice !== undefined readonly property bool bluetoothConnected: bluetoothDevice !== undefined
text: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled" text: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled"
iconSize: Appearance.font.pixelSize.larger iconSize: Appearance.font.pixelSize.larger
@@ -126,7 +126,7 @@ Scope {
// Hide when fullscreen // Hide when fullscreen
property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace => workspace.monitor && workspace.monitor.name == monitor.name) property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace => workspace.monitor && workspace.monitor.name == monitor.name)
property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace => ((workspace.toplevels.values.filter(window => window.wayland.fullscreen)[0] != undefined) && workspace.active))[0] property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace => ((workspace.toplevels.values.filter(window => window.wayland?.fullscreen)[0] != undefined) && workspace.active))[0]
property bool fullscreen: activeWorkspaceWithFullscreen != undefined property bool fullscreen: activeWorkspaceWithFullscreen != undefined
CornerPanelWindow { CornerPanelWindow {
@@ -15,7 +15,10 @@ Rectangle {
color: Appearance.colors.colLayer1 color: Appearance.colors.colLayer1
property int selectedTab: 0 property int selectedTab: 0
property var tabButtonList: [{"icon": "notifications", "name": Translation.tr("Notifications")}, {"icon": "volume_up", "name": Translation.tr("Audio")}] property var tabButtonList: [
{"icon": "notifications", "name": Translation.tr("Notifications")},
{"icon": "volume_up", "name": Translation.tr("Audio")}
]
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
if (event.key === Qt.Key_PageDown || event.key === Qt.Key_PageUp) { if (event.key === Qt.Key_PageDown || event.key === Qt.Key_PageUp) {
@@ -10,13 +10,13 @@ import Quickshell.Hyprland
QuickToggleButton { QuickToggleButton {
id: root id: root
readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter.enabled readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter?.enabled ?? false
readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter.devices.values.find(device => device.connected) readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter?.devices.values.find(device => device.connected) ?? null
readonly property bool bluetoothConnected: bluetoothDevice !== undefined readonly property bool bluetoothConnected: bluetoothDevice !== undefined
toggled: bluetoothEnabled toggled: bluetoothEnabled
buttonIcon: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled" buttonIcon: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled"
onClicked: { onClicked: {
Bluetooth.defaultAdapter.enabled = !Bluetooth.defaultAdapter.enabled Bluetooth.defaultAdapter.enabled = !Bluetooth.defaultAdapter?.enabled
} }
altAction: () => { altAction: () => {
Quickshell.execDetached(["bash", "-c", `${Config.options.apps.bluetooth}`]) Quickshell.execDetached(["bash", "-c", `${Config.options.apps.bluetooth}`])
@@ -285,8 +285,8 @@ Item { // Bar content region
color: rightSidebarButton.colText color: rightSidebarButton.colText
} }
MaterialSymbol { MaterialSymbol {
readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter.enabled readonly property bool bluetoothEnabled: Bluetooth.defaultAdapter?.enabled
readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter.devices.values.find(device => device.connected) readonly property BluetoothDevice bluetoothDevice: Bluetooth.defaultAdapter?.devices.values.find(device => device.connected)
readonly property bool bluetoothConnected: bluetoothDevice !== undefined readonly property bool bluetoothConnected: bluetoothDevice !== undefined
text: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled" text: bluetoothConnected ? "bluetooth_connected" : bluetoothEnabled ? "bluetooth" : "bluetooth_disabled"
iconSize: Appearance.font.pixelSize.larger iconSize: Appearance.font.pixelSize.larger