More tweaks
This commit is contained in:
@@ -44,7 +44,7 @@ Item {
|
|||||||
var list = []
|
var list = []
|
||||||
if (brightnessAvailable) list.push("brightness")
|
if (brightnessAvailable) list.push("brightness")
|
||||||
list.push("scale")
|
list.push("scale")
|
||||||
if (displays.length > 0) list.push("monitors")
|
if (displays.length > 1) list.push("monitors")
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 6
|
spacing: 6
|
||||||
visible: root.displays.length > 0
|
visible: root.displays.length > 1
|
||||||
|
|
||||||
PanelSectionHeader {
|
PanelSectionHeader {
|
||||||
text: "Monitors"
|
text: "Monitors"
|
||||||
|
|||||||
@@ -164,6 +164,11 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
frequency = parts[3] || ""
|
frequency = parts[3] || ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyToClipboard(value) {
|
||||||
|
if (!value || !root.bar) return
|
||||||
|
Quickshell.execDetached(["bash", "-lc", "printf %s " + root.bar.shellQuote(value) + " | wl-copy"])
|
||||||
|
}
|
||||||
|
|
||||||
function networkTooltip() {
|
function networkTooltip() {
|
||||||
if (kind === "wifi") {
|
if (kind === "wifi") {
|
||||||
var f = parseFloat(frequency)
|
var f = parseFloat(frequency)
|
||||||
@@ -783,11 +788,15 @@ fi
|
|||||||
visible: !!root.info.ip
|
visible: !!root.info.ip
|
||||||
label: "IP"
|
label: "IP"
|
||||||
value: root.info.ip || ""
|
value: root.info.ip || ""
|
||||||
|
copyable: true
|
||||||
|
tooltipText: "Copy IP"
|
||||||
}
|
}
|
||||||
InfoPair {
|
InfoPair {
|
||||||
visible: !!root.info.gateway
|
visible: !!root.info.gateway
|
||||||
label: "Gateway"
|
label: "Gateway"
|
||||||
value: root.info.gateway || ""
|
value: root.info.gateway || ""
|
||||||
|
copyable: true
|
||||||
|
tooltipText: "Copy gateway"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1157,6 +1166,7 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
anchors.topMargin: 4
|
anchors.topMargin: 4
|
||||||
implicitHeight: 34
|
implicitHeight: 34
|
||||||
|
height: implicitHeight
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: pwField
|
id: pwField
|
||||||
@@ -1165,6 +1175,7 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
anchors.right: connectPwBtn.left
|
anchors.right: connectPwBtn.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.rightMargin: 6
|
anchors.rightMargin: 6
|
||||||
|
height: 26
|
||||||
password: true
|
password: true
|
||||||
placeholderText: "Passphrase"
|
placeholderText: "Passphrase"
|
||||||
font.family: root.bar.fontFamily
|
font.family: root.bar.fontFamily
|
||||||
@@ -1172,7 +1183,6 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
foreground: root.bar.foreground
|
foreground: root.bar.foreground
|
||||||
horizontalPadding: 8
|
horizontalPadding: 8
|
||||||
verticalPadding: 6
|
verticalPadding: 6
|
||||||
implicitHeight: 26
|
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (!root.busy && row.net && text.length > 0) root.connectWithPassphrase(row.net.ssid, text)
|
if (!root.busy && row.net && text.length > 0) root.connectWithPassphrase(row.net.ssid, text)
|
||||||
@@ -1199,7 +1209,7 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: row.isFailed ? (root.failureReason || "Wrong password") : "Connecting..."
|
text: row.isFailed ? "Wrong password" : "Connecting..."
|
||||||
color: row.isFailed ? root.bar.urgent : root.bar.foreground
|
color: row.isFailed ? root.bar.urgent : root.bar.foreground
|
||||||
font.family: root.bar.fontFamily
|
font.family: root.bar.fontFamily
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
@@ -1268,13 +1278,35 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
component InfoPair: Row {
|
component InfoPair: Row {
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property string value: ""
|
property string value: ""
|
||||||
|
property bool copyable: false
|
||||||
|
property string tooltipText: "Copy to clipboard"
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
InfoLabel { text: label }
|
InfoLabel { text: label }
|
||||||
Item { width: Math.max(0, parent.width - parent.children[0].implicitWidth - parent.children[2].implicitWidth - parent.spacing * 2); height: 1 }
|
Item { width: Math.max(0, parent.width - parent.children[0].implicitWidth - valueText.implicitWidth - parent.spacing * 2); height: 1 }
|
||||||
InfoValue { text: value }
|
InfoValue {
|
||||||
|
id: valueText
|
||||||
|
text: value
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: valueMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: copyable && valueText.text !== ""
|
||||||
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
onClicked: root.copyToClipboard(valueText.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelToolTip {
|
||||||
|
visible: valueMouse.enabled && valueMouse.containsMouse
|
||||||
|
text: tooltipText
|
||||||
|
panelForeground: root.bar.foreground
|
||||||
|
panelBackground: root.bar.background
|
||||||
|
fontFamily: root.bar.fontFamily
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component InfoLabel: Text {
|
component InfoLabel: Text {
|
||||||
|
|||||||
@@ -33,7 +33,18 @@ Item {
|
|||||||
return defaultIcons[index]
|
return defaultIcons[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
function modeLabel() { return UPower.onBattery ? "Battery" : "Charging" }
|
function modeLabel() {
|
||||||
|
var device = UPower.displayDevice
|
||||||
|
var percentage = device && device.isPresent ? device.percentage : 0
|
||||||
|
|
||||||
|
if (!UPower.onBattery && percentage >= 1) {
|
||||||
|
return "Fully charged"
|
||||||
|
} else if (UPower.onBattery) {
|
||||||
|
return "Battery"
|
||||||
|
} else {
|
||||||
|
return "Charging"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
if (!batteryProc.running) batteryProc.running = true
|
if (!batteryProc.running) batteryProc.running = true
|
||||||
|
|||||||
Reference in New Issue
Block a user