mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
feat: bluetooth widget
This commit is contained in:
parent
83d7dc47c4
commit
92316b3ca9
6 changed files with 300 additions and 5 deletions
98
shell/bar/bluetooth/BluetoothCard.qml
Normal file
98
shell/bar/bluetooth/BluetoothCard.qml
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Bluetooth
|
||||
import Quickshell.Widgets
|
||||
import qs.widgets
|
||||
import qs
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property BluetoothDevice device
|
||||
|
||||
RowLayout {
|
||||
spacing: 2
|
||||
anchors.fill: parent
|
||||
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(root.device.icon)
|
||||
Layout.preferredWidth: this.height
|
||||
Layout.fillHeight: true
|
||||
Layout.margins: 6
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
Text {
|
||||
text: root.device.name
|
||||
color: ShellSettings.colors.active
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.device.connected ? "Connected" : "Disconnected"
|
||||
color: ShellSettings.colors.active.darker(1.5)
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.margins: 4
|
||||
|
||||
StyledMouseArea {
|
||||
Layout.preferredWidth: this.height
|
||||
Layout.fillHeight: true
|
||||
|
||||
onClicked: {
|
||||
if (root.device.connected) {
|
||||
root.device.disconnect();
|
||||
} else {
|
||||
root.device.connect();
|
||||
}
|
||||
}
|
||||
|
||||
IconImage {
|
||||
source: {
|
||||
if (root.device.connected) {
|
||||
return "image://icon/network-disconnect-symbolic";
|
||||
} else {
|
||||
return "image://icon/network-connect-symbolic";
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledMouseArea {
|
||||
onClicked: root.device.forget()
|
||||
Layout.preferredWidth: this.height
|
||||
Layout.fillHeight: true
|
||||
|
||||
IconImage {
|
||||
source: "image://icon/albumfolder-user-trash"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue