Compare commits
28 Commits
features/f
...
e5809efc6a
| Author | SHA1 | Date | |
|---|---|---|---|
| e5809efc6a | |||
| d6f79685f0 | |||
| c2c6675f4b | |||
| fcce5f304b | |||
| 4b0b5c72ba | |||
| 3f4e3514a2 | |||
| 622afb2100 | |||
| 3ae5c57303 | |||
| ef06a96757 | |||
| 03ea182c8c | |||
| ba8a565cda | |||
| c8a9c30fc5 | |||
| 185b752393 | |||
| 8515f3f5ce | |||
| 86921f7aab | |||
| cede2a1690 | |||
| 00e4368abe | |||
| 00d7dcb411 | |||
| 4bdb590899 | |||
| 44e73f5a9d | |||
| 3184c61267 | |||
| fb79f0a37e | |||
| 7a1073646a | |||
| 90d068a878 | |||
| 57e5c0c7b3 | |||
| b7a92c9a59 | |||
| d3856ada0d | |||
| 3601f52600 |
@@ -4,6 +4,10 @@ import QtQuick
|
|||||||
QtObject {
|
QtObject {
|
||||||
readonly property string fontFamily: "CaskaydiaCove Nerd Font Mono"
|
readonly property string fontFamily: "CaskaydiaCove Nerd Font Mono"
|
||||||
readonly property string iconFontFamily: "Material Symbols Outlined"
|
readonly property string iconFontFamily: "Material Symbols Outlined"
|
||||||
|
// Same glyph set, softer/rounded terminals — used where a module wants
|
||||||
|
// a visually distinct icon style from the rest of the bar (currently
|
||||||
|
// just BluetoothIndicator.qml) without switching every icon over.
|
||||||
|
readonly property string iconFontFamilyRounded: "Material Symbols Rounded"
|
||||||
// Material Symbols is a variable font. Left unset, glyphs fall back to the
|
// Material Symbols is a variable font. Left unset, glyphs fall back to the
|
||||||
// font's default optical size (24px), which is tuned for larger rendering
|
// font's default optical size (24px), which is tuned for larger rendering
|
||||||
// and makes some icons (e.g. "lock") look heavier/bigger than others when
|
// and makes some icons (e.g. "lock") look heavier/bigger than others when
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ PanelWindow {
|
|||||||
NetworkIndicator { barWindow: bar }
|
NetworkIndicator { barWindow: bar }
|
||||||
BluetoothIndicator { barWindow: bar }
|
BluetoothIndicator { barWindow: bar }
|
||||||
Volume { barWindow: bar }
|
Volume { barWindow: bar }
|
||||||
|
BatteryIndicator { barWindow: bar }
|
||||||
PowerButton { barWindow: bar }
|
PowerButton { barWindow: bar }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
422
dotfiles/.config/quickshell/modules/bar/BatteryIndicator.qml
Normal file
422
dotfiles/.config/quickshell/modules/bar/BatteryIndicator.qml
Normal file
@@ -0,0 +1,422 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
import "../../config"
|
||||||
|
|
||||||
|
// Battery + power-profile panel, ported from omarchy's power panel
|
||||||
|
// (github.com/basecamp/omarchy shell/plugins/panels/power/{Model.js,Panel.qml})
|
||||||
|
// onto this project's own conventions: Quickshell's native UPower/PowerProfiles
|
||||||
|
// bindings instead of omarchy's `omarchy-battery-status` /
|
||||||
|
// `omarchy-powerprofiles-list` / `omarchy-powerprofiles-set` helper scripts
|
||||||
|
// (which don't exist outside omarchy), and Material Symbols glyphs instead of
|
||||||
|
// Nerd Font ones. The charge-threshold ("Holding"/limited-charge) concept from
|
||||||
|
// the original is hardware-specific (vendor charge-limit sysfs knobs) and has
|
||||||
|
// no equivalent in Quickshell's UPower binding, so it's dropped rather than
|
||||||
|
// guessed at; "Battery health" (device.healthPercentage) is shown in its
|
||||||
|
// place, using data UPower actually reports.
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property var device: UPower.displayDevice
|
||||||
|
// isLaptopBattery (type === Battery && powerSupply === true) is the
|
||||||
|
// Quickshell-recommended check for "is this actually a battery" — more
|
||||||
|
// precise than isPresent, which the docs note is only meaningful once
|
||||||
|
// you already know the device is of Battery type.
|
||||||
|
readonly property bool batteryPresent: !!(root.device && root.device.ready && root.device.isLaptopBattery)
|
||||||
|
|
||||||
|
// Hidden entirely on a desktop with no battery — RowLayout skips
|
||||||
|
// invisible children for both sizing and spacing, so this just vanishes
|
||||||
|
// from the bar rather than leaving a gap.
|
||||||
|
visible: root.batteryPresent
|
||||||
|
implicitWidth: root.batteryPresent ? label.implicitWidth : 0
|
||||||
|
implicitHeight: Appearance.barHeight
|
||||||
|
|
||||||
|
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
||||||
|
// anchor to the bar itself rather than to this icon, keeping it a fixed
|
||||||
|
// distance from the bar and the screen edge regardless of where this
|
||||||
|
// icon sits in the row.
|
||||||
|
required property var barWindow
|
||||||
|
|
||||||
|
readonly property bool onBattery: UPower.onBattery
|
||||||
|
// Named deviceState, not "state" — Item already has a built-in `state`
|
||||||
|
// property (the property-based state-machine one) that this would
|
||||||
|
// otherwise collide with.
|
||||||
|
readonly property int deviceState: root.batteryPresent ? root.device.state : UPowerDeviceState.Unknown
|
||||||
|
readonly property bool fullyCharged: root.deviceState === UPowerDeviceState.FullyCharged
|
||||||
|
readonly property bool charging: root.batteryPresent && !root.onBattery && !root.fullyCharged
|
||||||
|
// device.percentage is a 0..1 fraction despite the name (same convention
|
||||||
|
// Volume.qml relies on for Pipewire's audio.volume).
|
||||||
|
readonly property real fraction: root.batteryPresent ? Math.max(0, Math.min(1, root.device.percentage)) : 0
|
||||||
|
readonly property bool low: root.batteryPresent && root.fraction <= 0.15 && !root.charging
|
||||||
|
|
||||||
|
function batteryIcon() {
|
||||||
|
if (!root.batteryPresent) return "battery_unknown"
|
||||||
|
if (root.fullyCharged) return "battery_full"
|
||||||
|
if (root.charging) return "battery_charging_full"
|
||||||
|
if (root.fraction <= 0.1) return "battery_alert"
|
||||||
|
const bars = ["battery_0_bar", "battery_1_bar", "battery_2_bar", "battery_3_bar", "battery_4_bar", "battery_5_bar", "battery_full"]
|
||||||
|
return bars[Math.max(0, Math.min(bars.length - 1, Math.round(root.fraction * (bars.length - 1))))]
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDuration(seconds) {
|
||||||
|
const s = Math.max(0, Math.round(seconds || 0))
|
||||||
|
if (s <= 0) return "—"
|
||||||
|
const h = Math.floor(s / 3600)
|
||||||
|
const m = Math.round((s % 3600) / 60)
|
||||||
|
return h > 0 ? (h + "h " + m + "m") : (m + "m")
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property string modeLabel: {
|
||||||
|
if (!root.batteryPresent) return ""
|
||||||
|
if (root.fullyCharged) return "Fully charged"
|
||||||
|
return root.onBattery ? "On battery" : "Charging"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cute rotating status phrases while current is actually flowing —
|
||||||
|
// ported as-is from omarchy's power panel, which pairs the same phrase
|
||||||
|
// sets with the same charging/on-battery states.
|
||||||
|
readonly property var chargingPhrases: [
|
||||||
|
"Pumping power", "Injecting electrons", "Pouring juice", "Amassing watts",
|
||||||
|
"Hoarding joules", "Sucking volts", "Topping reserves", "Soaking amps", "Inhaling kilowatts"
|
||||||
|
]
|
||||||
|
readonly property var onBatteryPhrases: [
|
||||||
|
"Slurping power", "Spending joules", "Draining watts", "Burning electrons",
|
||||||
|
"Sipping juice", "Spending coulombs", "Bleeding amps", "Guzzling volts", "Munching reserves"
|
||||||
|
]
|
||||||
|
readonly property var activePhrases: root.fullyCharged ? []
|
||||||
|
: (root.charging ? root.chargingPhrases : (root.onBattery ? root.onBatteryPhrases : []))
|
||||||
|
readonly property bool rotatingPhrases: root.activePhrases.length > 0
|
||||||
|
property int phraseIndex: 0
|
||||||
|
readonly property string heroStatusText: root.rotatingPhrases
|
||||||
|
? root.activePhrases[root.phraseIndex % root.activePhrases.length]
|
||||||
|
: root.modeLabel
|
||||||
|
|
||||||
|
// Only rotates while the panel is open and actually charging/discharging.
|
||||||
|
Timer {
|
||||||
|
id: phraseTimer
|
||||||
|
interval: 2800
|
||||||
|
running: panel.visible && root.rotatingPhrases
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: false
|
||||||
|
onTriggered: phraseSwap.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: phraseSwap
|
||||||
|
PropertyAnimation { target: heroStatus; property: "opacity"; to: 0.0; duration: 180; easing.type: Easing.OutQuad }
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
const n = root.activePhrases.length
|
||||||
|
if (n > 0) root.phraseIndex = (root.phraseIndex + 1) % n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyAnimation { target: heroStatus; property: "opacity"; to: 1.0; duration: 260; easing.type: Easing.InQuad }
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we leave a rotating state mid-swap (e.g. unplugged mid-fade),
|
||||||
|
// snap back to full opacity so the new state reads immediately.
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
function onRotatingPhrasesChanged() {
|
||||||
|
if (!root.rotatingPhrases) {
|
||||||
|
phraseSwap.stop()
|
||||||
|
heroStatus.opacity = 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Power profile list ------------------------------------------------
|
||||||
|
// power-profiles-daemon only ever exposes these three fixed profiles;
|
||||||
|
// Performance is conditional on hasPerformanceProfile (e.g. absent on
|
||||||
|
// battery-only/thermally-limited hardware) — same gating omarchy's own
|
||||||
|
// Model.js applies via its profile-list script.
|
||||||
|
readonly property var profileEntries: {
|
||||||
|
const entries = [
|
||||||
|
{ value: PowerProfile.PowerSaver, label: "Saver", icon: "eco" },
|
||||||
|
{ value: PowerProfile.Balanced, label: "Balanced", icon: "balance" }
|
||||||
|
]
|
||||||
|
if (PowerProfiles.hasPerformanceProfile)
|
||||||
|
entries.push({ value: PowerProfile.Performance, label: "Performance", icon: "bolt" })
|
||||||
|
return entries
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: label
|
||||||
|
anchors.centerIn: parent
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: root.low ? Colors.urgent : Colors.foreground
|
||||||
|
text: root.batteryIcon()
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
panel.visible = !panel.visible
|
||||||
|
grab.active = panel.visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Reusable pieces -----------------------------------------------
|
||||||
|
|
||||||
|
component ProfileButton: Rectangle {
|
||||||
|
id: profBtn
|
||||||
|
required property string label
|
||||||
|
required property string icon
|
||||||
|
required property bool active
|
||||||
|
signal activate()
|
||||||
|
width: parent ? parent.width : 0
|
||||||
|
radius: 0
|
||||||
|
implicitHeight: 44
|
||||||
|
color: mouse.containsMouse ? Colors.primary
|
||||||
|
: (profBtn.active ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the button rather than drawn on
|
||||||
|
// its own edge — same treatment as this project's other selectable
|
||||||
|
// rows (e.g. Volume.qml's DeviceRow).
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: mouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 2
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: profBtn.icon
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 18
|
||||||
|
color: mouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: profBtn.label
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
font.bold: profBtn.active
|
||||||
|
color: mouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouse
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: profBtn.activate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component StatRow: RowLayout {
|
||||||
|
id: statRow
|
||||||
|
width: parent.width
|
||||||
|
property string label: ""
|
||||||
|
property string value: ""
|
||||||
|
Text {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: statRow.label
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: statRow.value
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Panel -----------------------------------------------------------
|
||||||
|
|
||||||
|
PopupWindow {
|
||||||
|
id: panel
|
||||||
|
visible: false
|
||||||
|
color: "transparent"
|
||||||
|
readonly property int contentWidth: 244
|
||||||
|
readonly property int contentPadding: 16
|
||||||
|
implicitWidth: contentWidth + contentPadding * 2
|
||||||
|
implicitHeight: mainColumn.implicitHeight + contentPadding * 2
|
||||||
|
|
||||||
|
anchor {
|
||||||
|
window: root.barWindow
|
||||||
|
// Unlike anchor.item, anchor.window doesn't default rect to the
|
||||||
|
// window's own bounds — set it explicitly so edges/gravity below
|
||||||
|
// resolve against the full bar (and thus the true screen edges)
|
||||||
|
// instead of a near-zero rect at the window's origin.
|
||||||
|
rect.x: 0
|
||||||
|
rect.y: 0
|
||||||
|
rect.width: root.barWindow.width
|
||||||
|
rect.height: root.barWindow.height
|
||||||
|
edges: Edges.Bottom | Edges.Right
|
||||||
|
gravity: Edges.Bottom | Edges.Left
|
||||||
|
margins.bottom: -4
|
||||||
|
margins.right: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
id: grab
|
||||||
|
windows: [panel]
|
||||||
|
onCleared: panel.visible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: 0
|
||||||
|
color: Colors.surface
|
||||||
|
border.color: Colors.muted
|
||||||
|
border.width: 3
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: mainColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: panel.contentPadding
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
// Hero: icon · title/status · percentage
|
||||||
|
RowLayout {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: root.batteryIcon()
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 30
|
||||||
|
color: root.low ? Colors.urgent : Colors.foreground
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 2
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: "Battery"
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: 18
|
||||||
|
font.bold: true
|
||||||
|
color: Colors.foreground
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
id: heroStatus
|
||||||
|
width: parent.width
|
||||||
|
text: root.heroStatusText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: Math.round(root.fraction * 100) + "%"
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: 20
|
||||||
|
font.bold: true
|
||||||
|
color: Colors.foreground
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Charge level bar
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: 4
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: 0
|
||||||
|
color: Colors.muted
|
||||||
|
opacity: 0.35
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
radius: 0
|
||||||
|
color: root.low ? Colors.urgent : Colors.primary
|
||||||
|
width: Math.max(height, parent.width * root.fraction)
|
||||||
|
Behavior on width { NumberAnimation { duration: 320; easing.type: Easing.OutCubic } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stats
|
||||||
|
RowLayout {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 16
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 4
|
||||||
|
StatRow { label: "STATE"; value: root.modeLabel }
|
||||||
|
StatRow {
|
||||||
|
label: "HEALTH"
|
||||||
|
value: (root.batteryPresent && root.device.healthSupported)
|
||||||
|
? Math.round(root.device.healthPercentage) + "%" : "—"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 4
|
||||||
|
StatRow {
|
||||||
|
label: root.onBattery ? "TIME LEFT" : "TIME TO FULL"
|
||||||
|
value: root.batteryPresent
|
||||||
|
? root.formatDuration(root.onBattery ? root.device.timeToEmpty : root.device.timeToFull)
|
||||||
|
: "—"
|
||||||
|
}
|
||||||
|
StatRow {
|
||||||
|
label: "RATE"
|
||||||
|
value: root.batteryPresent ? Math.abs(root.device.changeRate).toFixed(1) + " W" : "—"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power profile picker
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "POWER PROFILE"
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: profileRow
|
||||||
|
width: parent.width
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
readonly property real cellWidth: root.profileEntries.length > 0
|
||||||
|
? (width - spacing * (root.profileEntries.length - 1)) / root.profileEntries.length
|
||||||
|
: 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: root.profileEntries
|
||||||
|
ProfileButton {
|
||||||
|
required property var modelData
|
||||||
|
width: profileRow.cellWidth
|
||||||
|
label: modelData.label
|
||||||
|
icon: modelData.icon
|
||||||
|
active: PowerProfiles.profile === modelData.value
|
||||||
|
onActivate: PowerProfiles.profile = modelData.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,15 @@ import "../../config"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: label.implicitWidth + 4
|
// Independent left/right breathing room around the glyph. Material
|
||||||
|
// Symbols icons aren't monospaced — each one's font-reported advance
|
||||||
|
// width (label.implicitWidth) bakes in its own side bearings, so the
|
||||||
|
// same "+4, centered" math that every other bar icon uses can still
|
||||||
|
// look tighter/looser icon-to-icon. Tune these two by eye instead of
|
||||||
|
// the icon's own bounding box to even it out against its neighbours.
|
||||||
|
property real iconLeftPadding: 0
|
||||||
|
property real iconRightPadding: 0
|
||||||
|
implicitWidth: root.iconLeftPadding + label.implicitWidth + root.iconRightPadding
|
||||||
implicitHeight: Appearance.barHeight
|
implicitHeight: Appearance.barHeight
|
||||||
|
|
||||||
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
||||||
@@ -71,6 +79,7 @@ Item {
|
|||||||
bonded: !!d.bonded,
|
bonded: !!d.bonded,
|
||||||
trusted: !!d.trusted,
|
trusted: !!d.trusted,
|
||||||
pairing: !!d.pairing,
|
pairing: !!d.pairing,
|
||||||
|
state: d.state,
|
||||||
batteryAvailable: !!d.batteryAvailable,
|
batteryAvailable: !!d.batteryAvailable,
|
||||||
battery: d.battery || 0
|
battery: d.battery || 0
|
||||||
}
|
}
|
||||||
@@ -97,19 +106,107 @@ Item {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Action feedback ---------------------------------------------------
|
||||||
|
// BlueZ operations here are fire-and-forget from QML's side — connect()/
|
||||||
|
// disconnect()/pair()/forget() report failure only via a C++-side log
|
||||||
|
// line (see quickshell's bluetooth/device.cpp), nothing reaches QML. So
|
||||||
|
// "did it work" has to be inferred from the device's own properties
|
||||||
|
// instead of a success/failure callback. Shown as a line right under the
|
||||||
|
// specific row it's about (DeviceRow.statusText below) rather than a
|
||||||
|
// panel-wide banner — actionStatusAddress is how a row knows a message
|
||||||
|
// is meant for it; since it's address-keyed rather than tied to a
|
||||||
|
// particular DeviceRow instance, the message still finds its row even
|
||||||
|
// when the device jumps sections (Paired → Connected on a successful
|
||||||
|
// connect, say), because that's a new DeviceRow for the same address.
|
||||||
|
// - busyStatus is purely reactive — it just reads pairing/state off
|
||||||
|
// whichever row is currently mid-operation, however that operation
|
||||||
|
// was triggered. It's not shown directly (each row already derives
|
||||||
|
// the same "Connecting…"/"Disconnecting…" off its own dev.state);
|
||||||
|
// it only exists here to tell resolvePendingAction when to fire.
|
||||||
|
// - pendingAction+the busyStatus watcher below is how a *specific*
|
||||||
|
// click gets its own outcome message: it snapshots what was asked
|
||||||
|
// for, waits for busyStatus to clear, then checks whether the
|
||||||
|
// expected end state (connected/paired) actually landed.
|
||||||
|
readonly property string busyStatus: {
|
||||||
|
for (const r of root.deviceRows) {
|
||||||
|
if (r.pairing) return "pairing:" + r.address
|
||||||
|
if (r.state === BluetoothDeviceState.Connecting) return "connecting:" + r.address
|
||||||
|
if (r.state === BluetoothDeviceState.Disconnecting) return "disconnecting:" + r.address
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
property var pendingAction: null
|
||||||
|
property string actionStatus: ""
|
||||||
|
property string actionStatusAddress: ""
|
||||||
|
|
||||||
|
// Checks whether pendingAction's expected end state actually landed and
|
||||||
|
// reports it, then clears pendingAction. Called both when busyStatus
|
||||||
|
// clears normally and from pendingTimeoutTimer below — an operation
|
||||||
|
// that resolves inside a single binding re-evaluation (a device already
|
||||||
|
// in range reconnecting near-instantly, say) can flip busyStatus from ""
|
||||||
|
// straight back to "" without ever visibly changing, which would
|
||||||
|
// otherwise leave pendingAction stuck forever and misattribute whatever
|
||||||
|
// busyStatus transition happens to come along next.
|
||||||
|
function resolvePendingAction() {
|
||||||
|
if (!root.pendingAction) return
|
||||||
|
const p = root.pendingAction
|
||||||
|
root.pendingAction = null
|
||||||
|
const d = root.deviceForAddress(p.address)
|
||||||
|
root.actionStatusAddress = p.address
|
||||||
|
if (p.kind === "disconnect") {
|
||||||
|
root.actionStatus = (d && !d.connected) ? "Disconnected" : "Couldn't disconnect"
|
||||||
|
} else if (p.kind === "pair") {
|
||||||
|
root.actionStatus = (d && d.paired) ? "Paired" : "Couldn't pair"
|
||||||
|
} else {
|
||||||
|
root.actionStatus = (d && d.connected) ? "Connected" : "Couldn't connect"
|
||||||
|
}
|
||||||
|
actionStatusTimer.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
onBusyStatusChanged: if (root.busyStatus === "") root.resolvePendingAction()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: actionStatusTimer
|
||||||
|
interval: 3500
|
||||||
|
repeat: false
|
||||||
|
onTriggered: root.actionStatus = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backstop for the "resolved before busyStatus ever visibly changed"
|
||||||
|
// case above, and a genuine timeout for an operation that's just stuck
|
||||||
|
// (device out of range, etc.) — either way, restarted whenever
|
||||||
|
// pendingAction is (re)set, so it always reflects the latest click.
|
||||||
|
Timer {
|
||||||
|
id: pendingTimeoutTimer
|
||||||
|
interval: 8000
|
||||||
|
repeat: false
|
||||||
|
onTriggered: root.resolvePendingAction()
|
||||||
|
}
|
||||||
|
|
||||||
function connectDevice(row) {
|
function connectDevice(row) {
|
||||||
const d = root.deviceForAddress(row.address)
|
const d = root.deviceForAddress(row.address)
|
||||||
if (!d) return
|
if (!d) return
|
||||||
// Already-paired devices just reconnect; a fresh discovery result
|
// Already-paired devices just reconnect; a fresh discovery result
|
||||||
// has to pair first (BlueZ's own agent handles the SSP/passkey
|
// has to pair first (BlueZ's own agent handles the SSP/passkey
|
||||||
// handshake — there's no PIN-entry surface exposed by this API).
|
// handshake — there's no PIN-entry surface exposed by this API).
|
||||||
if (row.paired || row.bonded || row.trusted) d.connect()
|
if (row.paired || row.bonded || row.trusted) {
|
||||||
else d.pair()
|
root.pendingAction = { address: row.address, kind: "connect" }
|
||||||
|
pendingTimeoutTimer.restart()
|
||||||
|
d.connect()
|
||||||
|
} else {
|
||||||
|
root.pendingAction = { address: row.address, kind: "pair" }
|
||||||
|
pendingTimeoutTimer.restart()
|
||||||
|
d.pair()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnectDevice(row) {
|
function disconnectDevice(row) {
|
||||||
const d = root.deviceForAddress(row.address)
|
const d = root.deviceForAddress(row.address)
|
||||||
if (d) d.disconnect()
|
if (!d) return
|
||||||
|
root.pendingAction = { address: row.address, kind: "disconnect" }
|
||||||
|
pendingTimeoutTimer.restart()
|
||||||
|
d.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
function forgetDevice(row) {
|
function forgetDevice(row) {
|
||||||
@@ -117,6 +214,18 @@ Item {
|
|||||||
if (!d) return
|
if (!d) return
|
||||||
if (d.connected) d.disconnect()
|
if (d.connected) d.disconnect()
|
||||||
d.forget()
|
d.forget()
|
||||||
|
// No feedback line here — forgetting removes this row from every
|
||||||
|
// list immediately, so there's nothing left to show a message
|
||||||
|
// under. The row vanishing is the confirmation.
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTrusted(row, trusted) {
|
||||||
|
const d = root.deviceForAddress(row.address)
|
||||||
|
if (!d) return
|
||||||
|
d.trusted = trusted
|
||||||
|
root.actionStatusAddress = row.address
|
||||||
|
root.actionStatus = trusted ? "Trusting" : "No longer trusting"
|
||||||
|
actionStatusTimer.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property bool anyConnected: root.connectedRows.length > 0
|
readonly property bool anyConnected: root.connectedRows.length > 0
|
||||||
@@ -128,8 +237,10 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
anchors.centerIn: parent
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.family: Appearance.iconFontFamily
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: root.iconLeftPadding
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: (root.adapter && root.adapter.enabled) ? Colors.foreground : Colors.muted
|
color: (root.adapter && root.adapter.enabled) ? Colors.foreground : Colors.muted
|
||||||
@@ -163,6 +274,18 @@ Item {
|
|||||||
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
||||||
opacity: toggleRoot.checked ? 1 : 0.35
|
opacity: toggleRoot.checked ? 1 : 0.35
|
||||||
}
|
}
|
||||||
|
// Hover-only outline, offset outside the switch itself rather than
|
||||||
|
// drawn on its edge — the switch lags behind a click until the
|
||||||
|
// backend confirms it (e.g. the adapter's enabled state), so this
|
||||||
|
// is just a "you can click this" cue, not click feedback.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -4
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: toggleMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.height - 4
|
width: parent.height - 4
|
||||||
height: parent.height - 4
|
height: parent.height - 4
|
||||||
@@ -173,14 +296,21 @@ Item {
|
|||||||
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: toggleMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: toggleRoot.toggled()
|
onClicked: toggleRoot.toggled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// One device row. `showForget` hides the forget (x) button for
|
// One device row. `showForget` gates the whole trailing action cluster —
|
||||||
// discovered-but-unpaired devices, which have nothing to forget yet.
|
// trust toggle, disconnect, forget — for discovered-but-unpaired devices,
|
||||||
|
// which have none of those to act on yet (a plain click there pairs
|
||||||
|
// instead, via activate()). For a paired/connected row, the row body
|
||||||
|
// itself still connects/disconnects (activate()) same as before; the
|
||||||
|
// actions below are the explicit, discoverable versions of that plus
|
||||||
|
// the two this row previously had no way to reach at all.
|
||||||
component DeviceRow: Rectangle {
|
component DeviceRow: Rectangle {
|
||||||
id: devRow
|
id: devRow
|
||||||
required property var dev
|
required property var dev
|
||||||
@@ -189,9 +319,47 @@ Item {
|
|||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
radius: 0
|
radius: 0
|
||||||
implicitHeight: rowContent.implicitHeight + 12
|
implicitHeight: rowContent.implicitHeight + 12
|
||||||
color: devRow.dev.connected
|
|
||||||
? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18)
|
// Which action icon (if any) the pointer is currently over — drives
|
||||||
: (rowMouse.containsMouse ? Colors.primary : "transparent")
|
// both that icon's own hover color below and rowMouse's click
|
||||||
|
// dispatch. Derived from rowMouse.mouseX/containsMouse rather than a
|
||||||
|
// MouseArea on each icon: those icons live inside rowContent, which
|
||||||
|
// sits underneath rowMouse in stacking order, so a nested MouseArea
|
||||||
|
// there would just be shadowed by it (same reason
|
||||||
|
// NetworkIndicator.qml's NetworkRow dispatches by position too).
|
||||||
|
// Checked right-to-left since that's the order the icons are laid
|
||||||
|
// out in, so an earlier icon's "from here to the row's right edge"
|
||||||
|
// zone doesn't swallow the ones after it.
|
||||||
|
readonly property string hoveredAction: {
|
||||||
|
if (!rowMouse.containsMouse) return ""
|
||||||
|
if (devRow.showForget && forgetIcon.visible
|
||||||
|
&& rowMouse.mouseX >= devRow.mapFromItem(forgetIcon, 0, 0).x - 8) return "forget"
|
||||||
|
if (devRow.showForget && trustIcon.visible
|
||||||
|
&& rowMouse.mouseX >= devRow.mapFromItem(trustIcon, 0, 0).x - 8) return "trust"
|
||||||
|
if (disconnectIcon.visible
|
||||||
|
&& rowMouse.mouseX >= devRow.mapFromItem(disconnectIcon, 0, 0).x - 8) return "disconnect"
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
// Hover checked first (same ordering as Volume.qml's DeviceRow):
|
||||||
|
// hovering always shows a solid Colors.primary fill, even for an
|
||||||
|
// already-connected row, so the primaryText used below never has to
|
||||||
|
// sit on top of the dimmer translucent tint instead.
|
||||||
|
color: rowMouse.containsMouse ? Colors.primary
|
||||||
|
: (devRow.dev.connected ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row rather than drawn on
|
||||||
|
// its own edge — same treatment as NetworkIndicator.qml's NetworkRow.
|
||||||
|
// The lists this feeds are inset by 3px (see deviceListColumn and
|
||||||
|
// the Connected section below) so this has room without being
|
||||||
|
// cropped by deviceListFlick's clip.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: rowMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowContent
|
id: rowContent
|
||||||
@@ -207,7 +375,7 @@ Item {
|
|||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: devRow.dev.icon
|
text: devRow.dev.icon
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -229,6 +397,17 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
readonly property string statusText: {
|
readonly property string statusText: {
|
||||||
if (devRow.dev.pairing) return "Pairing…"
|
if (devRow.dev.pairing) return "Pairing…"
|
||||||
|
if (devRow.dev.state === BluetoothDeviceState.Connecting) return "Connecting…"
|
||||||
|
if (devRow.dev.state === BluetoothDeviceState.Disconnecting) return "Disconnecting…"
|
||||||
|
// The outcome of the last action taken on this
|
||||||
|
// specific device (connect/disconnect/pair/trust) —
|
||||||
|
// see the "Action feedback" comment above
|
||||||
|
// root.busyStatus. Matched by address rather than by
|
||||||
|
// this being "the same row" that was clicked, since
|
||||||
|
// a successful connect/disconnect moves the device
|
||||||
|
// to a different section (a new DeviceRow entirely).
|
||||||
|
if (root.actionStatusAddress === devRow.dev.address && root.actionStatus !== "")
|
||||||
|
return root.actionStatus
|
||||||
if (devRow.dev.connected && devRow.dev.batteryAvailable)
|
if (devRow.dev.connected && devRow.dev.batteryAvailable)
|
||||||
return Math.round(devRow.dev.battery * 100) + "%"
|
return Math.round(devRow.dev.battery * 100) + "%"
|
||||||
if (devRow.dev.connected) return "Connected"
|
if (devRow.dev.connected) return "Connected"
|
||||||
@@ -242,14 +421,97 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
// Each action below is a fixed-size slot with its own
|
||||||
|
// hover-halo outline — offset outside the slot rather than drawn
|
||||||
|
// on its own edge, same treatment as devRow's own outline above
|
||||||
|
// and every other hoverable box in this file (ToggleSwitch,
|
||||||
|
// DeviceRow itself, etc.) — instead of just the color swap the
|
||||||
|
// row's own icons get.
|
||||||
|
|
||||||
|
// Disconnect without forgetting — same effect as clicking the
|
||||||
|
// row body on a Connected row (activate() below calls
|
||||||
|
// disconnectDevice too), just given its own explicit, always-
|
||||||
|
// visible icon instead of relying on that being guessed.
|
||||||
|
Item {
|
||||||
|
id: disconnectIcon
|
||||||
|
visible: devRow.showForget && devRow.dev.connected
|
||||||
|
Layout.preferredWidth: 20
|
||||||
|
Layout.preferredHeight: 20
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: devRow.hoveredAction === "disconnect" ? 1 : 0
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "link_off"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 14
|
||||||
|
// Stays primaryText (dark) rather than switching to
|
||||||
|
// Colors.primary while targeted — devRow's own fill is
|
||||||
|
// already Colors.primary on hover, so that would've put
|
||||||
|
// a primary-colored glyph on a primary-colored
|
||||||
|
// background. The outline Rectangle above is what shows
|
||||||
|
// which slot is targeted.
|
||||||
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trust toggle — full brightness when trusted, dimmed when not,
|
||||||
|
// same "state via opacity" convention PowerButton.qml uses for
|
||||||
|
// its disabled entries.
|
||||||
|
Item {
|
||||||
|
id: trustIcon
|
||||||
|
visible: devRow.showForget
|
||||||
|
Layout.preferredWidth: 20
|
||||||
|
Layout.preferredHeight: 20
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: devRow.hoveredAction === "trust" ? 1 : 0
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "verified_user"
|
||||||
|
opacity: devRow.dev.trusted ? 1 : 0.4
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 14
|
||||||
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
id: forgetIcon
|
id: forgetIcon
|
||||||
visible: devRow.showForget
|
visible: devRow.showForget
|
||||||
text: "close"
|
Layout.preferredWidth: 20
|
||||||
font.family: Appearance.iconFontFamily
|
Layout.preferredHeight: 20
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
|
||||||
font.pixelSize: 14
|
Rectangle {
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: devRow.hoveredAction === "forget" ? 1 : 0
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "close"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 14
|
||||||
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,21 +523,15 @@ Item {
|
|||||||
height: rowContent.height + 12
|
height: rowContent.height + 12
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
// forgetIcon has no MouseArea of its own — nested inside
|
// Dispatches on devRow.hoveredAction rather than its own
|
||||||
// rowContent, which sits underneath this full-row area in
|
// MouseArea per icon — see that property's comment above.
|
||||||
// stacking order, so a separate MouseArea there would just be
|
onClicked: {
|
||||||
// shadowed (see the identical fix in NetworkIndicator.qml's
|
switch (devRow.hoveredAction) {
|
||||||
// NetworkRow). Dispatch by click position against this single
|
case "forget": root.forgetDevice(devRow.dev); break
|
||||||
// area instead.
|
case "trust": root.setTrusted(devRow.dev, !devRow.dev.trusted); break
|
||||||
onClicked: (mouse) => {
|
case "disconnect": root.disconnectDevice(devRow.dev); break
|
||||||
if (devRow.showForget && forgetIcon.visible) {
|
default: devRow.activate()
|
||||||
const forgetLeft = devRow.mapFromItem(forgetIcon, 0, 0).x
|
|
||||||
if (mouse.x >= forgetLeft - 8) {
|
|
||||||
root.forgetDevice(devRow.dev)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
devRow.activate()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,7 +542,11 @@ Item {
|
|||||||
id: panel
|
id: panel
|
||||||
visible: false
|
visible: false
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
readonly property int contentWidth: 244
|
// Wider than the other panels' usual 244 — each device row now ends
|
||||||
|
// in a row of three 20px action slots (disconnect/trust/forget)
|
||||||
|
// instead of a single close icon, and the name column needs room to
|
||||||
|
// not immediately start eliding against that.
|
||||||
|
readonly property int contentWidth: 300
|
||||||
readonly property int contentPadding: 16
|
readonly property int contentPadding: 16
|
||||||
implicitWidth: contentWidth + contentPadding * 2
|
implicitWidth: contentWidth + contentPadding * 2
|
||||||
implicitHeight: mainColumn.implicitHeight + contentPadding * 2
|
implicitHeight: mainColumn.implicitHeight + contentPadding * 2
|
||||||
@@ -335,9 +595,9 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: label.text
|
text: label.text
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 30
|
font.pixelSize: 21
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,6 +610,29 @@ Item {
|
|||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spins continuously while root.adapter.discovering is
|
||||||
|
// true — a persistent "still searching" cue independent
|
||||||
|
// of the list itself, unlike the "Scanning for devices…"
|
||||||
|
// text below (which only shows while the device list is
|
||||||
|
// still empty).
|
||||||
|
Text {
|
||||||
|
id: scanSpinner
|
||||||
|
visible: root.adapter !== null && root.adapter.discovering
|
||||||
|
text: "progress_activity"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: Colors.muted
|
||||||
|
|
||||||
|
RotationAnimation on rotation {
|
||||||
|
running: scanSpinner.visible
|
||||||
|
loops: Animation.Infinite
|
||||||
|
from: 0
|
||||||
|
to: 360
|
||||||
|
duration: 900
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ToggleSwitch {
|
ToggleSwitch {
|
||||||
visible: root.adapter !== null
|
visible: root.adapter !== null
|
||||||
checked: root.adapter !== null && root.adapter.enabled
|
checked: root.adapter !== null && root.adapter.enabled
|
||||||
@@ -389,7 +672,10 @@ Item {
|
|||||||
color: Colors.muted
|
color: Colors.muted
|
||||||
}
|
}
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
// Inset 3px on each side to match deviceListColumn
|
||||||
|
// below, so DeviceRow's hover halo has room here too.
|
||||||
|
x: 3
|
||||||
|
width: parent.width - 6
|
||||||
spacing: 2
|
spacing: 2
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.connectedRows
|
model: root.connectedRows
|
||||||
@@ -403,6 +689,42 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paired — always shown in full, same as Connected above and
|
||||||
|
// for the same reason: these are one click away from
|
||||||
|
// reconnecting (root.connectDevice reconnects rather than
|
||||||
|
// re-pairing whenever a row is already paired/bonded/trusted),
|
||||||
|
// so they shouldn't be buried in the capped-height scroll area
|
||||||
|
// below or hidden behind an active scan turning up other
|
||||||
|
// nearby devices.
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
visible: root.knownRows.length > 0
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Paired Devices"
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
Column {
|
||||||
|
// Inset 3px on each side to match deviceListColumn
|
||||||
|
// below, so DeviceRow's hover halo has room here too.
|
||||||
|
x: 3
|
||||||
|
width: parent.width - 6
|
||||||
|
spacing: 2
|
||||||
|
Repeater {
|
||||||
|
model: root.knownRows
|
||||||
|
DeviceRow {
|
||||||
|
required property var modelData
|
||||||
|
dev: modelData
|
||||||
|
showForget: true
|
||||||
|
onActivate: root.connectDevice(dev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: root.adapter !== null && root.adapter.enabled && root.deviceRows.length === 0
|
visible: root.adapter !== null && root.adapter.enabled && root.deviceRows.length === 0
|
||||||
@@ -412,9 +734,9 @@ Item {
|
|||||||
color: Colors.muted
|
color: Colors.muted
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paired/Available — capped height, scrolls once there are
|
// Available — freshly discovered, unpaired devices only.
|
||||||
// more devices than fit rather than growing the popup
|
// Capped height, scrolls once there are more than fit rather
|
||||||
// indefinitely.
|
// than growing the popup indefinitely.
|
||||||
Flickable {
|
Flickable {
|
||||||
id: deviceListFlick
|
id: deviceListFlick
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -427,35 +749,19 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: deviceListColumn
|
id: deviceListColumn
|
||||||
width: deviceListFlick.width
|
// Inset 3px on every side so DeviceRow's hover halo
|
||||||
|
// has room without being cropped by deviceListFlick's
|
||||||
|
// clip. Left/right needs the manual x/width shift
|
||||||
|
// (children bind width: parent.width, which ignores
|
||||||
|
// Column's own padding); top/bottom just needs
|
||||||
|
// padding, since that's along Column's own layout
|
||||||
|
// axis and Flickable's contentHeight tracks it.
|
||||||
|
x: 3
|
||||||
|
width: deviceListFlick.width - 6
|
||||||
|
topPadding: 3
|
||||||
|
bottomPadding: 3
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
spacing: 4
|
|
||||||
visible: root.knownRows.length > 0
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Paired Devices"
|
|
||||||
font.family: Appearance.fontFamily
|
|
||||||
font.pixelSize: Appearance.fontSizeSmall
|
|
||||||
color: Colors.muted
|
|
||||||
}
|
|
||||||
Column {
|
|
||||||
width: parent.width
|
|
||||||
spacing: 2
|
|
||||||
Repeater {
|
|
||||||
model: root.knownRows
|
|
||||||
DeviceRow {
|
|
||||||
required property var modelData
|
|
||||||
dev: modelData
|
|
||||||
showForget: true
|
|
||||||
onActivate: root.connectDevice(dev)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|||||||
@@ -44,7 +44,13 @@ Item {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only scan for networks while the panel is actually open.
|
// Only scan for networks while the panel is actually open. Deliberately
|
||||||
|
// NOT paused while a password prompt is up: scannerEnabled: false stops
|
||||||
|
// NetworkManager from refreshing its AP cache at all, so the existing
|
||||||
|
// list quietly ages out with nothing to replace it — the fix for typing
|
||||||
|
// being interrupted by scan-driven refreshes lives below instead (the
|
||||||
|
// password field itself is pulled out of the repeated row so refreshes
|
||||||
|
// can't touch it), not here.
|
||||||
Binding {
|
Binding {
|
||||||
target: root.wifiDevice
|
target: root.wifiDevice
|
||||||
property: "scannerEnabled"
|
property: "scannerEnabled"
|
||||||
@@ -84,6 +90,24 @@ Item {
|
|||||||
? sortWifiRows(root.wifiDevice.networks.values.map(root.wifiRow).filter(function(r) { return r && r.ssid }))
|
? sortWifiRows(root.wifiDevice.networks.values.map(root.wifiRow).filter(function(r) { return r && r.ssid }))
|
||||||
: []
|
: []
|
||||||
|
|
||||||
|
// Quickshell's WifiDevice has no "a scan is in flight" signal — only
|
||||||
|
// scannerEnabled, the on/off request, which stays true for as long as
|
||||||
|
// the panel is open rather than pulsing per scan. wifiRows re-deriving
|
||||||
|
// to a new array (as it does on every actual network-list change — see
|
||||||
|
// the comment on wifiRow() above) is the closest available proxy for
|
||||||
|
// "a scan just landed", so pulse briefly off that instead.
|
||||||
|
property bool wifiJustScanned: false
|
||||||
|
onWifiRowsChanged: {
|
||||||
|
root.wifiJustScanned = true
|
||||||
|
wifiScanPulseTimer.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: wifiScanPulseTimer
|
||||||
|
interval: 1200
|
||||||
|
onTriggered: root.wifiJustScanned = false
|
||||||
|
}
|
||||||
|
|
||||||
// Split for the "Known Networks" / "Other Networks" sections. wifiRows
|
// Split for the "Known Networks" / "Other Networks" sections. wifiRows
|
||||||
// is already sorted connected-first then by signal, so filtering
|
// is already sorted connected-first then by signal, so filtering
|
||||||
// preserves that order within each group.
|
// preserves that order within each group.
|
||||||
@@ -135,8 +159,17 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSID of the row currently showing its inline password field, if any.
|
// SSID awaiting a password, if any. The input itself lives in a single
|
||||||
|
// persistent widget below the network list (see passwordEntryInput),
|
||||||
|
// not inside the per-row NetworkRow delegate — wifiRows is rebuilt from
|
||||||
|
// scratch on every scan result, and a Repeater over a plain array has no
|
||||||
|
// way to diff that, so it destroys and recreates every delegate each
|
||||||
|
// time. Keeping the field outside that churn is what lets typing survive
|
||||||
|
// a scan landing mid-keystroke.
|
||||||
property string passwordSsid: ""
|
property string passwordSsid: ""
|
||||||
|
// Cleared whenever the target SSID changes so stale text from a
|
||||||
|
// cancelled/previous prompt never carries over to the next one.
|
||||||
|
onPasswordSsidChanged: passwordEntryInput.text = ""
|
||||||
|
|
||||||
// Wired connections don't have a user-facing "name" on the device or
|
// Wired connections don't have a user-facing "name" on the device or
|
||||||
// Network object — those just expose the interface name (e.g. "eth0").
|
// Network object — those just expose the interface name (e.g. "eth0").
|
||||||
@@ -161,6 +194,14 @@ Item {
|
|||||||
return (row && row.ssid) || "Network"
|
return (row && row.ssid) || "Network"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Signal strength of the currently-connected WiFi network, if any — lets
|
||||||
|
// the bar icon show the same wifi-fan glyph (via wifiIcon()) as the
|
||||||
|
// connected row inside the popup, instead of a generic "wifi" icon.
|
||||||
|
readonly property int connectedWifiSignal: {
|
||||||
|
const row = root.wifiRows.find(function(r) { return r.connected })
|
||||||
|
return row ? row.signal : 0
|
||||||
|
}
|
||||||
|
|
||||||
function activateNetwork(net) {
|
function activateNetwork(net) {
|
||||||
if (net.connected) return
|
if (net.connected) return
|
||||||
if (net.known || !root.requiresCredentials(net.security)) {
|
if (net.known || !root.requiresCredentials(net.security)) {
|
||||||
@@ -171,6 +212,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitPassword() {
|
||||||
|
const n = root.networkForSsid(root.passwordSsid)
|
||||||
|
if (n && passwordEntryInput.text.length > 0) n.connectWithPsk(passwordEntryInput.text)
|
||||||
|
root.passwordSsid = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelPassword() {
|
||||||
|
root.passwordSsid = ""
|
||||||
|
}
|
||||||
|
|
||||||
// --- Live stats --------------------------------------------------
|
// --- Live stats --------------------------------------------------
|
||||||
// None of this comes from Quickshell's Networking API — it only knows
|
// None of this comes from Quickshell's Networking API — it only knows
|
||||||
// about devices/networks, not throughput, ping, or routing. So this
|
// about devices/networks, not throughput, ping, or routing. So this
|
||||||
@@ -517,14 +568,30 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: root.connectedDevice ? Colors.foreground : Colors.muted
|
color: root.connectedDevice ? Colors.foreground : Colors.muted
|
||||||
|
// Only Wired renders its own distinct glyph; disconnected uses
|
||||||
|
// "signal_wifi_off" — the actual off companion to the
|
||||||
|
// network_wifi/signal_wifi fan family used below (not "wifi_off",
|
||||||
|
// which belongs to a visually different, newer glyph family and
|
||||||
|
// looked inconsistent next to the connected bars) — so it needs the
|
||||||
|
// same vertical-stretch correction as the rest of that family.
|
||||||
|
readonly property bool isWifiFan: root.connectedDevice === null || root.connectedDevice.type !== DeviceType.Wired
|
||||||
text: {
|
text: {
|
||||||
if (!root.connectedDevice)
|
if (!root.connectedDevice)
|
||||||
return "wifi_off"
|
return "signal_wifi_off"
|
||||||
return root.connectedDevice.type === DeviceType.Wired ? "settings_ethernet" : "wifi"
|
if (root.connectedDevice.type === DeviceType.Wired)
|
||||||
|
return "settings_ethernet"
|
||||||
|
return root.wifiIcon(root.connectedWifiSignal)
|
||||||
|
}
|
||||||
|
// Same correction as the matching glyph inside the popup's
|
||||||
|
// NetworkRow — the wifi-fan family is inherently flat/wide.
|
||||||
|
transform: Scale {
|
||||||
|
origin.x: label.width / 2
|
||||||
|
origin.y: label.height / 2
|
||||||
|
yScale: label.isWifiFan ? 1.2 : 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,6 +619,18 @@ Item {
|
|||||||
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
||||||
opacity: toggleRoot.checked ? 1 : 0.35
|
opacity: toggleRoot.checked ? 1 : 0.35
|
||||||
}
|
}
|
||||||
|
// Hover-only outline, offset outside the switch itself rather than
|
||||||
|
// drawn on its edge — the switch lags behind a click until the
|
||||||
|
// backend confirms it (e.g. Networking.wifiEnabled), so this is just
|
||||||
|
// a "you can click this" cue, not click feedback.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -4
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: toggleMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.height - 4
|
width: parent.height - 4
|
||||||
height: parent.height - 4
|
height: parent.height - 4
|
||||||
@@ -562,7 +641,9 @@ Item {
|
|||||||
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: toggleMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: toggleRoot.toggled()
|
onClicked: toggleRoot.toggled()
|
||||||
}
|
}
|
||||||
@@ -572,18 +653,32 @@ Item {
|
|||||||
id: netRow
|
id: netRow
|
||||||
required property var net
|
required property var net
|
||||||
signal activate()
|
signal activate()
|
||||||
|
// Still tracked for the highlight below — the actual input lives
|
||||||
|
// outside this (repeatedly rebuilt) delegate, in the persistent
|
||||||
|
// password entry widget under the network list.
|
||||||
readonly property bool passwordOpen: root.passwordSsid === netRow.net.ssid
|
readonly property bool passwordOpen: root.passwordSsid === netRow.net.ssid
|
||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
radius: 0
|
radius: 0
|
||||||
implicitHeight: rowContent.implicitHeight + 12 + (passwordOpen ? passwordRow.implicitHeight + 6 : 0)
|
implicitHeight: rowContent.implicitHeight + 12
|
||||||
color: netRow.net.connected
|
// Hover checked first (same ordering as Volume.qml's DeviceRow):
|
||||||
? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18)
|
// hovering always shows a solid Colors.primary fill, even for an
|
||||||
: (rowMouse.containsMouse ? Colors.primary : "transparent")
|
// already-active row, so the primaryText used below never has to
|
||||||
|
// sit on top of the dimmer translucent tint instead.
|
||||||
|
color: rowMouse.containsMouse ? Colors.primary
|
||||||
|
: ((netRow.net.connected || netRow.passwordOpen) ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
function submit() {
|
// Hover-only outline, offset outside the row rather than drawn on
|
||||||
const n = root.networkForSsid(netRow.net.ssid)
|
// its own edge — same treatment as ToggleSwitch's halo and the DNS
|
||||||
if (n && passwordInput.text.length > 0) n.connectWithPsk(passwordInput.text)
|
// pills. networkListColumn insets its rows by 3px on each side
|
||||||
root.passwordSsid = ""
|
// specifically to give this room without getting cropped by the
|
||||||
|
// Flickable's clip.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: rowMouse.containsMouse ? 1 : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -600,11 +695,12 @@ Item {
|
|||||||
Layout.preferredWidth: 20
|
Layout.preferredWidth: 20
|
||||||
Layout.minimumWidth: 20
|
Layout.minimumWidth: 20
|
||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: root.wifiIcon(netRow.net.signal)
|
text: root.wifiIcon(netRow.net.signal)
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 16
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
// The wifi-fan glyph itself is flat/wide — stretch it
|
// The wifi-fan glyph itself is flat/wide — stretch it
|
||||||
// vertically to read taller while keeping its width (and
|
// vertically to read taller while keeping its width (and
|
||||||
@@ -639,7 +735,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
visible: root.requiresCredentials(netRow.net.security)
|
visible: root.requiresCredentials(netRow.net.security)
|
||||||
text: "lock"
|
text: "lock"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
@@ -648,59 +744,12 @@ Item {
|
|||||||
id: forgetIcon
|
id: forgetIcon
|
||||||
visible: netRow.net.known
|
visible: netRow.net.known
|
||||||
text: "close"
|
text: "close"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: passwordRow
|
|
||||||
visible: netRow.passwordOpen
|
|
||||||
width: parent.width
|
|
||||||
spacing: 6
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
implicitHeight: 24
|
|
||||||
radius: 0
|
|
||||||
color: Colors.background
|
|
||||||
border.color: Colors.muted
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
TextInput {
|
|
||||||
id: passwordInput
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 6
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
color: Colors.foreground
|
|
||||||
font.family: Appearance.fontFamily
|
|
||||||
font.pixelSize: Appearance.fontSizeSmall
|
|
||||||
clip: true
|
|
||||||
focus: netRow.passwordOpen
|
|
||||||
onAccepted: netRow.submit()
|
|
||||||
// Explicit fallback alongside onAccepted, which only
|
|
||||||
// fires when acceptableInput is true — covers both
|
|
||||||
// the main Return key and numpad Enter directly.
|
|
||||||
Keys.onReturnPressed: netRow.submit()
|
|
||||||
Keys.onEnterPressed: netRow.submit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "check"
|
|
||||||
font.family: Appearance.iconFontFamily
|
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
|
||||||
font.pixelSize: 16
|
|
||||||
color: Colors.primary
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: netRow.submit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -786,16 +835,25 @@ Item {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: headerIcon
|
||||||
text: label.text
|
text: label.text
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 30
|
font.pixelSize: 30
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
|
// Mirrors the bar icon's own correction — see label's
|
||||||
|
// isWifiFan/transform above — since this just
|
||||||
|
// displays the same text at a larger size.
|
||||||
|
transform: Scale {
|
||||||
|
origin.x: headerIcon.width / 2
|
||||||
|
origin.y: headerIcon.height / 2
|
||||||
|
yScale: label.isWifiFan ? 1.2 : 1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: root.connectedNetworkName
|
text: "Network"
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.family: Appearance.fontFamily
|
font.family: Appearance.fontFamily
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
@@ -804,6 +862,34 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Row rather than RowLayout — RowLayout is built for
|
||||||
|
// constraint-based stretching (Layout.fillWidth etc.), and
|
||||||
|
// without either Text opting into that, its sizing pass can
|
||||||
|
// still leave more room between them than spacing:0 implies.
|
||||||
|
// Row has no such stretch logic: spacing is exactly the gap
|
||||||
|
// you get, so these two sit flush (plus one small gap) no
|
||||||
|
// matter what width is bound above them.
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Connected Interface:"
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: root.connectedNetworkName
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.foreground
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Live stats — ping/loss/throughput/IP/gateway for whichever
|
// Live stats — ping/loss/throughput/IP/gateway for whichever
|
||||||
// device is currently connected.
|
// device is currently connected.
|
||||||
GridLayout {
|
GridLayout {
|
||||||
@@ -863,6 +949,18 @@ Item {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
opacity: root.dnsBusy ? 0.6 : 1
|
opacity: root.dnsBusy ? 0.6 : 1
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the pill
|
||||||
|
// itself rather than drawn on its own border —
|
||||||
|
// same treatment as ToggleSwitch's halo.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: dnsMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: dnsPill.modelData
|
text: dnsPill.modelData
|
||||||
@@ -936,7 +1034,7 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "check"
|
text: "check"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: Colors.primary
|
color: Colors.primary
|
||||||
@@ -974,7 +1072,7 @@ Item {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
Text {
|
Text {
|
||||||
text: "settings_ethernet"
|
text: "settings_ethernet"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
@@ -1025,6 +1123,32 @@ Item {
|
|||||||
font.pixelSize: Appearance.fontSize
|
font.pixelSize: Appearance.fontSize
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spins briefly each time a scan actually lands —
|
||||||
|
// same "still searching" cue as
|
||||||
|
// BluetoothIndicator.qml's spinner, but pulsed via
|
||||||
|
// wifiJustScanned (see above) rather than staying on
|
||||||
|
// for the whole time the panel is open, since
|
||||||
|
// WifiDevice has no per-scan signal of its own to
|
||||||
|
// key off.
|
||||||
|
Text {
|
||||||
|
id: wifiScanSpinner
|
||||||
|
visible: root.wifiDevice !== null && root.wifiDevice.scannerEnabled && root.wifiJustScanned
|
||||||
|
text: "progress_activity"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: Colors.muted
|
||||||
|
|
||||||
|
RotationAnimation on rotation {
|
||||||
|
running: wifiScanSpinner.visible
|
||||||
|
loops: Animation.Infinite
|
||||||
|
from: 0
|
||||||
|
to: 360
|
||||||
|
duration: 900
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ToggleSwitch {
|
ToggleSwitch {
|
||||||
checked: Networking.wifiEnabled
|
checked: Networking.wifiEnabled
|
||||||
onToggled: Networking.wifiEnabled = !Networking.wifiEnabled
|
onToggled: Networking.wifiEnabled = !Networking.wifiEnabled
|
||||||
@@ -1049,6 +1173,97 @@ Item {
|
|||||||
color: Colors.muted
|
color: Colors.muted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Password entry — a single persistent widget rather
|
||||||
|
// than living inside the NetworkRow delegate for
|
||||||
|
// root.passwordSsid, so a wifi scan landing mid-keystroke
|
||||||
|
// (which rebuilds the whole Known/Other Networks list
|
||||||
|
// below) can't destroy the focused TextInput and wipe
|
||||||
|
// out what's been typed. See passwordSsid's own comment.
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
visible: root.passwordSsid !== ""
|
||||||
|
radius: 0
|
||||||
|
color: Colors.background
|
||||||
|
border.color: Colors.muted
|
||||||
|
border.width: 1
|
||||||
|
implicitHeight: passwordEntryColumn.implicitHeight + 12
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: passwordEntryColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 6
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: "Password for “" + root.passwordSsid + "”"
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
color: Colors.muted
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: 24
|
||||||
|
radius: 0
|
||||||
|
color: Colors.surface
|
||||||
|
border.color: Colors.muted
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
id: passwordEntryInput
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 6
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Appearance.fontFamily
|
||||||
|
font.pixelSize: Appearance.fontSizeSmall
|
||||||
|
clip: true
|
||||||
|
focus: root.passwordSsid !== ""
|
||||||
|
onAccepted: root.submitPassword()
|
||||||
|
// Explicit fallback alongside onAccepted, which only
|
||||||
|
// fires when acceptableInput is true — covers both
|
||||||
|
// the main Return key and numpad Enter directly.
|
||||||
|
Keys.onReturnPressed: root.submitPassword()
|
||||||
|
Keys.onEnterPressed: root.submitPassword()
|
||||||
|
Keys.onEscapePressed: root.cancelPassword()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "check"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: Colors.primary
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.submitPassword()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "close"
|
||||||
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: Colors.muted
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.cancelPassword()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Known/Other Networks — capped height, scrolls once
|
// Known/Other Networks — capped height, scrolls once
|
||||||
// there are more networks than fit rather than growing
|
// there are more networks than fit rather than growing
|
||||||
// the popup indefinitely.
|
// the popup indefinitely.
|
||||||
@@ -1064,7 +1279,19 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: networkListColumn
|
id: networkListColumn
|
||||||
width: networkListFlick.width
|
// Inset 3px on every side (rather than flush with
|
||||||
|
// the Flickable) so NetworkRow's hover halo below
|
||||||
|
// has room to sit outside the row without being
|
||||||
|
// cropped by the Flickable's own clip. Left/right
|
||||||
|
// needs the manual x/width shift (children bind
|
||||||
|
// width: parent.width, which ignores Column's own
|
||||||
|
// padding); top/bottom just needs padding, since
|
||||||
|
// that's along Column's own layout axis and the
|
||||||
|
// Flickable's contentHeight tracks it.
|
||||||
|
x: 3
|
||||||
|
width: networkListFlick.width - 6
|
||||||
|
topPadding: 3
|
||||||
|
bottomPadding: 3
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import "../../config"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: label.implicitWidth + 4
|
implicitWidth: label.implicitWidth + 2
|
||||||
implicitHeight: Appearance.barHeight
|
implicitHeight: Appearance.barHeight
|
||||||
|
|
||||||
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
||||||
@@ -19,11 +19,11 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
text: "power_settings_new"
|
text: "settings_power"
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -41,10 +41,12 @@ Item {
|
|||||||
id: menu
|
id: menu
|
||||||
visible: false
|
visible: false
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
implicitWidth: 210
|
// Same contentWidth/contentPadding split as the other panels
|
||||||
// Same padding as Volume.qml's panel.
|
// (Volume.qml, NetworkIndicator.qml, etc.) rather than a single
|
||||||
|
// magic implicitWidth.
|
||||||
|
readonly property int contentWidth: 178
|
||||||
readonly property int contentPadding: 16
|
readonly property int contentPadding: 16
|
||||||
readonly property int labelOffset: -135
|
implicitWidth: contentWidth + contentPadding * 2
|
||||||
implicitHeight: mainColumn.implicitHeight + contentPadding * 2
|
implicitHeight: mainColumn.implicitHeight + contentPadding * 2
|
||||||
|
|
||||||
anchor {
|
anchor {
|
||||||
@@ -91,9 +93,9 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: label.text
|
text: label.text
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 30
|
font.pixelSize: 23
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,36 +124,55 @@ Item {
|
|||||||
{ label: "Shut down", icon: "power_settings_new", cmd: ["systemctl", "poweroff"] }
|
{ label: "Shut down", icon: "power_settings_new", cmd: ["systemctl", "poweroff"] }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Same shape as this project's other selectable rows
|
||||||
|
// (e.g. VpnIndicator.qml's ProviderRow,
|
||||||
|
// TailscaleIndicator.qml's ExitNodeRow): radius 0, a
|
||||||
|
// fixed-width icon column followed by a fillWidth
|
||||||
|
// label, and an offset hover halo rather than one
|
||||||
|
// drawn on the row's own edge.
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: entry
|
id: entry
|
||||||
required property var modelData
|
required property var modelData
|
||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
height: 40
|
radius: 0
|
||||||
radius: Appearance.radiusSmall
|
implicitHeight: entryContent.implicitHeight + 12
|
||||||
color: (!entry.modelData.disabled && entryMouse.containsMouse) ? Colors.primary : "transparent"
|
color: (!entry.modelData.disabled && entryMouse.containsMouse) ? Colors.primary : "transparent"
|
||||||
|
|
||||||
RowLayout {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: 8
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: entryMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: entryContent
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: 6
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.preferredWidth: 25
|
Layout.preferredWidth: 20
|
||||||
Layout.minimumWidth: 25
|
Layout.minimumWidth: 20
|
||||||
Layout.maximumWidth: 25
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: entry.modelData.icon
|
text: entry.modelData.icon
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: entry.modelData.iconSize || 15
|
font.pixelSize: 14
|
||||||
opacity: entry.modelData.disabled ? 0.4 : 1
|
opacity: entry.modelData.disabled ? 0.4 : 1
|
||||||
color: entryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: entryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
Layout.leftMargin: menu.labelOffset + (entry.modelData.textOffset || 0)
|
Layout.fillWidth: true
|
||||||
text: entry.modelData.label
|
text: entry.modelData.label
|
||||||
horizontalAlignment: Text.AlignLeft
|
elide: Text.ElideRight
|
||||||
font.family: Appearance.fontFamily
|
font.family: Appearance.fontFamily
|
||||||
font.pixelSize: 16
|
font.pixelSize: Appearance.fontSize
|
||||||
opacity: entry.modelData.disabled ? 0.4 : 1
|
opacity: entry.modelData.disabled ? 0.4 : 1
|
||||||
color: entryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: entryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import "../../config"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: label.implicitWidth + 4
|
implicitWidth: label.implicitWidth
|
||||||
implicitHeight: Appearance.barHeight
|
implicitHeight: Appearance.barHeight
|
||||||
|
|
||||||
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
||||||
@@ -432,8 +432,8 @@ Item {
|
|||||||
model: [0, 0, 0, 1, 1, 1, 0, 1, 0]
|
model: [0, 0, 0, 1, 1, 1, 0, 1, 0]
|
||||||
Rectangle {
|
Rectangle {
|
||||||
required property int modelData
|
required property int modelData
|
||||||
width: logo.dotSize
|
width: logo.dotSize - 1
|
||||||
height: logo.dotSize
|
height: logo.dotSize - 1
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
color: modelData ? '#c9f0f0f0' : logo.dimColor
|
color: modelData ? '#c9f0f0f0' : logo.dimColor
|
||||||
}
|
}
|
||||||
@@ -505,6 +505,18 @@ Item {
|
|||||||
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
||||||
opacity: toggleRoot.checked ? 1 : 0.35
|
opacity: toggleRoot.checked ? 1 : 0.35
|
||||||
}
|
}
|
||||||
|
// Hover-only outline, offset outside the switch itself rather than
|
||||||
|
// drawn on its edge — the switch lags behind a click until the
|
||||||
|
// backend confirms it (e.g. root.active), so this is just a "you
|
||||||
|
// can click this" cue, not click feedback.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -4
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: toggleMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.height - 4
|
width: parent.height - 4
|
||||||
height: parent.height - 4
|
height: parent.height - 4
|
||||||
@@ -515,7 +527,9 @@ Item {
|
|||||||
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: toggleMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: toggleRoot.toggled()
|
onClicked: toggleRoot.toggled()
|
||||||
}
|
}
|
||||||
@@ -533,9 +547,25 @@ Item {
|
|||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
radius: 0
|
radius: 0
|
||||||
implicitHeight: rowContent.implicitHeight + 12
|
implicitHeight: rowContent.implicitHeight + 12
|
||||||
color: exitRow.active
|
// Hover checked first (same ordering as Volume.qml's DeviceRow):
|
||||||
? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18)
|
// hovering always shows a solid Colors.primary fill, even for an
|
||||||
: (rowMouse.containsMouse ? Colors.primary : "transparent")
|
// already-active row, so the primaryText used below never has to
|
||||||
|
// sit on top of the dimmer translucent tint instead.
|
||||||
|
color: rowMouse.containsMouse ? Colors.primary
|
||||||
|
: (exitRow.active ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row rather than drawn on
|
||||||
|
// its own edge — same treatment as NetworkIndicator.qml's NetworkRow.
|
||||||
|
// listColumn below is inset by 3px to give this room without being
|
||||||
|
// cropped by listFlick's clip.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: rowMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowContent
|
id: rowContent
|
||||||
@@ -551,7 +581,7 @@ Item {
|
|||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: exitRow.subIcon
|
text: exitRow.subIcon
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -568,7 +598,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
visible: exitRow.active
|
visible: exitRow.active
|
||||||
text: "check_circle"
|
text: "check_circle"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.primary
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.primary
|
||||||
@@ -595,9 +625,25 @@ Item {
|
|||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
radius: 0
|
radius: 0
|
||||||
implicitHeight: accountContent.implicitHeight + 12
|
implicitHeight: accountContent.implicitHeight + 12
|
||||||
color: accountRow.selected
|
// Hover checked first (same ordering as Volume.qml's DeviceRow):
|
||||||
? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18)
|
// hovering always shows a solid Colors.primary fill, even for an
|
||||||
: (accountMouse.containsMouse ? Colors.primary : "transparent")
|
// already-selected row, so the primaryText the texts below already
|
||||||
|
// assume on hover is always correct (this row had the same
|
||||||
|
// active-first ordering bug as ExitNodeRow, just never reported).
|
||||||
|
color: accountMouse.containsMouse ? Colors.primary
|
||||||
|
: (accountRow.selected ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row — same treatment as
|
||||||
|
// ExitNodeRow/NetworkRow. Not inside a clipped Flickable, so no
|
||||||
|
// inset needed on its container.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: accountMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: accountContent
|
id: accountContent
|
||||||
@@ -613,7 +659,7 @@ Item {
|
|||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: "person"
|
text: "person"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: accountMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: accountMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -638,7 +684,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
visible: accountRow.selected
|
visible: accountRow.selected
|
||||||
text: "check_circle"
|
text: "check_circle"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: accountMouse.containsMouse ? Colors.primaryText : Colors.primary
|
color: accountMouse.containsMouse ? Colors.primaryText : Colors.primary
|
||||||
@@ -680,6 +726,18 @@ Item {
|
|||||||
: (peerRow.expanded ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
: (peerRow.expanded ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
implicitHeight: peerContent.implicitHeight + 12
|
implicitHeight: peerContent.implicitHeight + 12
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row — same treatment as
|
||||||
|
// ExitNodeRow/NetworkRow. listColumn is inset by 3px to give this
|
||||||
|
// room without being cropped by listFlick's clip.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: summaryMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: peerContent
|
id: peerContent
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -694,7 +752,7 @@ Item {
|
|||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: root.osIcon(peerRow.peer.os)
|
text: root.osIcon(peerRow.peer.os)
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: summaryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: summaryMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -709,7 +767,7 @@ Item {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: peerRow.expanded ? "expand_less" : "content_copy"
|
text: peerRow.expanded ? "expand_less" : "content_copy"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: summaryMouse.containsMouse ? Colors.primaryText : Colors.muted
|
color: summaryMouse.containsMouse ? Colors.primaryText : Colors.muted
|
||||||
@@ -739,6 +797,17 @@ Item {
|
|||||||
color: optionMouse.containsMouse ? Colors.primary : "transparent"
|
color: optionMouse.containsMouse ? Colors.primary : "transparent"
|
||||||
implicitHeight: optionRow.implicitHeight + 8
|
implicitHeight: optionRow.implicitHeight + 8
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row — same
|
||||||
|
// treatment as the rest of this file's selectable rows.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: optionMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: optionRow
|
id: optionRow
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -838,7 +907,7 @@ Item {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
TailscaleLogo {
|
TailscaleLogo {
|
||||||
size: 30
|
size: 25
|
||||||
color: label.color
|
color: label.color
|
||||||
crossed: label.crossed
|
crossed: label.crossed
|
||||||
warning: label.warning
|
warning: label.warning
|
||||||
@@ -915,7 +984,7 @@ Item {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
Text {
|
Text {
|
||||||
text: "open_in_new"
|
text: "open_in_new"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: signInMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: signInMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -986,7 +1055,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
visible: root.status.selfIp !== ""
|
visible: root.status.selfIp !== ""
|
||||||
text: "content_copy"
|
text: "content_copy"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
color: copyMouse.containsMouse ? Colors.primary : Colors.muted
|
color: copyMouse.containsMouse ? Colors.primary : Colors.muted
|
||||||
@@ -1026,7 +1095,18 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: listColumn
|
id: listColumn
|
||||||
width: listFlick.width
|
// Inset 3px on every side so ExitNodeRow/PeerRow's
|
||||||
|
// hover halo has room without being cropped by
|
||||||
|
// listFlick's clip. Left/right needs the manual
|
||||||
|
// x/width shift (children bind width: parent.width,
|
||||||
|
// which ignores Column's own padding); top/bottom
|
||||||
|
// just needs padding, since that's along Column's
|
||||||
|
// own layout axis and Flickable's contentHeight
|
||||||
|
// tracks it.
|
||||||
|
x: 3
|
||||||
|
width: listFlick.width - 6
|
||||||
|
topPadding: 3
|
||||||
|
bottomPadding: 3
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import "../../config"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: label.implicitWidth + 4
|
implicitWidth: label.implicitWidth
|
||||||
implicitHeight: Appearance.barHeight
|
implicitHeight: Appearance.barHeight
|
||||||
|
|
||||||
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
// The bar's own PanelWindow — passed in from Bar.qml so this popup can
|
||||||
@@ -40,6 +40,12 @@ Item {
|
|||||||
enabled: panel.visible
|
enabled: panel.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PwNodePeakMonitor {
|
||||||
|
id: outputPeak
|
||||||
|
node: root.sink
|
||||||
|
enabled: panel.visible
|
||||||
|
}
|
||||||
|
|
||||||
// --- Device label/icon heuristics, ported from omarchy's audio panel
|
// --- Device label/icon heuristics, ported from omarchy's audio panel
|
||||||
// Model.js (github.com/basecamp/omarchy shell/plugins/panels/audio/Model.js),
|
// Model.js (github.com/basecamp/omarchy shell/plugins/panels/audio/Model.js),
|
||||||
// adapted to this project's Material Symbols icon set instead of Nerd Font.
|
// adapted to this project's Material Symbols icon set instead of Nerd Font.
|
||||||
@@ -67,27 +73,52 @@ Item {
|
|||||||
p["device.icon-name"] || "", p["device.product.name"] || ""].join(" ").toLowerCase()
|
p["device.icon-name"] || "", p["device.product.name"] || ""].join(" ").toLowerCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quickshell's Pipewire API only exposes a node's own properties, not
|
||||||
|
// its parent Device — so device.api (unlike device.form-factor or the
|
||||||
|
// richer device.icon-name, which only live on the Device object) is the
|
||||||
|
// one reliable Bluetooth signal actually present here: it's set on
|
||||||
|
// every node PipeWire hands off to a bluez5-backed sink/source. Checking
|
||||||
|
// it directly beats sniffing the word "bluetooth" out of node names,
|
||||||
|
// which usually just say "bluez_output..." and never match.
|
||||||
|
function isBluetoothNode(node) {
|
||||||
|
var p = (node && node.properties) || {}
|
||||||
|
return p["device.api"] === "bluez5"
|
||||||
|
}
|
||||||
|
|
||||||
|
// PipeWire's own device.form-factor (which would call ACCENTUM a
|
||||||
|
// "headset" outright) isn't reachable from here for the same reason —
|
||||||
|
// it lives on the Device object, not the node. And some devices (a
|
||||||
|
// generic USB DAC like an EKSA headset) have no form-factor anywhere in
|
||||||
|
// PipeWire at all, headset or not, so no property-based check can catch
|
||||||
|
// them. This override list is the deliberate manual escape hatch for
|
||||||
|
// exactly that case — add a distinctive substring from the product name
|
||||||
|
// (device.product.name/description, matched case-insensitively via
|
||||||
|
// deviceBlob) whenever a new no-metadata device shows up misclassified.
|
||||||
|
readonly property var headphoneNameOverrides: ["e900plus"]
|
||||||
|
|
||||||
function isHeadphoneNode(node) {
|
function isHeadphoneNode(node) {
|
||||||
var blob = deviceBlob(node)
|
var blob = deviceBlob(node)
|
||||||
return blob.indexOf("headphone") !== -1 || blob.indexOf("headset") !== -1
|
if (blob.indexOf("headphone") !== -1 || blob.indexOf("headset") !== -1
|
||||||
|| blob.indexOf("earbud") !== -1 || blob.indexOf("earphone") !== -1
|
|| blob.indexOf("earbud") !== -1 || blob.indexOf("earphone") !== -1
|
||||||
|| blob.indexOf("airpod") !== -1
|
|| blob.indexOf("airpod") !== -1)
|
||||||
|
return true
|
||||||
|
return root.headphoneNameOverrides.some(function(needle) { return blob.indexOf(needle) !== -1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
function sinkIcon(node) {
|
function sinkIcon(node) {
|
||||||
if (!node) return "speaker"
|
if (!node) return "speaker"
|
||||||
if (isHeadphoneNode(node)) return "headphones"
|
if (isHeadphoneNode(node)) return "headphones"
|
||||||
|
if (isBluetoothNode(node)) return "bluetooth_audio"
|
||||||
var blob = deviceBlob(node)
|
var blob = deviceBlob(node)
|
||||||
if (blob.indexOf("bluetooth") !== -1) return "bluetooth_audio"
|
|
||||||
if (blob.indexOf("hdmi") !== -1 || blob.indexOf("display") !== -1) return "tv"
|
if (blob.indexOf("hdmi") !== -1 || blob.indexOf("display") !== -1) return "tv"
|
||||||
return "speaker"
|
return "speaker"
|
||||||
}
|
}
|
||||||
|
|
||||||
function sourceIcon(node) {
|
function sourceIcon(node) {
|
||||||
if (!node) return "mic"
|
if (!node) return "mic"
|
||||||
|
if (isHeadphoneNode(node)) return "headphones"
|
||||||
|
if (isBluetoothNode(node)) return "bluetooth_audio"
|
||||||
var blob = deviceBlob(node)
|
var blob = deviceBlob(node)
|
||||||
if (blob.indexOf("headset") !== -1) return "headphones"
|
|
||||||
if (blob.indexOf("bluetooth") !== -1) return "bluetooth_audio"
|
|
||||||
if (blob.indexOf("webcam") !== -1 || blob.indexOf("camera") !== -1) return "videocam"
|
if (blob.indexOf("webcam") !== -1 || blob.indexOf("camera") !== -1) return "videocam"
|
||||||
return "mic"
|
return "mic"
|
||||||
}
|
}
|
||||||
@@ -95,9 +126,9 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 16
|
font.pixelSize: 18
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
text: (root.outputMuted || root.outputVolume <= 0) ? "volume_off"
|
text: (root.outputMuted || root.outputVolume <= 0) ? "volume_off"
|
||||||
: (root.outputVolume < 0.5 ? "volume_down" : "volume_up")
|
: (root.outputVolume < 0.5 ? "volume_down" : "volume_up")
|
||||||
@@ -234,6 +265,19 @@ Item {
|
|||||||
color: rowMouse.containsMouse ? Colors.primary
|
color: rowMouse.containsMouse ? Colors.primary
|
||||||
: (deviceRow.active ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
: (deviceRow.active ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) : "transparent")
|
||||||
|
|
||||||
|
// Hover-only outline, offset outside the row rather than drawn on
|
||||||
|
// its own edge — same treatment as the other bar widgets' selectable
|
||||||
|
// rows (e.g. NetworkIndicator.qml's NetworkRow). Not inside a
|
||||||
|
// clipped Flickable here, so no inset needed on its container.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -3
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: rowMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: 8
|
anchors.leftMargin: 8
|
||||||
@@ -245,7 +289,7 @@ Item {
|
|||||||
Layout.maximumWidth: 18
|
Layout.maximumWidth: 18
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: deviceRow.icon
|
text: deviceRow.icon
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
color: rowMouse.containsMouse ? Colors.primaryText : Colors.foreground
|
||||||
@@ -315,7 +359,7 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
id: mainColumn
|
id: mainColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: panel.contentPadding
|
anchors.margins: panel.contentPadding - 2
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
@@ -325,9 +369,9 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: label.text
|
text: label.text
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 40
|
font.pixelSize: 30
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,9 +419,14 @@ Item {
|
|||||||
onMoved: (v) => { if (root.sink && root.sink.audio) root.sink.audio.volume = v }
|
onMoved: (v) => { if (root.sink && root.sink.audio) root.sink.audio.volume = v }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LevelMeter {
|
||||||
|
width: parent.width
|
||||||
|
level: outputPeak.peak
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 2
|
spacing: 4
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.candidateSinks
|
model: root.candidateSinks
|
||||||
DeviceRow {
|
DeviceRow {
|
||||||
@@ -425,9 +474,10 @@ Item {
|
|||||||
level: inputPeak.peak
|
level: inputPeak.peak
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 2
|
spacing: 4
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.candidateSources
|
model: root.candidateSources
|
||||||
DeviceRow {
|
DeviceRow {
|
||||||
|
|||||||
@@ -313,16 +313,40 @@ Item {
|
|||||||
|
|
||||||
// --- Bar icon ------------------------------------------------------------
|
// --- Bar icon ------------------------------------------------------------
|
||||||
|
|
||||||
|
// A fixed, wallpaper-independent green rather than Colors.primary — the
|
||||||
|
// glyph itself doesn't change shape between states (unlike Tailscale's
|
||||||
|
// crossed-out logo), so "connected" needs to read as a shape cue (a
|
||||||
|
// badge appearing) rather than rely on a color swap that can end up
|
||||||
|
// low-contrast depending on the current pywal palette.
|
||||||
|
readonly property color connectedBadgeColor: "#3ddc84"
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: Appearance.iconSize
|
font.pixelSize: Appearance.iconSize
|
||||||
color: root.anyConnected ? Colors.primary : Colors.muted
|
color: root.anyConnected ? Colors.primary : Colors.muted
|
||||||
text: "vpn_lock"
|
text: "vpn_lock"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Small solid dot badge, bottom-right of the glyph, shown only while a
|
||||||
|
// tunnel is actually up — a shape appearing/disappearing reads at a
|
||||||
|
// glance even when the icon tint alone wouldn't stand out.
|
||||||
|
Rectangle {
|
||||||
|
visible: root.anyConnected
|
||||||
|
width: 6
|
||||||
|
height: 6
|
||||||
|
radius: 3
|
||||||
|
color: root.connectedBadgeColor
|
||||||
|
border.color: Colors.background
|
||||||
|
border.width: 1
|
||||||
|
anchors.right: label.right
|
||||||
|
anchors.bottom: label.bottom
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.bottomMargin: 1
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
@@ -349,6 +373,20 @@ Item {
|
|||||||
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
color: toggleRoot.checked ? Colors.primary : Colors.muted
|
||||||
opacity: (toggleRoot.checked ? 1 : 0.35) * (toggleRoot.busy ? 0.6 : 1)
|
opacity: (toggleRoot.checked ? 1 : 0.35) * (toggleRoot.busy ? 0.6 : 1)
|
||||||
}
|
}
|
||||||
|
// Hover-only outline, offset outside the switch itself rather than
|
||||||
|
// drawn on its edge — the switch lags behind a click until the
|
||||||
|
// connect/disconnect process actually finishes, so this is just a
|
||||||
|
// "you can click this" cue, not click feedback. toggleMouse.containsMouse
|
||||||
|
// is already false while busy, since a disabled MouseArea doesn't
|
||||||
|
// track hover.
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -4
|
||||||
|
radius: 0
|
||||||
|
color: "transparent"
|
||||||
|
border.color: Colors.foreground
|
||||||
|
border.width: toggleMouse.containsMouse ? 1 : 0
|
||||||
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.height - 4
|
width: parent.height - 4
|
||||||
height: parent.height - 4
|
height: parent.height - 4
|
||||||
@@ -359,8 +397,10 @@ Item {
|
|||||||
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: toggleMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: !toggleRoot.busy
|
enabled: !toggleRoot.busy
|
||||||
|
hoverEnabled: true
|
||||||
cursorShape: toggleRoot.busy ? Qt.ArrowCursor : Qt.PointingHandCursor
|
cursorShape: toggleRoot.busy ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||||
onClicked: toggleRoot.toggled()
|
onClicked: toggleRoot.toggled()
|
||||||
}
|
}
|
||||||
@@ -398,7 +438,7 @@ Item {
|
|||||||
Layout.maximumWidth: 20
|
Layout.maximumWidth: 20
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: provRow.subIcon
|
text: provRow.subIcon
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: provRow.state === "connected" ? Colors.primary : Colors.foreground
|
color: provRow.state === "connected" ? Colors.primary : Colors.foreground
|
||||||
@@ -493,7 +533,7 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "vpn_lock"
|
text: "vpn_lock"
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 22
|
font.pixelSize: 22
|
||||||
color: root.anyConnected ? Colors.primary : Colors.foreground
|
color: root.anyConnected ? Colors.primary : Colors.foreground
|
||||||
@@ -524,7 +564,7 @@ Item {
|
|||||||
|
|
||||||
ProviderRow {
|
ProviderRow {
|
||||||
label: "Mullvad"
|
label: "Mullvad"
|
||||||
subIcon: "shield"
|
subIcon: "gpp_good"
|
||||||
state: root.mullvadState
|
state: root.mullvadState
|
||||||
detailText: root.mullvadDetail
|
detailText: root.mullvadDetail
|
||||||
installed: root.mullvadInstalled
|
installed: root.mullvadInstalled
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ PanelWindow {
|
|||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
font.family: Appearance.iconFontFamily
|
font.family: Appearance.iconFontFamilyRounded
|
||||||
font.variableAxes: Appearance.iconFontAxes
|
font.variableAxes: Appearance.iconFontAxes
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
|
|||||||
259
dotfiles/.config/quickshell/scripts/CheckQuickshellSetup.sh
Executable file
259
dotfiles/.config/quickshell/scripts/CheckQuickshellSetup.sh
Executable file
@@ -0,0 +1,259 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Pre-flight check for everything this quickshell config depends on outside
|
||||||
|
# its own QML — fonts, the compositor, backing D-Bus services, and the
|
||||||
|
# external CLIs individual bar modules shell out to. Run this after
|
||||||
|
# installing/stowing quickshell on a new machine, before assuming the bar
|
||||||
|
# is just going to work.
|
||||||
|
#
|
||||||
|
# Usage: ./CheckQuickshellSetup.sh [path-to-quickshell-config]
|
||||||
|
# Defaults to $XDG_CONFIG_HOME/quickshell or ~/.config/quickshell.
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
QS_DIR="${1:-${XDG_CONFIG_HOME:-$HOME/.config}/quickshell}"
|
||||||
|
|
||||||
|
PASS=0
|
||||||
|
WARN=0
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
c_green="\033[0;32m"; c_yellow="\033[0;33m"; c_red="\033[0;31m"; c_reset="\033[0m"
|
||||||
|
|
||||||
|
pass() { printf " ${c_green}✓${c_reset} %s\n" "$1"; PASS=$((PASS+1)); }
|
||||||
|
warn() { printf " ${c_yellow}!${c_reset} %s\n" "$1"; WARN=$((WARN+1)); }
|
||||||
|
fail() { printf " ${c_red}✗${c_reset} %s\n" "$1"; FAIL=$((FAIL+1)); }
|
||||||
|
section() { printf "\n%s\n" "$1"; }
|
||||||
|
|
||||||
|
svc_state() {
|
||||||
|
# active / inactive / missing / no-systemctl. $1 = unit, $2 = --user (optional)
|
||||||
|
# NB: capture-then-here-string, not `cmd | grep -q`. Under `set -o
|
||||||
|
# pipefail`, grep -q exits the instant it finds a match, SIGPIPE-ing a
|
||||||
|
# still-writing producer — that producer's non-zero exit (not grep's
|
||||||
|
# success) becomes the pipeline's status, which reads as "not found"
|
||||||
|
# even when it was. Verified this actually happens with fc-list below.
|
||||||
|
if ! command -v systemctl >/dev/null 2>&1; then echo "no-systemctl"; return; fi
|
||||||
|
local unit_files
|
||||||
|
unit_files=$(systemctl ${2:-} list-unit-files "$1" 2>/dev/null)
|
||||||
|
if grep -q "$1" <<< "$unit_files"; then
|
||||||
|
systemctl ${2:-} is-active "$1" 2>/dev/null || echo "inactive"
|
||||||
|
else
|
||||||
|
echo "missing"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- 0. Quickshell itself + config files present ----------------------------
|
||||||
|
|
||||||
|
section "Quickshell core"
|
||||||
|
|
||||||
|
if command -v quickshell >/dev/null 2>&1; then
|
||||||
|
ver=$(quickshell --version 2>&1 | head -1)
|
||||||
|
pass "quickshell found ($(command -v quickshell)) — $ver"
|
||||||
|
else
|
||||||
|
fail "quickshell binary not found on PATH — install it before anything else here matters"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in "shell.qml" "config/Appearance.qml" "config/Colors.qml" "config/qmldir"; do
|
||||||
|
if [ -f "$QS_DIR/$f" ]; then
|
||||||
|
pass "found $f"
|
||||||
|
else
|
||||||
|
fail "missing $QS_DIR/$f — dotfiles not fully stowed/symlinked here?"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Nearly every module (ActiveWindow, Workspaces, PowerButton, PanelWindow's
|
||||||
|
# layer-shell surfaces, HyprlandFocusGrab) assumes a live Hyprland session.
|
||||||
|
if [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ] && command -v hyprctl >/dev/null 2>&1 && hyprctl monitors >/dev/null 2>&1; then
|
||||||
|
pass "Hyprland is the running compositor"
|
||||||
|
else
|
||||||
|
fail "Hyprland doesn't appear to be running — Quickshell.Hyprland and the layer-shell bar will not function"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 1. Fonts -----------------------------------------------------------------
|
||||||
|
|
||||||
|
section "Fonts"
|
||||||
|
|
||||||
|
if command -v fc-list >/dev/null 2>&1; then
|
||||||
|
# Captured once, then grepped via here-string — see the pipefail/SIGPIPE
|
||||||
|
# note on svc_state() above; fc-list's output is exactly what triggers it.
|
||||||
|
fc_out=$(fc-list)
|
||||||
|
|
||||||
|
if grep -qi "Material Symbols Outlined" <<< "$fc_out"; then
|
||||||
|
pass "Material Symbols Outlined installed"
|
||||||
|
else
|
||||||
|
fail "Material Symbols Outlined not found — install 'ttf-material-symbols-variable' (AUR); every glyph icon in the bar/panels will render as fallback text without it"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -qi "CaskaydiaCove Nerd Font Mono" <<< "$fc_out"; then
|
||||||
|
pass "CaskaydiaCove Nerd Font Mono installed"
|
||||||
|
else
|
||||||
|
fail "CaskaydiaCove Nerd Font Mono not found — install a Cascadia Code Nerd Font package; clock/labels/window title use it"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "fc-list not found (fontconfig missing?) — can't verify fonts"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 2. Backing services for native Quickshell modules ----------------------
|
||||||
|
# These modules talk to system services directly over D-Bus rather than
|
||||||
|
# shelling out — the service being up is the actual dependency, not a CLI.
|
||||||
|
|
||||||
|
section "Backing services (native QML modules)"
|
||||||
|
|
||||||
|
st=$(svc_state NetworkManager.service)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "NetworkManager.service active — Quickshell.Networking (NetworkIndicator)" ;;
|
||||||
|
missing) fail "NetworkManager not installed — required by NetworkIndicator.qml" ;;
|
||||||
|
*) fail "NetworkManager.service is $st — run: sudo systemctl enable --now NetworkManager" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
st=$(svc_state bluetooth.service)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "bluetooth.service active — Quickshell.Bluetooth (BluetoothIndicator)" ;;
|
||||||
|
missing) fail "bluez not installed — required by BluetoothIndicator.qml" ;;
|
||||||
|
*) fail "bluetooth.service is $st — run: sudo systemctl enable --now bluetooth" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Pipewire/wireplumber are user-session services, not system ones.
|
||||||
|
st=$(svc_state pipewire.service --user)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "pipewire.service (user) active — Quickshell.Services.Pipewire (Volume/VolumeOsd)" ;;
|
||||||
|
missing) fail "pipewire not installed — required by Volume.qml/VolumeOsd.qml" ;;
|
||||||
|
*) fail "pipewire.service (user) is $st — run: systemctl --user enable --now pipewire pipewire-pulse wireplumber" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
st=$(svc_state wireplumber.service --user)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "wireplumber.service (user) active" ;;
|
||||||
|
missing) warn "wireplumber not installed — pipewire falls back to pipewire-media-session if present, otherwise volume control may misbehave" ;;
|
||||||
|
*) fail "wireplumber.service (user) is $st — run: systemctl --user enable --now wireplumber" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# --- 3. External CLIs shelled out to via Process ----------------------------
|
||||||
|
|
||||||
|
section "External CLIs (Quickshell.Io Process calls)"
|
||||||
|
|
||||||
|
check_bin() {
|
||||||
|
# $1 = binary, $2 = which module(s) use it, $3 = fail|warn on missing
|
||||||
|
if command -v "$1" >/dev/null 2>&1; then
|
||||||
|
pass "$1 found — used by $2"
|
||||||
|
elif [ "$3" = "warn" ]; then
|
||||||
|
warn "$1 not found — used by $2 (optional on this machine)"
|
||||||
|
else
|
||||||
|
fail "$1 not found — used by $2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_bin nmcli "NetworkIndicator.qml (DNS provider panel, connection queries)" fail
|
||||||
|
check_bin ip "NetworkIndicator.qml (gateway/IP lookups)" fail
|
||||||
|
check_bin ping "NetworkIndicator.qml (latency/packet-loss stat)" fail
|
||||||
|
check_bin cat "NetworkIndicator.qml (/sys/class/net throughput counters)" fail
|
||||||
|
check_bin systemctl "PowerButton.qml (suspend/hibernate/reboot/poweroff)" fail
|
||||||
|
check_bin tailscale "TailscaleIndicator.qml / VpnExclusivity" warn
|
||||||
|
check_bin mullvad "VpnIndicator.qml / VpnExclusivity" warn
|
||||||
|
check_bin protonvpn "VpnIndicator.qml / VpnExclusivity" warn
|
||||||
|
|
||||||
|
have_tailscale=0; have_mullvad=0; have_proton=0
|
||||||
|
command -v tailscale >/dev/null 2>&1 && have_tailscale=1
|
||||||
|
command -v mullvad >/dev/null 2>&1 && have_mullvad=1
|
||||||
|
command -v protonvpn >/dev/null 2>&1 && have_proton=1
|
||||||
|
|
||||||
|
if [ $have_mullvad -eq 0 ] && [ $have_proton -eq 0 ]; then
|
||||||
|
warn "neither Mullvad nor ProtonVPN CLI is installed — VpnIndicator.qml will show both as 'Not installed'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 4. VPN daemons + functional status (Mullvad/ProtonVPN/Tailscale) -------
|
||||||
|
# The exclusivity logic (VpnExclusivity.qml backing off Tailscale when a
|
||||||
|
# commercial VPN connects) is pure QML and ships with the dotfiles — it
|
||||||
|
# needs no setup of its own. What varies per machine is whether these three
|
||||||
|
# are actually installed, enabled, and callable without a password prompt.
|
||||||
|
|
||||||
|
section "VPN dual-setup (Mullvad/ProtonVPN + Tailscale)"
|
||||||
|
|
||||||
|
if [ $have_tailscale -eq 1 ]; then
|
||||||
|
st=$(svc_state tailscaled.service)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "tailscaled.service is active" ;;
|
||||||
|
missing) fail "tailscaled.service not found — reinstall tailscale" ;;
|
||||||
|
*) fail "tailscaled.service is $st — run: sudo systemctl enable --now tailscaled" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if out=$(timeout 5 tailscale status --json 2>&1); then
|
||||||
|
if python3 -c "import json,sys; json.load(sys.stdin)" >/dev/null 2>&1 <<< "$out"; then
|
||||||
|
pass "tailscale status --json returns valid JSON"
|
||||||
|
else
|
||||||
|
warn "tailscale status --json returned non-JSON output"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fail "tailscale status --json failed: $(echo "$out" | head -1)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $have_mullvad -eq 1 ]; then
|
||||||
|
st=$(svc_state mullvad-daemon.service)
|
||||||
|
case "$st" in
|
||||||
|
active) pass "mullvad-daemon.service is active" ;;
|
||||||
|
missing) fail "mullvad-daemon.service not found — reinstall the Mullvad package" ;;
|
||||||
|
*) fail "mullvad-daemon.service is $st — run: sudo systemctl enable --now mullvad-daemon" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if out=$(timeout 5 mullvad status --json 2>&1); then
|
||||||
|
if python3 -c "import json,sys; json.load(sys.stdin)" >/dev/null 2>&1 <<< "$out"; then
|
||||||
|
pass "mullvad status --json returns valid JSON"
|
||||||
|
else
|
||||||
|
warn "mullvad status --json returned non-JSON output"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fail "mullvad status --json failed: $(echo "$out" | head -1)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $have_proton -eq 1 ]; then
|
||||||
|
# ProtonVPN's CLI drives connections through NetworkManager rather than
|
||||||
|
# its own daemon — already checked above, just re-verified here in context.
|
||||||
|
if out=$(timeout 5 protonvpn status 2>&1); then
|
||||||
|
if grep -qi "^Status:" <<< "$out"; then
|
||||||
|
pass "protonvpn status returns a parseable 'Status:' line"
|
||||||
|
else
|
||||||
|
warn "protonvpn status has no 'Status:' line — applyProtonStatus() in VpnIndicator.qml may misread it: $(echo "$out" | head -1)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fail "protonvpn status failed: $(echo "$out" | head -1)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ts_up=0; mv_up=0; pv_up=0
|
||||||
|
# Same capture-then-here-string reasoning as above — these outputs are small
|
||||||
|
# enough that the SIGPIPE race is unlikely, but there's no upside to relying
|
||||||
|
# on that instead of just being consistent.
|
||||||
|
[ $have_tailscale -eq 1 ] && grep -q '"BackendState":"Running"' <<< "$(tailscale status --json 2>/dev/null)" && ts_up=1
|
||||||
|
[ $have_mullvad -eq 1 ] && grep -qi "^Connected" <<< "$(mullvad status 2>/dev/null)" && mv_up=1
|
||||||
|
[ $have_proton -eq 1 ] && grep -qi "^Status:\s*Connected" <<< "$(protonvpn status 2>/dev/null)" && pv_up=1
|
||||||
|
|
||||||
|
active_count=$((ts_up + mv_up + pv_up))
|
||||||
|
if [ $active_count -le 1 ]; then
|
||||||
|
pass "at most one tunnel active right now (tailscale=$ts_up mullvad=$mv_up protonvpn=$pv_up)"
|
||||||
|
else
|
||||||
|
warn "more than one tunnel is up right now (tailscale=$ts_up mullvad=$mv_up protonvpn=$pv_up) — bring extras down manually; quickshell only enforces exclusivity when you toggle from its own UI"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 5. System tray (currently disabled in Bar.qml) -------------------------
|
||||||
|
|
||||||
|
section "System tray (Tray.qml)"
|
||||||
|
|
||||||
|
if grep -q "^\s*//\s*Tray\s*{}" "$QS_DIR/modules/bar/Bar.qml" 2>/dev/null; then
|
||||||
|
warn "Tray {} is commented out in Bar.qml — skipping icon-theme check (nothing to render)"
|
||||||
|
elif [ -f "$QS_DIR/modules/bar/Bar.qml" ]; then
|
||||||
|
if command -v gtk-update-icon-cache >/dev/null 2>&1 || [ -d /usr/share/icons/hicolor ]; then
|
||||||
|
pass "an icon theme (at least hicolor) is present for Quickshell.Services.SystemTray icon lookups"
|
||||||
|
else
|
||||||
|
warn "no icon theme found — tray icons may render blank"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Summary -----------------------------------------------------------------
|
||||||
|
|
||||||
|
section "Summary"
|
||||||
|
printf " ${c_green}%d passed${c_reset}, ${c_yellow}%d warnings${c_reset}, ${c_red}%d failed${c_reset}\n" "$PASS" "$WARN" "$FAIL"
|
||||||
|
|
||||||
|
if [ $FAIL -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user