mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Show row close button on every known bluetooth device
Was gated on isConnected; users with paired-but-disconnected devices (or devices Quickshell hasn't flagged as connected yet) saw no button at all. Now shows on every known device. Action follows state: connected -> disconnect, otherwise -> forget. Tooltip label flips to match.
This commit is contained in:
@@ -284,8 +284,8 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
// Explicit disconnect/close button on connected rows. Stops the row's
|
||||
// own click handler from firing.
|
||||
// Explicit close button on any known device. Action depends on state:
|
||||
// connected -> disconnect, otherwise -> forget the pairing entirely.
|
||||
Rectangle {
|
||||
id: disconnectBtn
|
||||
anchors.right: parent.right
|
||||
@@ -293,7 +293,8 @@ Item {
|
||||
width: 22
|
||||
height: 22
|
||||
radius: 4
|
||||
visible: row.isConnected
|
||||
visible: !row.isDiscovered
|
||||
readonly property string action: row.isConnected ? "Disconnect" : "Forget"
|
||||
color: disconnectMouse.containsMouse
|
||||
? Qt.rgba(root.bar.urgent.r, root.bar.urgent.g, root.bar.urgent.b, 0.20)
|
||||
: "transparent"
|
||||
@@ -317,15 +318,19 @@ Item {
|
||||
|
||||
onClicked: {
|
||||
if (!row.dev) return
|
||||
row.pendingAction = 2
|
||||
failureTimer.stop()
|
||||
row.dev.disconnect()
|
||||
if (row.isConnected) {
|
||||
row.pendingAction = 2
|
||||
failureTimer.stop()
|
||||
row.dev.disconnect()
|
||||
} else if (row.dev.forget) {
|
||||
row.dev.forget()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip {
|
||||
visible: disconnectMouse.containsMouse
|
||||
text: "Disconnect"
|
||||
text: disconnectBtn.action
|
||||
delay: 400
|
||||
padding: 0
|
||||
background: Rectangle {
|
||||
@@ -336,7 +341,7 @@ Item {
|
||||
opacity: 0.97
|
||||
}
|
||||
contentItem: Text {
|
||||
text: "Disconnect"
|
||||
text: disconnectBtn.action
|
||||
color: root.bar.foreground
|
||||
font.family: root.bar.fontFamily
|
||||
font.pixelSize: 11
|
||||
@@ -353,8 +358,8 @@ Item {
|
||||
spacing: 1
|
||||
anchors.left: icon.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.right: row.isConnected ? disconnectBtn.left : parent.right
|
||||
anchors.rightMargin: row.isConnected ? 8 : 0
|
||||
anchors.right: disconnectBtn.visible ? disconnectBtn.left : parent.right
|
||||
anchors.rightMargin: disconnectBtn.visible ? 8 : 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Text {
|
||||
|
||||
Reference in New Issue
Block a user