Show MAC addresses in the Bluetooth panel
This commit is contained in:
1 parent
98c63031ee
commit
72d6a8f509
3 files changed
+21
-3
No files matched your search
@@ -3,6 +3,17 @@ function deviceLabel(device) {
|
||||
return String(device.deviceName || device.name || "").trim()
|
||||
}
|
||||
|
||||
function deviceDetail(status, address) {
|
||||
var parts = []
|
||||
var statusText = String(status || "").trim()
|
||||
var addressText = String(address || "").trim().toUpperCase()
|
||||
|
||||
if (statusText !== "") parts.push(statusText)
|
||||
if (addressText !== "") parts.push(addressText)
|
||||
|
||||
return parts.join(" · ")
|
||||
}
|
||||
|
||||
function toArray(values) {
|
||||
if (!values) return []
|
||||
if (Array.isArray(values)) return values.slice()
|
||||
@@ -157,6 +168,7 @@ function sectionDevices(lists, section) {
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = {
|
||||
deviceLabel: deviceLabel,
|
||||
deviceDetail: deviceDetail,
|
||||
toArray: toArray,
|
||||
isUuidLike: isUuidLike,
|
||||
isAddressLike: isAddressLike,
|
||||
|
||||
@@ -38,6 +38,10 @@ Panel {
|
||||
return Model.deviceLabel(device)
|
||||
}
|
||||
|
||||
function deviceDetail(status, address) {
|
||||
return Model.deviceDetail(status, address)
|
||||
}
|
||||
|
||||
function isUuidLike(value) {
|
||||
return Model.isUuidLike(value)
|
||||
}
|
||||
@@ -922,6 +926,8 @@ Panel {
|
||||
return ""
|
||||
}
|
||||
|
||||
readonly property string detailText: root.deviceDetail(statusText, dev ? dev.address : "")
|
||||
|
||||
readonly property color statusColor: {
|
||||
if (isConnected) return root.bar.foreground
|
||||
if (action !== "" || devState === 3 || dev.pairing === true) return root.bar.foreground
|
||||
@@ -1003,8 +1009,8 @@ Panel {
|
||||
}
|
||||
Text {
|
||||
textFormat: Text.PlainText
|
||||
visible: row.statusText !== ""
|
||||
text: row.statusText
|
||||
visible: row.detailText !== ""
|
||||
text: row.detailText
|
||||
color: row.statusColor
|
||||
font.family: root.bar.fontFamily
|
||||
font.pixelSize: Style.font.caption
|
||||
|
||||
Reference in new issue
Block a user