From d0146eb075d8d0b191a689cb0afccc194c6b2fa3 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sun, 22 Nov 2026 03:03:24 +0800 Subject: [PATCH 1/2] Shell: fixes from the first new-shell test - Control center: no battery line, and volume shows the page arrow like brightness instead of the output chip. - The bar loses the control center button (the widget stays for users who add it); finger taps on the status icons do nothing, pulls still work. - Focus is a moon everywhere (bar, lock status, control center); the notification center loses its Focus button. - Notification center: an expiring banner no longer blinks out and back, and letting go of an over-pulled sheet no longer jumps. - Settings: a known Wi-Fi network has a page (join or disconnect, forget, auto-join, signal, security, addresses); pages with data to read come in complete; the page transition loses its dark shade. --- desktop/shell/config/omarchy/shell.json | 3 +- desktop/shell/default/i18n/en/shell.json | 13 +- desktop/shell/migrations/1795111372.sh | 22 --- .../shell/controlcenter/ControlCenter.qml | 128 ++---------- .../notificationcenter/NotificationCenter.qml | 68 +++---- desktop/shell/shell/plugins/bar/Bar.qml | 12 ++ .../shell/plugins/bar/indicators/Dnd.qml | 4 +- .../plugins/control-center/BarWidget.qml | 2 + .../shell/plugins/notifications/Service.qml | 11 +- .../shell/plugins/status/StatusCluster.qml | 2 +- desktop/shell/shell/settings/AboutPage.qml | 40 +--- .../shell/shell/settings/BackgroundPage.qml | 3 + desktop/shell/shell/settings/DateTimePage.qml | 3 + desktop/shell/shell/settings/DisplayPage.qml | 6 + desktop/shell/shell/settings/IconsPage.qml | 3 + desktop/shell/shell/settings/Settings.qml | 38 ++++ desktop/shell/shell/settings/SettingsItem.qml | 18 +- .../shell/shell/settings/SettingsWindow.qml | 33 ++-- .../shell/shell/settings/ShortcutsPage.qml | 2 + desktop/shell/shell/settings/ThemePage.qml | 3 + desktop/shell/shell/settings/TimezonePage.qml | 2 + .../shell/shell/settings/WifiNetworkPage.qml | 187 ++++++++++++++++++ desktop/shell/shell/settings/WifiPage.qml | 12 +- tests/test_bar_layout.py | 2 +- 24 files changed, 385 insertions(+), 232 deletions(-) delete mode 100644 desktop/shell/migrations/1795111372.sh create mode 100644 desktop/shell/shell/settings/WifiNetworkPage.qml diff --git a/desktop/shell/config/omarchy/shell.json b/desktop/shell/config/omarchy/shell.json index e1c6e069..28f475d9 100644 --- a/desktop/shell/config/omarchy/shell.json +++ b/desktop/shell/config/omarchy/shell.json @@ -15,8 +15,7 @@ { "id": "omarchy.bluetooth" }, { "id": "omarchy.network" }, { "id": "omarchy.monitor" }, - { "id": "omarchy.power" }, - { "id": "ipadlinux.controlcenter" } + { "id": "omarchy.power" } ] } }, diff --git a/desktop/shell/default/i18n/en/shell.json b/desktop/shell/default/i18n/en/shell.json index 93ae710d..82cdd462 100644 --- a/desktop/shell/default/i18n/en/shell.json +++ b/desktop/shell/default/i18n/en/shell.json @@ -535,8 +535,6 @@ "notifications.minutesAgo": "%1m", "notifications.reply": "Reply", "notificationCenter.title": "Notifications", - "notificationCenter.focusOn": "Focus on", - "notificationCenter.focusOff": "Focus off", "notificationCenter.clearAll": "Clear all", "notificationCenter.empty": "No notifications", "notificationCenter.more": "%1 more", @@ -720,6 +718,17 @@ "settings.learn": "Learn", "settings.titleBars": "Title Bars When Maximized", "settings.wifi": "Wi-Fi", + "settings.wifiAutoJoin": "Auto-Join", + "settings.wifiDetails": "Details", + "settings.wifiDisconnect": "Disconnect", + "settings.wifiDns": "DNS", + "settings.wifiEnterprise": "WPA2 Enterprise", + "settings.wifiForget": "Forget This Network", + "settings.wifiJoin": "Join This Network", + "settings.wifiOpen": "None", + "settings.wifiRouter": "Router", + "settings.wifiSecurity": "Security", + "settings.wifiSignal": "Signal", "settings.bluetooth": "Bluetooth", "settings.sound": "Sound", "settings.output": "Output", diff --git a/desktop/shell/migrations/1795111372.sh b/desktop/shell/migrations/1795111372.sh deleted file mode 100644 index c5f99564..00000000 --- a/desktop/shell/migrations/1795111372.sh +++ /dev/null @@ -1,22 +0,0 @@ -echo "The bar gets the control center's button" - -# A user's bar layout is theirs (~/.config/omarchy-ipad/shell.json): the -# button goes at the end of its right section, unless it is there already. -config="$HOME/.config/omarchy-ipad/shell.json" -[[ -f $config ]] || exit 0 -python3 - "$config" <<'PY' -import json, sys -path = sys.argv[1] -with open(path) as f: - config = json.load(f) -right = config.get("bar", {}).get("layout", {}).get("right") -if isinstance(right, list) and not any(isinstance(w, dict) and w.get("id") == "ipadlinux.controlcenter" for w in right): - # On a phone's narrow bar it waits in the overflow: a finger pulls the - # control center down there. - right.append({"id": "ipadlinux.controlcenter", "narrow": False}) - with open(path + ".new", "w") as f: - json.dump(config, f, indent=2) - f.write("\n") - import os - os.replace(path + ".new", path) -PY diff --git a/desktop/shell/shell/controlcenter/ControlCenter.qml b/desktop/shell/shell/controlcenter/ControlCenter.qml index 01bde2a9..c93ad160 100644 --- a/desktop/shell/shell/controlcenter/ControlCenter.qml +++ b/desktop/shell/shell/controlcenter/ControlCenter.qml @@ -9,7 +9,6 @@ import qs.Commons as Commons import qs.Ui import "../plugins/panels/network" as Network import "../plugins/panels/bluetooth" as BluetoothStatus -import "../plugins/panels/power" as Power import "../plugins/panels/bluetooth/Model.js" as BluetoothModel import "../plugins/status" as StatusParts import "../plugins/panels/monitor" as Monitor @@ -19,8 +18,7 @@ import "../plugins/panels/audio" as AudioPanel // The control center (SHELL-SPEC, step 2): the main view. States you flip // and the two sliders, over the same status objects the bar and the lock // read. On an iPad a panel below the bar at the right with the screen dimmed; -// on a phone the whole screen. Until its module pages exist, a tile's chevron -// and the battery line open the bar's panels. +// on a phone the whole screen. A tile's chevron opens its module's page. Item { id: root @@ -50,7 +48,6 @@ Item { Network.Status { id: network } BluetoothStatus.Status { id: bluetooth } - Power.Status { id: battery } StatusParts.RotationLock { id: rotation } readonly property var idleService: shell ? shell.firstPartyServiceFor("omarchy.idle") : null @@ -92,13 +89,6 @@ Item { if (n > 1) return Commons.I18n.t("controlCenter.connectedCount").arg(Commons.I18n.formatNumber(n)) return Commons.I18n.t("controlCenter.notConnected") } - readonly property string outputName: sink ? String(sink.nickname || sink.description || "") : "" - readonly property string batteryLine: { - if (battery.displayedPercentage === null) return "" - var line = Commons.I18n.formatNumber(battery.displayedPercentage) + "%" - var time = String(battery.batteryInfo.time || "") - return time !== "" && !battery.externalPower ? line + " · " + time : line - } // ---------------------------------------------------------- actions @@ -159,14 +149,12 @@ Item { NetworkPanel.Panel { id: networkModule; host: pageHost; bar: pageHost; moduleName: "omarchy.network" } AudioPanel.Panel { id: audioModule; host: pageHost; bar: pageHost; moduleName: "omarchy.audio" } BluetoothStatus.Panel { id: bluetoothModule; host: pageHost; bar: pageHost; moduleName: "omarchy.bluetooth" } - Power.Panel { id: powerModule; host: pageHost; bar: pageHost; moduleName: "omarchy.power" } } readonly property var modules: ({ "omarchy.monitor": displayModule, "omarchy.network": networkModule, "omarchy.audio": audioModule, - "omarchy.bluetooth": bluetoothModule, - "omarchy.power": powerModule + "omarchy.bluetooth": bluetoothModule }) property var page: null @@ -790,7 +778,7 @@ Item { glyph: root.volume <= 0 || (root.sink && root.sink.audio && root.sink.audio.muted) ? "󰝟" : "󰕾" value: root.volume available: !!(root.sink && root.sink.audio) - chip: root.outputName + pageArrow: true focusKey: "volume" page: "omarchy.audio" onMoved: function(v) { root.setVolume(v) } @@ -832,26 +820,6 @@ Item { } } } - - // The battery line (iPad: here; phone: at the foot). - Item { - id: footer - width: content.width - height: root.touchMin - // Only with a battery to show: nothing else lives here. - visible: !root.phone && root.batteryLine !== "" - FooterParts { anchors.fill: parent } - } - } - - Item { - visible: root.phone && root.pageShift < 1 && root.batteryLine !== "" - x: root.pad - root.pageShift * card.width - width: parent.width - root.pad * 2 - height: root.touchMin - anchors.bottom: parent.bottom - anchors.bottomMargin: Style.space(24) - FooterParts { anchors.fill: parent } } // The page: the panel's content, whose own title row is the header (its @@ -1065,8 +1033,7 @@ Item { property string glyph: "" property real value: 0 property string note: "" - property string chip: "" - // A page with no chip of its own shows the arrow alone. + // The arrow at the right end: the slider has a page. property bool pageArrow: false signal moved(real value) signal longPressed() @@ -1101,9 +1068,9 @@ Item { } Text { visible: slider.note !== "" - // Left of the chip, which takes the right end. + // Left of the arrow, which takes the right end. x: slider.vertical ? Style.space(12) - : parent.width - width - Style.space(12) - (chipBox.visible ? chipBox.width + Style.space(8) : 0) + : parent.width - width - Style.space(12) - (arrow.visible ? arrow.width + Style.space(8) : 0) y: slider.vertical ? Style.space(12) : (parent.height - height) / 2 textFormat: Text.PlainText text: slider.note @@ -1169,80 +1136,23 @@ Item { onCanceled: { held = false; used = false; sliderHoldOpen.stop() } onPressAndHold: if (!moving) { held = true; sliderHoldOpen.restart() } } - Rectangle { - id: chipBox - // The way to the slider's page, always in sight: a named chip (the - // output) or the arrow alone. While a long press holds the slider, it - // lights up: lifting goes there. - visible: slider.chip !== "" || slider.pageArrow - x: slider.vertical && slider.chip !== "" ? Style.space(10) : parent.width - width - Style.space(10) + Text { + id: arrow + // The way to the slider's page, always in sight: only a glyph in the + // slider's own ink, dark on the fill and light beside it. While a long + // press holds the slider it lights up: lifting goes there. A tap here + // sets the level like anywhere else on the slider. + visible: slider.pageArrow + x: parent.width - width - Style.space(14) y: slider.vertical ? Style.space(10) : (parent.height - height) / 2 - width: Math.min(chipRow.implicitWidth + Style.space(16), parent.width - Style.space(20)) - height: Style.space(26) - // The arrow alone is only a glyph in the slider's own ink: dark on the - // fill, light beside it. - readonly property bool arrowOnly: slider.chip === "" readonly property bool onFillPart: slider.vertical ? (1 - (y + height / 2) / slider.height) < slider.value : (x + width / 2) / slider.width < slider.value - readonly property color ink: drag.holding - ? (arrowOnly ? Commons.Color.accent : root.onText) - : (arrowOnly && onFillPart ? Commons.Color.background : root.text) - color: arrowOnly ? "transparent" : (drag.holding ? root.onFill : Commons.Color.popups.background) - border.width: arrowOnly ? 0 : Math.max(1, Style.space(1)) - border.color: drag.holding ? root.onFill : Style.normalBorderColor - radius: Style.cornerRadius - Row { - id: chipRow - anchors.centerIn: parent - spacing: Style.space(6) - Text { - visible: slider.chip !== "" - width: Math.min(implicitWidth, chipBox.parent.width - Style.space(48)) - textFormat: Text.PlainText - text: slider.chip - color: chipBox.ink - font.family: Style.font.family - font.pixelSize: Style.font.caption - font.bold: true - elide: Text.ElideRight - } - Text { - text: "󰅂" - color: chipBox.ink - opacity: chipBox.arrowOnly && !drag.holding ? 0.7 : 1 - font.family: Style.font.family - font.pixelSize: chipBox.arrowOnly ? Style.font.heading : Style.font.body - } - } - // Only a hint that there is a page: a long press opens it, and a tap - // here sets the level like anywhere else on the slider. - } - } - - component FooterParts: Item { - // Battery line: opens the battery page. Ending the session is the - // launcher's (its footer, a phone's System tab), not the control center's. - Cell { - id: batteryCell - visible: root.batteryLine !== "" - page: "omarchy.power" - focusKey: "battery" - color: "transparent" - border.width: 0 - width: batteryRow.implicitWidth + Style.space(16) - height: parent.height - onActivated: root.openPage("omarchy.power") - Row { - id: batteryRow - x: Style.space(8) - anchors.verticalCenter: parent.verticalCenter - spacing: Style.space(6) - Text { anchors.verticalCenter: parent.verticalCenter; text: battery.icon; color: root.text; font.family: Style.font.family; font.pixelSize: Style.font.body } - Text { anchors.verticalCenter: parent.verticalCenter; textFormat: Text.PlainText; text: root.batteryLine; color: root.text; font.family: Style.font.family; font.pixelSize: Style.font.caption } - Text { anchors.verticalCenter: parent.verticalCenter; text: "󰅂"; color: root.text; opacity: 0.6; font.family: Style.font.family; font.pixelSize: Style.font.body } - } - MouseArea { anchors.fill: parent; onClicked: batteryCell.activate() } + text: "󰅂" + color: drag.holding ? Commons.Color.accent : (onFillPart ? Commons.Color.background : root.text) + opacity: drag.holding ? 1 : 0.7 + font.family: Style.font.family + font.pixelSize: Style.font.heading } } } diff --git a/desktop/shell/shell/notificationcenter/NotificationCenter.qml b/desktop/shell/shell/notificationcenter/NotificationCenter.qml index 4e1ca23d..22b16707 100644 --- a/desktop/shell/shell/notificationcenter/NotificationCenter.qml +++ b/desktop/shell/shell/notificationcenter/NotificationCenter.qml @@ -255,6 +255,8 @@ Item { property bool pulling: false property bool touchSpent: false property real pullFrom: 0 + // Where the finger is, as a reveal (past 1 the sheet only stretches). + property real pullRaw: 0 readonly property real pullSpan: Math.max(1, root.barInset + Math.min(content.height, root.screenHeight - root.barInset)) function beginPull() { @@ -269,11 +271,13 @@ Item { root.mapped = true } root.pullFrom = root.reveal + root.pullRaw = root.reveal root.pulling = true } function pullTo(distance) { if (!root.pulling) return var r = root.pullFrom + distance / root.pullSpan + root.pullRaw = r if (r > 1) r = 1 + (1 - 1 / (1 + (r - 1) * 2)) * 0.08 root.reveal = Math.max(0, r) } @@ -284,7 +288,11 @@ Item { var keep = velocity > flick || (velocity > -flick && root.reveal > 0.4) root.closingFromOpen = !keep && root.pullFrom > 0.5 root.opened = keep - root.settle(keep ? 1 : 0, velocity / root.pullSpan) + // Stretched past open, the sheet moves a fraction of the finger: so does + // the speed it is let go with, or it would jump further out first. + var speed = velocity / root.pullSpan + if (root.pullRaw > 1) speed *= 0.16 / Math.pow(1 + (root.pullRaw - 1) * 2, 2) + root.settle(keep ? 1 : 0, speed) if (keep) Qt.callLater(function() { keyCatcher.forceActiveFocus() }) } @@ -324,7 +332,7 @@ Item { // ------------------------------------------------------------ keyboard - // Rows, top to bottom: the header (Focus, Clear all), then each card, an + // Rows, top to bottom: the header (Clear all), then each card, an // open stack's all. Up and Down go between rows, Left and Right along one // (a card, then its buttons and its reply field). Enter opens or presses, // Space opens or closes a stack, Delete clears a card, Escape closes. @@ -334,7 +342,8 @@ Item { property int focusCol: 0 property int lastRowIndex: 0 readonly property var focusRows: { - var rows = ["header"] + // Clear all only with something to clear. + var rows = root.groups.length > 0 ? ["header"] : [] for (var i = 0; i < root.groups.length; i++) { var g = root.groups[i] if (!g.rows.length) continue @@ -352,12 +361,13 @@ Item { // The cards on screen, by key, for what only a card knows (its buttons). property var cardItems: ({}) function rowParts(row) { - if (row === "header") return root.groups.length > 0 ? 2 : 1 + if (row === "header") return 1 var card = root.cardItems[row] return card ? card.parts : 1 } function moveRow(step) { var rows = root.focusRows + if (!rows.length) return var at = rows.indexOf(root.focusRow) var next = at < 0 ? (step > 0 ? 0 : rows.length - 1) : Math.max(0, Math.min(rows.length - 1, at + step)) root.lastRowIndex = next @@ -377,7 +387,7 @@ Item { } function activateFocused(space) { if (root.focusRow === "header") { - if (root.focusCol === 0) root.toggleFocus(); else root.clearAll() + root.clearAll() return } var found = root.groupOf(root.focusRow) @@ -405,8 +415,6 @@ Item { // ------------------------------------------------------------ actions - readonly property bool focusOn: !!service && service.doNotDisturb === true - function toggleFocus() { if (service) service.setDoNotDisturb(!root.focusOn) } function clearAll() { if (service) service.clearCenter() } function openEntry(entry) { if (!service || !entry) return @@ -648,7 +656,7 @@ Item { NumberAnimation { properties: "y"; duration: Style.duration(320); easing.type: Easing.Bezier; easing.bezierCurve: Style.easeOut } } - // The header: Focus (Do Not Disturb) and Clear all. + // The header: the title and Clear all (Focus is the control center's). Item { width: parent.width height: Math.max(heading.implicitHeight, headerButtons.height) @@ -667,17 +675,10 @@ Item { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter spacing: Style.space(8) - HeaderButton { - glyph: "󰽥" - label: root.focusOn ? I18n.t("notificationCenter.focusOn") : I18n.t("notificationCenter.focusOff") - lit: root.focusOn - focused: root.focusRow === "header" && root.focusCol === 0 - onActivated: root.toggleFocus() - } HeaderButton { label: I18n.t("notificationCenter.clearAll") enabled: root.groups.length > 0 - focused: root.focusRow === "header" && root.focusCol === 1 + focused: root.focusRow === "header" onActivated: root.clearAll() } } @@ -893,44 +894,29 @@ Item { } } - // A small outlined button of the header; lit in the accent while on. + // A small outlined button of the header. component HeaderButton: Rectangle { id: button - property string glyph: "" property string label: "" - property bool lit: false property bool focused: false signal activated() - width: buttonRow.implicitWidth + Style.space(20) + width: buttonLabel.implicitWidth + Style.space(20) height: Style.space(30) - color: lit ? Util.alpha(Commons.Color.accent, 0.18) : "transparent" + color: "transparent" border.width: root.hairline border.color: root.outline opacity: enabled ? 1 : 0.45 onFocusedChanged: if (focused) root.showItem(button) FocusRing { visible: button.focused } scale: buttonArea.pressed && buttonArea.containsMouse ? 0.96 : 1 - Row { - id: buttonRow + Text { + id: buttonLabel anchors.centerIn: parent - spacing: Style.space(6) - Text { - visible: button.glyph !== "" - anchors.verticalCenter: parent.verticalCenter - textFormat: Text.PlainText - text: button.glyph - color: button.lit ? Commons.Color.accent : root.dim - font.family: Style.font.family - font.pixelSize: Style.font.body - } - Text { - anchors.verticalCenter: parent.verticalCenter - textFormat: Text.PlainText - text: button.label - color: button.lit ? Commons.Color.accent : root.text - font.family: Style.font.family - font.pixelSize: Style.font.body - } + textFormat: Text.PlainText + text: button.label + color: root.text + font.family: Style.font.family + font.pixelSize: Style.font.body } MouseArea { id: buttonArea diff --git a/desktop/shell/shell/plugins/bar/Bar.qml b/desktop/shell/shell/plugins/bar/Bar.qml index 6aa793f2..5e2ecfef 100644 --- a/desktop/shell/shell/plugins/bar/Bar.qml +++ b/desktop/shell/shell/plugins/bar/Bar.qml @@ -2009,6 +2009,18 @@ Item { anchors.verticalCenter: parent.verticalCenter } + // Orchard: the status icons are a pointer's. A finger's tap on them + // does nothing (they only show state; the control center pulled down + // from here has the controls), while a pull still takes the touch to + // the centers (BarPanel's DragHandlers take over from this). + Item { + anchors.fill: rightModules + TapHandler { + acceptedDevices: PointerDevice.TouchScreen + gesturePolicy: TapHandler.WithinBounds + } + } + // Where a display notch covers the middle of the bar, the center // sections run on just left of the right one. They keep their regions, // so settings pushes, drag and drop, and panel routing still address diff --git a/desktop/shell/shell/plugins/bar/indicators/Dnd.qml b/desktop/shell/shell/plugins/bar/indicators/Dnd.qml index 426617f2..45eb6ec1 100644 --- a/desktop/shell/shell/plugins/bar/indicators/Dnd.qml +++ b/desktop/shell/shell/plugins/bar/indicators/Dnd.qml @@ -9,8 +9,8 @@ BarIndicator { readonly property bool dnd: notificationService ? notificationService.doNotDisturb : false active: dnd - activeText: "󰂛" - inactiveText: "󰂛" + activeText: "󰖔" + inactiveText: "󰖔" activeTooltipText: I18n.t("bar.allowNotifications") inactiveTooltipText: I18n.t("bar.silenceNotifications") diff --git a/desktop/shell/shell/plugins/control-center/BarWidget.qml b/desktop/shell/shell/plugins/control-center/BarWidget.qml index dd704ad4..d3b294e6 100644 --- a/desktop/shell/shell/plugins/control-center/BarWidget.qml +++ b/desktop/shell/shell/plugins/control-center/BarWidget.qml @@ -6,6 +6,8 @@ import qs.Commons // The control center's button: one click opens it as a popup, as the bar's // other icons open theirs (a finger pulls it down from the top right). The bar's other icons stay // upstream's, each opening its own panel. +// Not on the default bar (a finger pulls the center down, the keyboard has +// Super+Ctrl+1); a user can still add "ipadlinux.controlcenter" to their layout. BarWidget { id: root moduleName: "ipadlinux.controlcenter" diff --git a/desktop/shell/shell/plugins/notifications/Service.qml b/desktop/shell/shell/plugins/notifications/Service.qml index ec0c32af..e26b28a0 100644 --- a/desktop/shell/shell/plugins/notifications/Service.qml +++ b/desktop/shell/shell/plugins/notifications/Service.qml @@ -974,11 +974,13 @@ Item { if (!liveKeys[key]) return releaseLive(key) release(key, reason) + // A placeholder (the empty-history notice) was never recorded. + // Orchard: recorded before the row goes, so the notification center, + // which lists both, never sees it in neither. + if (key.indexOf("placeholder") !== 0) storeClose(key, reason) if (at >= 0) toasts.remove(at) delete heights[key] delete fresh[key] - // A placeholder (the empty-history notice) was never recorded. - if (key.indexOf("placeholder") !== 0) storeClose(key, reason) layoutRevision += 1 } @@ -1406,7 +1408,10 @@ Item { for (var i = 0; i < toasts.count; i++) { var live = toasts.get(i) var key = String(live.key) - if (leaving[key] || key.indexOf("placeholder") === 0) continue + // A banner on its way out stays listed unless it is done with: one + // that timed out goes on to history under the same key, and dropping + // it for its exit made it blink out and back. + if ((leaving[key] && centerDone[leaving[key]]) || key.indexOf("placeholder") === 0) continue seen[key] = true out.push({ key: key, live: true, app: String(live.app || ""), appIcon: String(live.appIcon || ""), glyph: String(live.glyph || ""), source: String(live.source || ""), diff --git a/desktop/shell/shell/plugins/status/StatusCluster.qml b/desktop/shell/shell/plugins/status/StatusCluster.qml index b973d373..64bb50ee 100644 --- a/desktop/shell/shell/plugins/status/StatusCluster.qml +++ b/desktop/shell/shell/plugins/status/StatusCluster.qml @@ -41,7 +41,7 @@ Row { readonly property var items: [ { module: "microphone", glyph: "󰍭", shown: root.micMuted }, { module: "rotation", glyph: "󰝳", shown: root.rotationLocked }, - { module: "focus", glyph: "󰂛", shown: root.focusMode }, + { module: "focus", glyph: "󰖔", shown: root.focusMode }, { module: "stayAwake", glyph: "", shown: root.stayAwake }, { module: "bluetooth", glyph: bluetooth.icon, shown: bluetooth.enabled }, { module: "network", glyph: network.icon, shown: network.icon !== "" }, diff --git a/desktop/shell/shell/settings/AboutPage.qml b/desktop/shell/shell/settings/AboutPage.qml index 6773100b..e7f6b24a 100644 --- a/desktop/shell/shell/settings/AboutPage.qml +++ b/desktop/shell/shell/settings/AboutPage.qml @@ -1,6 +1,5 @@ import QtQuick import Quickshell -import Quickshell.Io import qs.Commons import qs.Commons as Commons @@ -11,43 +10,16 @@ Item { id: page property var settings: null - property var facts: [] + // Read by Settings as its window opens (Settings.qml), so the table is + // whole when the page comes in instead of growing under the finger; read + // again here, as storage changes. + readonly property var facts: settings && settings.host ? settings.host.aboutFacts : [] + Component.onCompleted: if (settings && settings.host) settings.host.readAbout() + readonly property bool ready: facts.length > 0 width: parent ? parent.width : 0 height: box.height - Process { - id: reader - running: true - command: ["bash", "-lc", [ - "model=$(tr -d '\\0' < /proc/device-tree/model 2>/dev/null); [[ -n $model ]] || model=$(cat /sys/class/dmi/id/product_name 2>/dev/null)", - "printf 'device\\t%s\\n' \"$model\"", - "printf 'name\\t%s\\n' \"$(cat /etc/hostname 2>/dev/null || uname -n)\"", - "printf 'system\\t%s\\n' \"$(. /etc/os-release 2>/dev/null; echo \"$PRETTY_NAME\")\"", - "printf 'version\\t%s\\n' \"$(omarchy-version 2>/dev/null || cat \"$OMARCHY_PATH/version\" 2>/dev/null)\"", - "printf 'kernel\\t%s\\n' \"$(uname -r)\"", - "printf 'memory\\t%s\\n' \"$(awk '/^MemTotal:/ { printf \"%.1f GB\", $2 / 1048576 }' /proc/meminfo)\"", - "printf 'storage\\t%s\\n' \"$(df -B1 / 2>/dev/null | awk 'NR == 2 { printf \"%.0f GB of %.0f GB free\", $4 / 1e9, $2 / 1e9 }')\"" - ].join("\n")] - property string collected: "" - stdout: SplitParser { onRead: function(data) { reader.collected += data + "\n" } } - onExited: { - var labels = { - device: "settings.aboutDevice", name: "settings.aboutName", system: "settings.aboutSystem", - version: "settings.aboutVersion", kernel: "settings.aboutKernel", memory: "settings.aboutMemory", - storage: "settings.aboutStorage" - } - var out = [] - var lines = reader.collected.split("\n") - for (var i = 0; i < lines.length; i++) { - var parts = lines[i].split("\t") - if (!labels[parts[0]] || !parts[1] || !parts[1].trim()) continue - out.push({ label: Commons.I18n.t(labels[parts[0]]), value: parts[1].trim() }) - } - page.facts = out - } - } - Rectangle { id: box width: page.width diff --git a/desktop/shell/shell/settings/BackgroundPage.qml b/desktop/shell/shell/settings/BackgroundPage.qml index 70c7a45f..4b6dd218 100644 --- a/desktop/shell/shell/settings/BackgroundPage.qml +++ b/desktop/shell/shell/settings/BackgroundPage.qml @@ -12,6 +12,8 @@ Item { id: page property var settings: null + // Its data read: Settings shows it (and slides it in) only then. + property bool ready: false property var images: [] property string current: "" @@ -47,6 +49,7 @@ Item { out.push({ path: file, real: parts[2] || file, name: name, video: /\.(mp4|webm|mov|mkv)$/i.test(file) }) } page.images = out + page.ready = true } } diff --git a/desktop/shell/shell/settings/DateTimePage.qml b/desktop/shell/shell/settings/DateTimePage.qml index 1247a765..f2ce6e0f 100644 --- a/desktop/shell/shell/settings/DateTimePage.qml +++ b/desktop/shell/shell/settings/DateTimePage.qml @@ -12,6 +12,8 @@ Item { id: page property var settings: null + // Its data read: Settings shows it (and slides it in) only then. + property bool ready: false width: parent ? parent.width : 0 height: column.height @@ -37,6 +39,7 @@ Item { else if (key === "NTP") page.automatic = value === "yes" else if (key === "CanNTP") page.canAutomatic = value === "yes" } + page.ready = true } } } diff --git a/desktop/shell/shell/settings/DisplayPage.qml b/desktop/shell/shell/settings/DisplayPage.qml index ee895535..ca565260 100644 --- a/desktop/shell/shell/settings/DisplayPage.qml +++ b/desktop/shell/shell/settings/DisplayPage.qml @@ -12,6 +12,10 @@ Item { id: page property var settings: null + // Its data read: Settings shows it (and slides it in) only then. + readonly property bool ready: brightnessDone && autoDone + property bool brightnessDone: false + property bool autoDone: false width: parent ? parent.width : 0 height: column.height @@ -30,6 +34,7 @@ Item { onStreamFinished: { var value = parseInt(String(text).trim(), 10) page.brightness = isNaN(value) ? -1 : value + page.brightnessDone = true } } } @@ -41,6 +46,7 @@ Item { onStreamFinished: { page.autoAvailable = /auto-brightness: (on|off)/.test(text) page.autoOn = /auto-brightness: on/.test(text) + page.autoDone = true } } } diff --git a/desktop/shell/shell/settings/IconsPage.qml b/desktop/shell/shell/settings/IconsPage.qml index d0515584..4fabc6b8 100644 --- a/desktop/shell/shell/settings/IconsPage.qml +++ b/desktop/shell/shell/settings/IconsPage.qml @@ -12,6 +12,8 @@ Item { id: page property var settings: null + // Its data read: Settings shows it (and slides it in) only then. + property bool ready: false property var sets: [] property string current: "" @@ -51,6 +53,7 @@ Item { out.push({ id: parts[1], name: Model.displayName(parts[1]), preview: parts[2] || "" }) } page.sets = out + page.ready = true } } diff --git a/desktop/shell/shell/settings/Settings.qml b/desktop/shell/shell/settings/Settings.qml index 0143959f..55b3b36b 100644 --- a/desktop/shell/shell/settings/Settings.qml +++ b/desktop/shell/shell/settings/Settings.qml @@ -1,6 +1,7 @@ import QtQuick import Quickshell import Quickshell.Bluetooth +import Quickshell.Io import qs.Commons import qs.Commons as Commons import "SettingsLayout.js" as Layout @@ -54,6 +55,43 @@ Item { root.opened = false } + // About's facts: model, system, version, kernel, memory and storage, read + // as the window opens so the page shows them whole. A line the system + // cannot answer is left out. + property var aboutFacts: [] + onOpenedChanged: if (opened) readAbout() + function readAbout() { if (!aboutReader.running) { aboutReader.collected = ""; aboutReader.running = true } } + Process { + id: aboutReader + command: ["bash", "-lc", [ + "model=$(tr -d '\\0' < /proc/device-tree/model 2>/dev/null); [[ -n $model ]] || model=$(cat /sys/class/dmi/id/product_name 2>/dev/null)", + "printf 'device\\t%s\\n' \"$model\"", + "printf 'name\\t%s\\n' \"$(cat /etc/hostname 2>/dev/null || uname -n)\"", + "printf 'system\\t%s\\n' \"$(. /etc/os-release 2>/dev/null; echo \"$PRETTY_NAME\")\"", + "printf 'version\\t%s\\n' \"$(omarchy-version 2>/dev/null || cat \"$OMARCHY_PATH/version\" 2>/dev/null)\"", + "printf 'kernel\\t%s\\n' \"$(uname -r)\"", + "printf 'memory\\t%s\\n' \"$(awk '/^MemTotal:/ { printf \"%.1f GB\", $2 / 1048576 }' /proc/meminfo)\"", + "printf 'storage\\t%s\\n' \"$(df -B1 / 2>/dev/null | awk 'NR == 2 { printf \"%.0f GB of %.0f GB free\", $4 / 1e9, $2 / 1e9 }')\"" + ].join("\n")] + property string collected: "" + stdout: SplitParser { onRead: function(data) { aboutReader.collected += data + "\n" } } + onExited: { + var labels = { + device: "settings.aboutDevice", name: "settings.aboutName", system: "settings.aboutSystem", + version: "settings.aboutVersion", kernel: "settings.aboutKernel", memory: "settings.aboutMemory", + storage: "settings.aboutStorage" + } + var out = [] + var lines = aboutReader.collected.split("\n") + for (var i = 0; i < lines.length; i++) { + var parts = lines[i].split("\t") + if (!labels[parts[0]] || !parts[1] || !parts[1].trim()) continue + out.push({ label: Commons.I18n.t(labels[parts[0]]), value: parts[1].trim() }) + } + root.aboutFacts = out + } + } + function toggle() { if (root.opened) root.close() else root.open("") diff --git a/desktop/shell/shell/settings/SettingsItem.qml b/desktop/shell/shell/settings/SettingsItem.qml index 701f8677..39ce446e 100644 --- a/desktop/shell/shell/settings/SettingsItem.qml +++ b/desktop/shell/shell/settings/SettingsItem.qml @@ -22,8 +22,11 @@ Item { property bool opens: false property bool usable: true property bool accent: false + // A second way in at the very end (a network's details): its own tap. + property bool info: false signal activated() + signal infoActivated() width: parent ? parent.width : 0 height: (settings ? settings.rowHeight : 42) + (detail !== "" ? Style.space(12) : 0) @@ -119,6 +122,15 @@ Item { interactive: false cursorRing: false } + Text { + id: infoButton + visible: row.info + anchors.verticalCenter: parent.verticalCenter + text: "󰋼" + color: row.settings ? row.settings.accent : "white" + font.family: Style.font.menuFamily + font.pixelSize: Style.font.title + } Text { visible: row.opens anchors.verticalCenter: parent.verticalCenter @@ -132,6 +144,10 @@ Item { TapHandler { id: press enabled: row.usable - onTapped: row.activated() + onTapped: function(point) { + // The info button's end of the row, with room around it for a finger. + if (row.info && point.position.x >= tail.x + infoButton.x - Style.space(14)) row.infoActivated() + else row.activated() + } } } diff --git a/desktop/shell/shell/settings/SettingsWindow.qml b/desktop/shell/shell/settings/SettingsWindow.qml index 6f090df2..4f024151 100644 --- a/desktop/shell/shell/settings/SettingsWindow.qml +++ b/desktop/shell/shell/settings/SettingsWindow.qml @@ -102,7 +102,7 @@ FloatingWindow { property bool navPhone: false property var navPicture: null function navigate(direction, change) { - if (!win.gpu || direction === 0 || content.width <= 0 || navAnim.running || navWait.running) { + if (!win.gpu || direction === 0 || content.width <= 0 || navAnim.running || navWait.running || win.navHeld) { if (navAnim.running) navAnim.complete() change() return @@ -134,14 +134,27 @@ FloatingWindow { win.navChange() win.navChange = null win.navT = 0 + // A page still reading what it shows comes in once it has it: the old + // one stays put till then. + if (win.holdPage) { win.navHeld = true; return } navAnim.restart() } } + property bool navHeld: false + // A native page with data to read (About's facts, the themes) is shown + // only once it has them, or half a second on, so it never comes in short + // and then grows. + readonly property bool pageReady: !nativeLoader.item || nativeLoader.item.ready !== false + property bool holdPage: false + onPageReadyChanged: if (pageReady) holdPage = false + onHoldPageChanged: if (!holdPage && navHeld) { navHeld = false; navAnim.restart() } + Timer { id: readyCap; interval: 500; onTriggered: win.holdPage = false } NumberAnimation { id: navAnim target: win; property: "navT"; from: 0; to: 1 duration: Style.duration(340) easing.type: Easing.OutCubic + onStopped: win.navHeld = false onFinished: { if (win.navPicture) { win.navPicture.visible = false; win.navPicture.sourceItem = null } win.navPicture = null @@ -375,7 +388,7 @@ FloatingWindow { // ---------------------------------------------------------------- layout // The old page during a transition: under the new one going forward, over - // it going back; a shade deepens on it as it moves under. + // it going back, fading as it goes. ShaderEffectSource { id: shot visible: false @@ -386,11 +399,6 @@ FloatingWindow { opacity: Math.max(0.01, 1 - win.navT) z: win.navDirection < 0 ? 2 : -1 transform: Translate { x: win.slideOld } - Rectangle { - anchors.fill: parent - color: "black" - opacity: win.navDirection > 0 ? 0.18 * win.navT : 0 - } } Item { @@ -654,11 +662,6 @@ FloatingWindow { opacity: Math.max(0.01, 1 - win.navT) z: win.navDirection < 0 ? 2 : 0 transform: Translate { x: win.slideOld } - Rectangle { - anchors.fill: parent - color: "black" - opacity: win.navDirection > 0 ? 0.18 * win.navT : 0 - } } Item { @@ -683,6 +686,8 @@ FloatingWindow { y: win.pad width: parent.width - win.pad * 2 spacing: Style.space(14) + // Shown in place (a wide window's section) only with its data in. + opacity: win.holdPage && win.navDirection === 0 ? 0 : 1 // Back and the title. On a phone the back reads "‹ Settings" at // the top of a section. @@ -781,7 +786,9 @@ FloatingWindow { } Loader { + id: nativeLoader width: parent.width + onLoaded: if (!win.pageReady) { win.holdPage = true; readyCap.restart() } active: win.nativePage !== "" visible: active sourceComponent: win.nativePage === "theme" ? themePage @@ -789,6 +796,7 @@ FloatingWindow { : win.nativePage === "icons" ? iconsPage : win.nativePage === "about" ? aboutPage : win.nativePage === "wifi" ? wifiPage + : win.nativePage === "wifinetwork" ? wifiNetworkPage : win.nativePage === "bluetooth" ? bluetoothPage : win.nativePage === "sound" ? soundPage : win.nativePage === "display" ? displayPage @@ -1076,5 +1084,6 @@ FloatingWindow { Component { id: displayPage; DisplayPage { settings: win } } Component { id: dateTimePage; DateTimePage { settings: win } } Component { id: timezonePage; TimezonePage { settings: win } } + Component { id: wifiNetworkPage; WifiNetworkPage { settings: win } } Component { id: shortcutsPage; ShortcutsPage { settings: win } } } diff --git a/desktop/shell/shell/settings/ShortcutsPage.qml b/desktop/shell/shell/settings/ShortcutsPage.qml index 2a87ee1e..497b6197 100644 --- a/desktop/shell/shell/settings/ShortcutsPage.qml +++ b/desktop/shell/shell/settings/ShortcutsPage.qml @@ -20,6 +20,8 @@ Item { path: (Quickshell.env("HOME") || "") + "/.config/labwc/rc.xml" watchChanges: true printErrors: false + // Read before the page shows, so it comes in whole. + blockLoading: true onFileChanged: reload() } readonly property var groups: Shortcuts.groups(rc.text()) diff --git a/desktop/shell/shell/settings/ThemePage.qml b/desktop/shell/shell/settings/ThemePage.qml index 28734940..7946bcd0 100644 --- a/desktop/shell/shell/settings/ThemePage.qml +++ b/desktop/shell/shell/settings/ThemePage.qml @@ -11,6 +11,8 @@ Item { id: page property var settings: null + // Its data read: Settings shows it (and slides it in) only then. + property bool ready: false property var themes: [] property string current: "" @@ -48,6 +50,7 @@ Item { out.push({ slug: parts[1], name: Model.displayName(parts[1]), colors: Model.parseColors((parts[2] || "").split(";").join("\n")) }) } page.themes = out + page.ready = true } } diff --git a/desktop/shell/shell/settings/TimezonePage.qml b/desktop/shell/shell/settings/TimezonePage.qml index 421e5201..d847d53a 100644 --- a/desktop/shell/shell/settings/TimezonePage.qml +++ b/desktop/shell/shell/settings/TimezonePage.qml @@ -18,6 +18,8 @@ Item { height: column.height property var zones: [] + // The list read: Settings shows the page (and slides it in) only then. + readonly property bool ready: zones.length > 0 property string current: "" Process { running: true diff --git a/desktop/shell/shell/settings/WifiNetworkPage.qml b/desktop/shell/shell/settings/WifiNetworkPage.qml new file mode 100644 index 00000000..a50a6982 --- /dev/null +++ b/desktop/shell/shell/settings/WifiNetworkPage.qml @@ -0,0 +1,187 @@ +import QtQuick +import Quickshell +import Quickshell.Io +import Quickshell.Networking +import qs.Commons +import qs.Commons as Commons +import "../plugins/panels/network" as Network + +// One network's page (Wi-Fi > a known network's info button, or the network +// in use): join or disconnect, forget, auto-join, and while connected its +// addresses. The network is looked up by name each time, never held: a scan +// can delete the object (WifiPage says why). +Item { + id: page + + property var settings: null + readonly property string ssid: settings && settings.top && settings.top.ssid ? settings.top.ssid : "" + + width: parent ? parent.width : 0 + height: column.height + + Network.Status { id: status } + + readonly property var network: { + var list = status.wifiNetworkObjects || [] + for (var i = 0; i < list.length; i++) if (list[i] && list[i].name === page.ssid) return list[i] + return null + } + readonly property bool connected: !!network && network.connected + readonly property bool known: !!network && network.known + readonly property bool changing: !!network && network.stateChanging + readonly property string device: status.wifiDevice ? String(status.wifiDevice.name || "") : "" + + // What NetworkManager has on it: its saved profile (auto-join, security) + // and, while connected, the device's addresses. + property string uuid: "" + property bool autoJoin: true + property string keyMgmt: "" + property string address: "" + property string router: "" + property var dns: [] + property bool ready: false + function read() { if (!reader.running) reader.running = true } + Component.onCompleted: read() + onConnectedChanged: read() + onKnownChanged: { read(); if (!known && !changing && ready && settings) settings.back() } + Process { + id: reader + command: ["bash", "-c", [ + "ssid=$1 dev=$2", + "while IFS=: read -r u t; do", + " [[ $t == 802-11-wireless ]] || continue", + " [[ $(nmcli -g 802-11-wireless.ssid connection show \"$u\" 2>/dev/null) == \"$ssid\" ]] || continue", + " printf 'uuid\\t%s\\n' \"$u\"", + " printf 'auto\\t%s\\n' \"$(nmcli -g connection.autoconnect connection show \"$u\")\"", + " printf 'key\\t%s\\n' \"$(nmcli -g 802-11-wireless-security.key-mgmt connection show \"$u\")\"", + " break", + "done < <(nmcli -g UUID,TYPE connection show 2>/dev/null)", + "[[ -n $dev ]] && nmcli -t -f IP4.ADDRESS,IP4.GATEWAY,IP4.DNS device show \"$dev\" 2>/dev/null | sed 's/^/ip\\t/'" + ].join("\n"), "wifi-network", page.ssid, page.connected ? page.device : ""] + stdout: StdioCollector { + onStreamFinished: { + var uuid = "", auto = true, key = "", address = "", router = "", dns = [] + var lines = String(text).split("\n") + for (var i = 0; i < lines.length; i++) { + var parts = lines[i].split("\t") + if (parts[0] === "uuid") uuid = parts[1] || "" + else if (parts[0] === "auto") auto = parts[1] !== "no" + else if (parts[0] === "key") key = parts[1] || "" + else if (parts[0] === "ip") { + var at = (parts[1] || "").indexOf(":") + if (at < 0) continue + var name = parts[1].slice(0, at), value = parts[1].slice(at + 1) + if (value === "" || value === "--") continue + if (name.indexOf("IP4.ADDRESS") === 0 && address === "") address = value.replace(/\/\d+$/, "") + else if (name === "IP4.GATEWAY") router = value + else if (name.indexOf("IP4.DNS") === 0) dns.push(value) + } + } + page.uuid = uuid + page.autoJoin = auto + page.keyMgmt = key + page.address = page.connected ? address : "" + page.router = page.connected ? router : "" + page.dns = page.connected ? dns : [] + page.ready = true + } + } + } + Process { + id: writer + onExited: page.read() + } + function setAutoJoin(on) { + if (page.uuid === "") return + page.autoJoin = on + writer.command = ["nmcli", "connection", "modify", "uuid", page.uuid, "connection.autoconnect", on ? "yes" : "no"] + writer.running = true + } + + readonly property string securityName: { + if (page.keyMgmt === "sae") return "WPA3" + if (page.keyMgmt === "wpa-psk") return "WPA2" + if (page.keyMgmt === "wpa-eap" || page.keyMgmt === "wpa-eap-suite-b-192") return Commons.I18n.t("settings.wifiEnterprise") + if (page.keyMgmt === "owe") return "OWE" + if (page.keyMgmt === "none") return "WEP" + return page.known && page.uuid !== "" ? Commons.I18n.t("settings.wifiOpen") : "" + } + + Column { + id: column + width: page.width + spacing: Style.space(14) + + SettingsBox { + settings: page.settings + width: parent.width + SettingsItem { + settings: page.settings + first: true + accent: true + label: page.connected ? Commons.I18n.t("settings.wifiDisconnect") : Commons.I18n.t("settings.wifiJoin") + value: page.changing ? (page.connected ? Commons.I18n.t("network.disconnecting") : Commons.I18n.t("network.connecting")) : "" + usable: !!page.network && !page.changing + onActivated: if (page.network) { if (page.connected) page.network.disconnect(); else page.network.connect() } + } + SettingsItem { + visible: page.known + settings: page.settings + accent: true + label: Commons.I18n.t("settings.wifiForget") + usable: !page.changing + onActivated: if (page.network) page.network.forget() + } + } + + SettingsBox { + visible: page.known && page.uuid !== "" + settings: page.settings + width: parent.width + SettingsItem { + settings: page.settings + first: true + label: Commons.I18n.t("settings.wifiAutoJoin") + isSwitch: true + switchOn: page.autoJoin + onActivated: page.setAutoJoin(!page.autoJoin) + } + } + + SettingsBox { + settings: page.settings + width: parent.width + title: Commons.I18n.t("settings.wifiDetails") + SettingsItem { + settings: page.settings + first: true + label: Commons.I18n.t("settings.wifiSignal") + value: page.network ? Math.round((page.network.signalStrength || 0) * 100) + "%" : "" + } + SettingsItem { + visible: page.securityName !== "" + settings: page.settings + label: Commons.I18n.t("settings.wifiSecurity") + value: page.securityName + } + SettingsItem { + visible: page.address !== "" + settings: page.settings + label: Commons.I18n.t("network.ipAddress") + value: page.address + } + SettingsItem { + visible: page.router !== "" + settings: page.settings + label: Commons.I18n.t("settings.wifiRouter") + value: page.router + } + SettingsItem { + visible: page.dns.length > 0 + settings: page.settings + label: Commons.I18n.t("settings.wifiDns") + value: page.dns.join(", ") + } + } + } +} diff --git a/desktop/shell/shell/settings/WifiPage.qml b/desktop/shell/shell/settings/WifiPage.qml index c133f161..6683868c 100644 --- a/desktop/shell/shell/settings/WifiPage.qml +++ b/desktop/shell/shell/settings/WifiPage.qml @@ -8,7 +8,8 @@ import "../plugins/panels/network" as Network import "../plugins/panels/network/Model.js" as NetModel // Wi-Fi: the switch, the network in use, known and other networks (a tap -// joins; a network that needs a password asks for it in place), through the +// joins; a network that needs a password asks for it in place; a known +// network's info button opens its page, WifiNetworkPage), through the // same NetworkManager calls as the control center's network page. The list // holds plain rows, never the networks themselves, which a scan can delete // while a row is being built (the control center's Model.wifiRow says why). @@ -80,6 +81,9 @@ Item { } page.askingSsid = page.askingSsid === row.ssid ? "" : row.ssid } + function details(row) { + if (page.settings) page.settings.push({ kind: "native", page: "wifinetwork", title: row.ssid, ssid: row.ssid }) + } function submit(ssid, identity, secret) { var network = page.networkFor(ssid) if (!network || secret === "") return @@ -177,7 +181,11 @@ Item { label: entry.modelData.ssid value: page.stateOf(entry.modelData) trailingGlyph: !entry.modelData.known && page.needsPassword(entry.modelData) ? "󰌾" : "" - onActivated: page.join(entry.modelData) + // A known network's page behind its info button; the one in + // use opens it with a tap anywhere. + info: entry.modelData.known + onInfoActivated: page.details(entry.modelData) + onActivated: entry.modelData.connected ? page.details(entry.modelData) : page.join(entry.modelData) } PasswordRow { visible: page.askingSsid === entry.modelData.ssid diff --git a/tests/test_bar_layout.py b/tests/test_bar_layout.py index 0e2d8c65..10f93304 100644 --- a/tests/test_bar_layout.py +++ b/tests/test_bar_layout.py @@ -32,7 +32,7 @@ def test_a_phones_bar_is_logo_and_time_then_status(self): self.assertEqual(ids['left'], ['omarchy.menu', 'omarchy.clock']) self.assertEqual(ids['center'], []) self.assertEqual(ids['right'], ['omarchy.indicators', 'omarchy.audio', 'omarchy.bluetooth', 'omarchy.network', - 'omarchy.monitor', 'omarchy.power', 'ipadlinux.controlcenter']) + 'omarchy.monitor', 'omarchy.power']) self.assertEqual(narrow['pages'], 1) # Every icon stays on a phone's bar for now: nothing is hidden there. configured = [entry for entries in json.loads(CONFIG.read_text())['bar']['layout'].values() for entry in entries] From fa13f6d6678f2d7315da7b0e8663ae685ab57ac2 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sun, 22 Nov 2026 03:06:48 +0800 Subject: [PATCH 2/2] Control center: volume names a non-built-in output; slider labels centred by their ink --- .../shell/controlcenter/ControlCenter.qml | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/desktop/shell/shell/controlcenter/ControlCenter.qml b/desktop/shell/shell/controlcenter/ControlCenter.qml index c93ad160..50bf1cbc 100644 --- a/desktop/shell/shell/controlcenter/ControlCenter.qml +++ b/desktop/shell/shell/controlcenter/ControlCenter.qml @@ -57,6 +57,14 @@ Item { readonly property var source: Pipewire.defaultAudioSource PwObjectTracker { objects: [root.sink, root.source].filter(function(n) { return !!n }) } readonly property real volume: sink && sink.audio ? sink.audio.volume : 0 + // The output's name when it is not the built-in one: Bluetooth, USB or a + // display's (HDMI, DisplayPort). PipeWire names the node after its bus. + readonly property string externalOutput: { + if (!sink) return "" + var node = String(sink.name || "") + if (!/^bluez_output\.|\.usb-|hdmi|displayport/i.test(node)) return "" + return String(sink.nickname || sink.description || "") + } readonly property bool micMuted: UntypedInput.active ? (!UntypedInput.known || UntypedInput.muted) : !(source && source.audio) || source.audio.muted @@ -778,6 +786,8 @@ Item { glyph: root.volume <= 0 || (root.sink && root.sink.audio && root.sink.audio.muted) ? "󰝟" : "󰕾" value: root.volume available: !!(root.sink && root.sink.audio) + // Where the sound goes, as plain text, unless it is the device's own. + note: root.externalOutput pageArrow: true focusKey: "volume" page: "omarchy.audio" @@ -1058,23 +1068,34 @@ Item { } } + // Placed by what they draw, not by their line boxes: a symbol and a + // word of another size centred by their boxes sit at different heights. + function inkCentre(item, ink) { return (slider.height - ink.height) / 2 - ink.y - item.baselineOffset } + TextMetrics { id: glyphInk; font: glyphText.font; text: slider.glyph } + TextMetrics { id: capInk; font: noteText.font; text: "H" } + TextMetrics { id: arrowInk; font: arrow.font; text: arrow.text } Text { + id: glyphText x: slider.vertical ? (parent.width - width) / 2 : Style.space(12) - y: slider.vertical ? parent.height - height - Style.space(12) : (parent.height - height) / 2 + y: slider.vertical ? parent.height - height - Style.space(12) : slider.inkCentre(glyphText, glyphInk.tightBoundingRect) text: slider.glyph color: slider.value > 0.08 ? Commons.Color.background : root.text font.family: Style.font.family font.pixelSize: Style.font.heading } Text { + id: noteText visible: slider.note !== "" - // Left of the arrow, which takes the right end. + // Left of the arrow, which takes the right end; a long name gives way. x: slider.vertical ? Style.space(12) : parent.width - width - Style.space(12) - (arrow.visible ? arrow.width + Style.space(8) : 0) - y: slider.vertical ? Style.space(12) : (parent.height - height) / 2 + y: slider.vertical ? Style.space(12) : slider.inkCentre(noteText, capInk.tightBoundingRect) + width: Math.min(implicitWidth, parent.width * 0.5) + elide: Text.ElideRight textFormat: Text.PlainText text: slider.note - color: root.text + // Dark on the fill, light beside it, as the arrow. + color: !slider.vertical && (x + width / 2) / slider.width < slider.value ? Commons.Color.background : root.text opacity: 0.7 font.family: Style.font.family font.pixelSize: Style.font.caption @@ -1144,7 +1165,7 @@ Item { // sets the level like anywhere else on the slider. visible: slider.pageArrow x: parent.width - width - Style.space(14) - y: slider.vertical ? Style.space(10) : (parent.height - height) / 2 + y: slider.vertical ? Style.space(10) : slider.inkCentre(arrow, arrowInk.tightBoundingRect) readonly property bool onFillPart: slider.vertical ? (1 - (y + height / 2) / slider.height) < slider.value : (x + width / 2) / slider.width < slider.value