diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index fccfe0e..59ef879 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -21,7 +21,6 @@ Item { implicitWidth: pill.width implicitHeight: pill.height - // Helper to evaluate and possibly notify function maybeNotify(percent, charging) { const p = Math.round(percent) diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 3fd8c88..f848d8d 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -61,7 +61,7 @@ Item { NPill { id: pill - + rightOpen: BarWidgetRegistry.getNPillDirection(root) icon: getIcon() iconCircleColor: Color.mPrimary diff --git a/Modules/BluetoothPanel/BluetoothDevicesList.qml b/Modules/BluetoothPanel/BluetoothDevicesList.qml index d234393..43c34f8 100644 --- a/Modules/BluetoothPanel/BluetoothDevicesList.qml +++ b/Modules/BluetoothPanel/BluetoothDevicesList.qml @@ -46,11 +46,11 @@ ColumnLayout { radius: Style.radiusM * scaling color: { - if (availableDeviceArea.containsMouse){ + if (availableDeviceArea.containsMouse) { if (canDisconnect && !isBusy) return Color.mError - if(!isBusy) + if (!isBusy) return Color.mTertiary return Color.mPrimary } @@ -58,7 +58,7 @@ ColumnLayout { if (modelData.pairing || modelData.state === BluetoothDeviceState.Connecting) return Color.mPrimary - if (modelData.blocked ) + if (modelData.blocked) return Color.mError return Color.mSurfaceVariant @@ -68,7 +68,7 @@ ColumnLayout { NTooltip { id: tooltip - target: bluetoothDeviceRectangle + target: bluetoothDeviceRectangle positionAbove: Settings.data.bar.position === "bottom" text: root.tooltipText } @@ -210,7 +210,6 @@ ColumnLayout { Layout.fillWidth: true } - // Call to action Rectangle { Layout.preferredWidth: 80 * scaling @@ -240,7 +239,7 @@ ColumnLayout { if (modelData.blocked) { return "Blocked" } - if(modelData.connected){ + if (modelData.connected) { return "Disconnect" } return "Connect" @@ -248,7 +247,7 @@ ColumnLayout { font.pointSize: Style.fontSizeXS * scaling font.weight: Style.fontWeightMedium color: { - + if (availableDeviceArea.containsMouse) { return Color.mOnTertiary } @@ -264,24 +263,25 @@ ColumnLayout { } MouseArea { - + id: availableDeviceArea acceptedButtons: Qt.LeftButton | Qt.RightButton anchors.fill: parent hoverEnabled: true - cursorShape: (canConnect || canDisconnect) && !isBusy ? Qt.PointingHandCursor : (isBusy ? Qt.BusyCursor : Qt.ArrowCursor) + cursorShape: (canConnect || canDisconnect) + && !isBusy ? Qt.PointingHandCursor : (isBusy ? Qt.BusyCursor : Qt.ArrowCursor) onEntered: { if (root.tooltipText && !isBusy) { tooltip.show() } } onExited: { - if(root.tooltipText && !isBusy) { + if (root.tooltipText && !isBusy) { tooltip.hide() } } - onClicked: function(mouse) { - + onClicked: function (mouse) { + if (!modelData || modelData.pairing) { return } @@ -289,9 +289,8 @@ ColumnLayout { if (root.tooltipText && !isBusy) { tooltip.hide() } - - - if (mouse.button === Qt.LeftButton){ + + if (mouse.button === Qt.LeftButton) { if (modelData.connected) { BluetoothService.disconnectDevice(modelData) } else { diff --git a/Modules/BluetoothPanel/BluetoothPanel.qml b/Modules/BluetoothPanel/BluetoothPanel.qml index 8dfcf47..67cce45 100644 --- a/Modules/BluetoothPanel/BluetoothPanel.qml +++ b/Modules/BluetoothPanel/BluetoothPanel.qml @@ -84,22 +84,25 @@ NPanel { BluetoothDevicesList { label: "Connected devices" property var items: { - if (!BluetoothService.adapter || !Bluetooth.devices) return [] + if (!BluetoothService.adapter || !Bluetooth.devices) + return [] var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && dev.connected) return BluetoothService.sortDevices(filtered) } model: items visible: items.length > 0 Layout.fillWidth: true - } + } - // Known devices + // Known devices BluetoothDevicesList { label: "Known devices" tooltipText: "Left click to connect, right click to forget" property var items: { - if (!BluetoothService.adapter || !Bluetooth.devices) return [] - var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.connected && (dev.paired || dev.trusted)) + if (!BluetoothService.adapter || !Bluetooth.devices) + return [] + var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.connected + && (dev.paired || dev.trusted)) return BluetoothService.sortDevices(filtered) } model: items @@ -111,7 +114,8 @@ NPanel { BluetoothDevicesList { label: "Available devices" property var items: { - if (!BluetoothService.adapter || !Bluetooth.devices) return [] + if (!BluetoothService.adapter || !Bluetooth.devices) + return [] var filtered = Bluetooth.devices.values.filter(dev => dev && !dev.blocked && !dev.paired && !dev.trusted) return BluetoothService.sortDevices(filtered) } diff --git a/Services/BluetoothService.qml b/Services/BluetoothService.qml index 98c8053..6283981 100644 --- a/Services/BluetoothService.qml +++ b/Services/BluetoothService.qml @@ -86,6 +86,8 @@ Singleton { function canConnect(device) { if (!device) return false + + /* Paired diff --git a/Services/BrightnessService.qml b/Services/BrightnessService.qml index c66c1f4..6cf1b5d 100644 --- a/Services/BrightnessService.qml +++ b/Services/BrightnessService.qml @@ -11,7 +11,7 @@ Singleton { property list ddcMonitors: [] readonly property list monitors: variants.instances property bool appleDisplayPresent: false - + function getMonitorForScreen(screen: ShellScreen): var { return monitors.find(m => m.modelData === screen) } @@ -75,29 +75,24 @@ Singleton { onStreamFinished: { // Do not filter out invalid displays. For some reason --brief returns some invalid which works fine var displays = text.trim().split("\n\n") - ddcProc.ddcMonitors = displays.map(d => { - var ddcModelMatc = d.match(/This monitor does not support DDC\/CI/) - var modelMatch = d.match(/Model:\s*(.*)/) - var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/) - var ddcModel = ddcModelMatc ? ddcModelMatc.length > 0 : false - var model = modelMatch ? modelMatch[1] : "Unknown" - var bus = busMatch ? busMatch[1] : "Unknown" - Logger.log( - "Detected DDC Monitor:", model, - "on bus", bus, "is DDC:", !ddcModel - ) - return { - "model": model, - "busNum": bus, - "isDdc": !ddcModel, - } - }) + var ddcModelMatc = d.match(/This monitor does not support DDC\/CI/) + var modelMatch = d.match(/Model:\s*(.*)/) + var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/) + var ddcModel = ddcModelMatc ? ddcModelMatc.length > 0 : false + var model = modelMatch ? modelMatch[1] : "Unknown" + var bus = busMatch ? busMatch[1] : "Unknown" + Logger.log("Detected DDC Monitor:", model, "on bus", bus, "is DDC:", + !ddcModel) + return { + "model": model, + "busNum": bus, + "isDdc": !ddcModel + } + }) root.ddcMonitors = ddcProc.ddcMonitors.filter(m => m.isDdc) - - } } }