diff --git a/CHANGELOG.md b/CHANGELOG.md index 543bd752..94090031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ is missing or empty. - No more separate login screen: the tablet boots straight to the lock, the same screen as after Power, and the desktop is ready the moment you enter the PIN. Logout starts a fresh desktop behind the lock. +- The lock screen shows the status icons in its corner: Wi-Fi, battery, and + Bluetooth, a muted microphone, rotation lock and Stay Awake when they're on. ## [0.3.2] - 2026-11-19 diff --git a/desktop/shell/shell/plugins/lock/LockView.qml b/desktop/shell/shell/plugins/lock/LockView.qml index 05541f1d..f057c7ef 100644 --- a/desktop/shell/shell/plugins/lock/LockView.qml +++ b/desktop/shell/shell/plugins/lock/LockView.qml @@ -4,6 +4,7 @@ import Quickshell import qs.Commons import qs.Commons as Commons import qs.Ui +import "../status" as Status Item { id: root @@ -19,6 +20,8 @@ Item { property bool inputEnabled: true property bool loadBackground: true property string passwordText: "" + // Stay Awake, for the status cluster (the shell's idle service knows it). + property bool stayAwake: false property bool syncingPasswordText: false readonly property bool touchPin: Quickshell.env("OMARCHY_TOUCH_MODE") === "1" @@ -183,6 +186,17 @@ Item { color: Commons.Color.lock.scrim } + // The status bar's right-hand cluster only: no logo (the launcher is not + // reachable while locked) and no clock (the big one shows the time). + Status.StatusCluster { + // Centred in the status bar's 24-point band. + y: Math.round((Style.space(24) - height) / 2) + anchors.right: parent.right + anchors.rightMargin: Style.space(root.phone ? 12 : 16) + stayAwake: root.stayAwake + color: Commons.Color.lock.text + } + MouseArea { anchors.fill: parent // Creating a lock surface can synthesize a pointer movement. On a tablet diff --git a/desktop/shell/shell/plugins/lock/Service.qml b/desktop/shell/shell/plugins/lock/Service.qml index 28f691e9..44757da3 100644 --- a/desktop/shell/shell/plugins/lock/Service.qml +++ b/desktop/shell/shell/plugins/lock/Service.qml @@ -32,6 +32,8 @@ Item { readonly property bool startLocked: Quickshell.env("OMARCHY_START_LOCKED") === "1" property bool startLockTaken: false property bool startupLifted: false + readonly property var idleService: shell ? shell.firstPartyServiceFor("omarchy.idle") : null + readonly property bool stayAwake: idleService ? idleService.stayAwake === true : false property bool fingerprintConfigured: false property int fingerprintUnreachedStreak: 0 property bool fingerprintAttemptReachedDevice: false @@ -536,6 +538,7 @@ Item { inputEnabled: root.lockRequested loadBackground: root.locked passwordText: root.enteredPassword + stayAwake: root.stayAwake onPasswordTextEdited: function(password) { root.enteredPassword = password } onSubmitPassword: function(password) { root.submitPassword(password) } onClearFailureRequested: root.failureMessage = "" @@ -582,6 +585,7 @@ Item { inputEnabled: false loadBackground: root.previewVisible passwordText: "" + stayAwake: root.stayAwake } MouseArea { diff --git a/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml b/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml index 95016ddb..3d8a6834 100644 --- a/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml +++ b/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml @@ -59,12 +59,10 @@ Panel { readonly property var knownDevices: deviceGroups.known || [] readonly property var discoveredDevices: deviceGroups.discovered || [] - readonly property string icon: { - if (!adapter) return "" - if (!adapter.enabled) return "󰂲" - if (connectedDevices.length > 0) return "󰂱" - return "󰂯" - } + // Orchard: the bar's glyph lives in Status.qml, which the status cluster + // and the lock share. + Status { id: status } + readonly property string icon: status.icon property int phraseIndex: 0 readonly property var activePhrases: [ diff --git a/desktop/shell/shell/plugins/panels/bluetooth/Status.qml b/desktop/shell/shell/plugins/panels/bluetooth/Status.qml new file mode 100644 index 00000000..2adbf37a --- /dev/null +++ b/desktop/shell/shell/plugins/panels/bluetooth/Status.qml @@ -0,0 +1,22 @@ +import QtQuick +import Quickshell +import Quickshell.Bluetooth +import "Model.js" as Model + +// Orchard: the Bluetooth state the bar's icon shows, apart from the panel, so +// the status cluster, the lock and the control center show the same thing. +Item { + id: root + visible: false + + readonly property var adapter: Bluetooth.defaultAdapter + readonly property bool enabled: !!(adapter && adapter.enabled) + readonly property var devices: Bluetooth.devices ? Bluetooth.devices.values : [] + readonly property var connectedDevices: (Model.deviceLists(devices).connected) || [] + readonly property string icon: { + if (!adapter) return "" + if (!adapter.enabled) return "󰂲" + if (connectedDevices.length > 0) return "󰂱" + return "󰂯" + } +} diff --git a/desktop/shell/shell/plugins/panels/network/Panel.qml b/desktop/shell/shell/plugins/panels/network/Panel.qml index b3fb8121..c48ba79b 100644 --- a/desktop/shell/shell/plugins/panels/network/Panel.qml +++ b/desktop/shell/shell/plugins/panels/network/Panel.qml @@ -67,14 +67,17 @@ Panel { Commons.I18n.t("network.phrase7") ] readonly property string connectionPhrase: connectionPhrases[connectionPhraseIndex % connectionPhrases.length] - readonly property bool networkManagerAvailable: Networking.backend === NetworkBackendType.NetworkManager - readonly property var networkDevices: Networking.devices ? Networking.devices.values : [] - readonly property var wifiDevice: findDevice(DeviceType.Wifi) - readonly property var wifiNetworkObjects: wifiDevice && wifiDevice.networks ? wifiDevice.networks.values : [] + // Orchard: the connection state lives in Status.qml, which the status + // cluster and the lock share; these names stay the panel's. + Status { id: status } + readonly property bool networkManagerAvailable: status.networkManagerAvailable + readonly property var networkDevices: status.networkDevices + readonly property var wifiDevice: status.wifiDevice + readonly property var wifiNetworkObjects: status.wifiNetworkObjects // Bound here rather than in a row, so it also sees networks with no delegate: // scrolled out of view, or the panel closed. readonly property string wifiStateKey: Model.wifiStateKey(wifiNetworkObjects) - readonly property var connectedWifiNetwork: findConnectedWifiNetwork() + readonly property var connectedWifiNetwork: status.connectedWifiNetwork property var wifiNetworks: [] property bool scanning: false property bool wifiStationAvailable: false @@ -431,7 +434,6 @@ Panel { onWifiDeviceChanged: { setScannerEnabled(true) syncWifiNetworks() - resetActiveApSignal() } onWifiNetworkObjectsChanged: syncWifiNetworks() @@ -479,89 +481,20 @@ Panel { connectDirectly(net.ssid) } - // Bar pill state, derived from the native NetworkManager service so the - // icon reflects connection changes without polling. Wired is preferred - // when both are up, matching the default-route device. - readonly property var wiredDevice: findDevice(DeviceType.Wired) - readonly property string kind: { - if (wiredDevice && wiredDevice.connected) return "ethernet" - if (connectedWifiNetwork) return "wifi" - // NetworkManager can leave the active profile out of the device's - // AvailableConnections, and Quickshell only builds known networks from - // that list. An OWE transition-mode network does this between scans: the - // in-use access point carries the hidden "_owetm_" SSID, so the profile - // for the open SSID looks out of range even while it is connected. Trust - // the device's own state then instead of flickering to disconnected. - if (wifiDevice && wifiDevice.connected) return "wifi" - return "disconnected" - } - readonly property int signalStrength: kind === "wifi" - ? Model.connectedSignalStrength(connectedWifiNetwork ? connectedWifiNetwork.signalStrength : 0, activeApSignal) - : -1 - // Filled by activeApSignalPoll from nmcli while the connected network has no - // strength of its own to report. - property int activeApSignal: -1 - readonly property bool needsActiveApSignal: kind === "wifi" - && !(connectedWifiNetwork && connectedWifiNetwork.signalStrength > 0) - // Bumped whenever the cached reading stops describing the current link, so - // an nmcli read still in flight from before cannot write a stale strength. - property int activeApSignalGeneration: 0 - property int activeApSignalRequest: -1 - onKindChanged: if (kind !== "wifi") resetActiveApSignal() - - // Switching Wi-Fi networks always passes through a non-"wifi" kind (both the - // device and the old network drop out of the connected state while the new - // profile activates), so this also covers a change of network. - function resetActiveApSignal() { - activeApSignal = -1 - activeApSignalGeneration++ - } - - function pollActiveApSignal() { - if (activeApSignalProc.running) return - activeApSignalRequest = activeApSignalGeneration - activeApSignalProc.running = true - } - - function finishActiveApSignal(raw) { - if (activeApSignalRequest !== activeApSignalGeneration) { - // The link changed mid-read and the restarted poll skipped while this - // one was running; read again now instead of a full interval later. - if (needsActiveApSignal) activeApSignalPoll.restart() - return - } - activeApSignal = Model.parseActiveApSignal(raw) - } + readonly property var wiredDevice: status.wiredDevice + readonly property string kind: status.kind + readonly property int signalStrength: status.signalStrength function copyToClipboard(value) { if (!value || !root.bar) return Quickshell.execDetached(["bash", "-c", "printf %s " + Util.shellQuote(value) + " | wl-copy"]) } - // NetworkManager performs the HTTP probe (including unexpected page bodies, - // not just redirects). Consume its native notifications rather than running - // a second curl loop or mistaking an ordinary timeout for a captive portal. - readonly property bool connectivityChecksEnabled: networkManagerAvailable - && Networking.canCheckConnectivity && Networking.connectivityCheckEnabled - readonly property string connectivity: Model.connectivityState(kind, Networking.connectivity, { - Portal: NetworkConnectivity.Portal, Limited: NetworkConnectivity.Limited, - Full: NetworkConnectivity.Full, None: NetworkConnectivity.None - }, connectivityChecksEnabled, limitedSettled) - // A network switch passes through Limited for a fraction of a second while - // NetworkManager's first probe is in flight. Wait that out rather than flash - // the outage warning on every connect. - readonly property bool nativeLimited: Networking.connectivity === NetworkConnectivity.Limited - property bool limitedSettled: false - onNativeLimitedChanged: if (!nativeLimited) limitedSettled = false - Timer { - id: limitedSettle - interval: 3000 - running: root.nativeLimited - onTriggered: root.limitedSettled = true - } - readonly property bool hasCaptivePortal: connectivity === "portal" - readonly property bool restricted: hasCaptivePortal || connectivity === "limited" - readonly property string icon: Model.connectionIcon(kind, signalStrength, connectivity) + readonly property bool connectivityChecksEnabled: status.connectivityChecksEnabled + readonly property string connectivity: status.connectivity + readonly property bool hasCaptivePortal: status.hasCaptivePortal + readonly property bool restricted: status.restricted + readonly property string icon: status.icon // Keyed on the device rather than the SSID: on an OWE transition-mode // network the listed network comes and goes with every scan while the link // stays up, and a real network switch already passes through "disconnected". @@ -727,28 +660,7 @@ Panel { return Model.formatPacketLoss(percent, hasInternetPing, Commons.I18n.formatNumber) } - // Prefer a connected device: a machine can expose several NICs of the - // same type (e.g. an idle onboard port alongside the active adapter), - // and the first-enumerated one may be carrierless. - function findDevice(type) { - var devices = networkDevices || [] - var fallback = null - for (var i = 0; i < devices.length; i++) { - var device = devices[i] - if (!device || device.type !== type) continue - if (device.connected) return device - if (!fallback) fallback = device - } - return fallback - } - - function findConnectedWifiNetwork() { - var networks = wifiNetworkObjects || [] - for (var i = 0; i < networks.length; i++) { - if (networks[i] && networks[i].connected) return networks[i] - } - return null - } + function findDevice(type) { return status.findDevice(type) } function syncWifiNetworks() { rebuildWifiRows() @@ -1009,25 +921,6 @@ Panel { } } - // Reads the in-use access point's strength without triggering a scan, for - // the connected network that has none of its own (see signalStrength). - Process { - id: activeApSignalProc - command: ["nmcli", "-t", "-f", "IN-USE,SIGNAL", "device", "wifi", "list", "ifname", root.wifiDevice ? root.wifiDevice.name : "", "--rescan", "no"] - stdout: StdioCollector { - waitForEnd: true - onStreamFinished: root.finishActiveApSignal(text) - } - } - - Timer { - id: activeApSignalPoll - interval: 5000 - repeat: true - triggeredOnStart: true - running: root.needsActiveApSignal - onTriggered: root.pollActiveApSignal() - } Timer { id: scanRestart diff --git a/desktop/shell/shell/plugins/panels/network/Status.qml b/desktop/shell/shell/plugins/panels/network/Status.qml new file mode 100644 index 00000000..6f21d166 --- /dev/null +++ b/desktop/shell/shell/plugins/panels/network/Status.qml @@ -0,0 +1,143 @@ +import QtQuick +import Quickshell +import Quickshell.Io +import Quickshell.Networking +import "Model.js" as Model + +// Orchard: the connection state the bar's icon shows, apart from the panel, +// so the status cluster, the lock and the control center show the same thing. +// The panel binds its own properties of these names to it. +Item { + id: root + visible: false + + readonly property bool networkManagerAvailable: Networking.backend === NetworkBackendType.NetworkManager + readonly property var networkDevices: Networking.devices ? Networking.devices.values : [] + readonly property var wifiDevice: findDevice(DeviceType.Wifi) + readonly property var wiredDevice: findDevice(DeviceType.Wired) + readonly property var wifiNetworkObjects: wifiDevice && wifiDevice.networks ? wifiDevice.networks.values : [] + readonly property var connectedWifiNetwork: findConnectedWifiNetwork() + readonly property bool wifiEnabled: Networking.wifiEnabled + readonly property string ssid: connectedWifiNetwork ? String(connectedWifiNetwork.name || "") : "" + + // Prefer a connected device: a machine can expose several NICs of the + // same type (e.g. an idle onboard port alongside the active adapter), + // and the first-enumerated one may be carrierless. + function findDevice(type) { + var devices = networkDevices || [] + var fallback = null + for (var i = 0; i < devices.length; i++) { + var device = devices[i] + if (!device || device.type !== type) continue + if (device.connected) return device + if (!fallback) fallback = device + } + return fallback + } + + function findConnectedWifiNetwork() { + var networks = wifiNetworkObjects || [] + for (var i = 0; i < networks.length; i++) { + if (networks[i] && networks[i].connected) return networks[i] + } + return null + } + + // Derived from the native NetworkManager service so the icon reflects + // connection changes without polling. Wired is preferred when both are up, + // matching the default-route device. + readonly property string kind: { + if (wiredDevice && wiredDevice.connected) return "ethernet" + if (connectedWifiNetwork) return "wifi" + // NetworkManager can leave the active profile out of the device's + // AvailableConnections, and Quickshell only builds known networks from + // that list. An OWE transition-mode network does this between scans: the + // in-use access point carries the hidden "_owetm_" SSID, so the profile + // for the open SSID looks out of range even while it is connected. Trust + // the device's own state then instead of flickering to disconnected. + if (wifiDevice && wifiDevice.connected) return "wifi" + return "disconnected" + } + readonly property int signalStrength: kind === "wifi" + ? Model.connectedSignalStrength(connectedWifiNetwork ? connectedWifiNetwork.signalStrength : 0, activeApSignal) + : -1 + // Filled by activeApSignalPoll from nmcli while the connected network has no + // strength of its own to report. + property int activeApSignal: -1 + readonly property bool needsActiveApSignal: kind === "wifi" + && !(connectedWifiNetwork && connectedWifiNetwork.signalStrength > 0) + // Bumped whenever the cached reading stops describing the current link, so + // an nmcli read still in flight from before cannot write a stale strength. + property int activeApSignalGeneration: 0 + property int activeApSignalRequest: -1 + onKindChanged: if (kind !== "wifi") resetActiveApSignal() + onWifiDeviceChanged: resetActiveApSignal() + + // Switching Wi-Fi networks always passes through a non-"wifi" kind (both the + // device and the old network drop out of the connected state while the new + // profile activates), so this also covers a change of network. + function resetActiveApSignal() { + activeApSignal = -1 + activeApSignalGeneration++ + } + + function pollActiveApSignal() { + if (activeApSignalProc.running) return + activeApSignalRequest = activeApSignalGeneration + activeApSignalProc.running = true + } + + function finishActiveApSignal(raw) { + if (activeApSignalRequest !== activeApSignalGeneration) { + // The link changed mid-read and the restarted poll skipped while this + // one was running; read again now instead of a full interval later. + if (needsActiveApSignal) activeApSignalPoll.restart() + return + } + activeApSignal = Model.parseActiveApSignal(raw) + } + + // NetworkManager performs the HTTP probe (including unexpected page bodies, + // not just redirects). Consume its native notifications rather than running + // a second curl loop or mistaking an ordinary timeout for a captive portal. + readonly property bool connectivityChecksEnabled: networkManagerAvailable + && Networking.canCheckConnectivity && Networking.connectivityCheckEnabled + readonly property string connectivity: Model.connectivityState(kind, Networking.connectivity, { + Portal: NetworkConnectivity.Portal, Limited: NetworkConnectivity.Limited, + Full: NetworkConnectivity.Full, None: NetworkConnectivity.None + }, connectivityChecksEnabled, limitedSettled) + // A network switch passes through Limited for a fraction of a second while + // NetworkManager's first probe is in flight. Wait that out rather than flash + // the outage warning on every connect. + readonly property bool nativeLimited: Networking.connectivity === NetworkConnectivity.Limited + property bool limitedSettled: false + onNativeLimitedChanged: if (!nativeLimited) limitedSettled = false + Timer { + interval: 3000 + running: root.nativeLimited + onTriggered: root.limitedSettled = true + } + readonly property bool hasCaptivePortal: connectivity === "portal" + readonly property bool restricted: hasCaptivePortal || connectivity === "limited" + readonly property string icon: Model.connectionIcon(kind, signalStrength, connectivity) + + // Reads the in-use access point's strength without triggering a scan, for + // the connected network that has none of its own (see signalStrength). + Process { + id: activeApSignalProc + command: ["nmcli", "-t", "-f", "IN-USE,SIGNAL", "device", "wifi", "list", "ifname", root.wifiDevice ? root.wifiDevice.name : "", "--rescan", "no"] + stdout: StdioCollector { + waitForEnd: true + onStreamFinished: root.finishActiveApSignal(text) + } + } + + Timer { + id: activeApSignalPoll + interval: 5000 + repeat: true + triggeredOnStart: true + running: root.needsActiveApSignal + onTriggered: root.pollActiveApSignal() + } +} diff --git a/desktop/shell/shell/plugins/panels/power/Panel.qml b/desktop/shell/shell/plugins/panels/power/Panel.qml index 393f9f9e..eb8f52f7 100644 --- a/desktop/shell/shell/plugins/panels/power/Panel.qml +++ b/desktop/shell/shell/plugins/panels/power/Panel.qml @@ -14,8 +14,11 @@ Panel { // manageIpc: false so this panel can own the single IpcHandler the target // permits — needed for the togglePercentage method below. manageIpc: false - property var batteryInfo: ({}) - readonly property bool externalPower: batteryInfo.external_power === "connected" + // Orchard: the battery state lives in Status.qml, which the status cluster + // and the lock share; these names stay the panel's. + Status { id: status } + readonly property var batteryInfo: status.batteryInfo + readonly property bool externalPower: status.externalPower property var profiles: [] property string activeProfile: "" property int profileIndex: 0 @@ -25,15 +28,9 @@ Panel { // icon, so the open-panel mark takes the painted width instead of the // icon-sized fraction of the slot the fallback assumes. readonly property real openPanelIndicatorWidth: showPercentage && !button.vertical ? button.glyphPaintedWidth : 0 - readonly property var batteryDevice: { - var device = UPower.displayDevice - if (device && device.isPresent) return device - var measured = Model.batteryPercentage(null, root.batteryInfo) - // Do not invent a charging/discharging state when only capacity is known. - return measured === null ? null : { isPresent: true, percentage: measured / 100, state: 0 } - } - readonly property bool batteryPresent: batteryDevice !== null - readonly property var displayedPercentage: Model.batteryPercentage(batteryDevice, batteryInfo) + readonly property var batteryDevice: status.batteryDevice + readonly property bool batteryPresent: status.batteryPresent + readonly property var displayedPercentage: status.displayedPercentage function upowerStates() { return { @@ -158,18 +155,10 @@ Panel { readonly property string heroStatusText: modeLabel() function refresh() { - if (!batteryProc.running) batteryProc.running = true + status.refresh() if (!profilesProc.running) profilesProc.running = true } - function updateKeyValue(raw) { - var next = Model.parseKeyValue(raw) - // Keep last known good data if a refresh briefly returns nothing — happens - // around AC plug/unplug events. Avoids the section collapsing mid-transition. - if (Object.keys(next).length > 0) batteryInfo = next - else batteryInfo = Object.assign({}, batteryInfo, { external_power: "unknown" }) - } - function updateProfiles(raw) { var parsed = Model.parseProfiles(raw, profileIndex) // Same guard as battery: preserve the last known profile list across @@ -236,12 +225,6 @@ Panel { implicitWidth: batteryPresent ? button.implicitWidth : 0 implicitHeight: batteryPresent ? button.implicitHeight : 0 - Process { - id: batteryProc - command: ["omarchy-battery-status", "--shell"] - stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text) } - } - Process { id: profilesProc command: ["omarchy-powerprofiles-list", "--active-state"] @@ -255,14 +238,11 @@ Panel { Timer { interval: 1000 - // Discovery must not depend on a charger event or UPower.isPresent. - running: true + // The battery reading is Status.qml's own; open, the profiles too. + running: root.opened repeat: true triggeredOnStart: true - onTriggered: { - if (root.opened) root.refresh() - else if (!batteryProc.running) batteryProc.running = true - } + onTriggered: root.refresh() } // Rotate the status phrase while the panel is open and we're in a diff --git a/desktop/shell/shell/plugins/panels/power/Status.qml b/desktop/shell/shell/plugins/panels/power/Status.qml new file mode 100644 index 00000000..d668d8d8 --- /dev/null +++ b/desktop/shell/shell/plugins/panels/power/Status.qml @@ -0,0 +1,67 @@ +import QtQuick +import Quickshell +import Quickshell.Io +import Quickshell.Services.UPower +import "Model.js" as Model + +// Orchard: the battery state the bar's icon shows, apart from the panel, so +// the status cluster, the lock and the control center show the same thing. +// The panel binds its own properties of these names to it. +Item { + id: root + visible: false + + // The battery script's readings (omarchy-battery-status --shell), read + // every second: discovery must not depend on a charger event or on UPower. + property var batteryInfo: ({}) + readonly property bool externalPower: batteryInfo.external_power === "connected" + readonly property var batteryDevice: { + var device = UPower.displayDevice + if (device && device.isPresent) return device + var measured = Model.batteryPercentage(null, root.batteryInfo) + // Do not invent a charging/discharging state when only capacity is known. + return measured === null ? null : { isPresent: true, percentage: measured / 100, state: 0 } + } + readonly property bool batteryPresent: batteryDevice !== null + readonly property var displayedPercentage: Model.batteryPercentage(batteryDevice, batteryInfo) + readonly property bool discharging: { + var device = UPower.displayDevice + return !!(device && device.isPresent && device.state === UPowerDeviceState.Discharging) + } + readonly property string icon: Model.batteryIcon(batteryDevice, discharging, upowerStates(), externalPower) + + function upowerStates() { + return { + Charging: UPowerDeviceState.Charging, + Discharging: UPowerDeviceState.Discharging, + FullyCharged: UPowerDeviceState.FullyCharged, + PendingCharge: UPowerDeviceState.PendingCharge + } + } + + function refresh() { + if (!batteryProc.running) batteryProc.running = true + } + + function updateKeyValue(raw) { + var next = Model.parseKeyValue(raw) + // Keep last known good data if a refresh briefly returns nothing — happens + // around AC plug/unplug events. Avoids the section collapsing mid-transition. + if (Object.keys(next).length > 0) batteryInfo = next + else batteryInfo = Object.assign({}, batteryInfo, { external_power: "unknown" }) + } + + Process { + id: batteryProc + command: ["omarchy-battery-status", "--shell"] + stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text) } + } + + Timer { + interval: 1000 + running: true + repeat: true + triggeredOnStart: true + onTriggered: root.refresh() + } +} diff --git a/desktop/shell/shell/plugins/status/RotationLock.qml b/desktop/shell/shell/plugins/status/RotationLock.qml new file mode 100644 index 00000000..9de44f0e --- /dev/null +++ b/desktop/shell/shell/plugins/status/RotationLock.qml @@ -0,0 +1,25 @@ +import QtQuick +import Quickshell +import Quickshell.Io + +// Whether rotation is locked: omarchy-rotation-lock's file, which only exists +// while it is. Read every two seconds, as a missing file cannot be watched. +Item { + id: root + visible: false + property bool locked: false + + FileView { + id: file + path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/omarchy/rotation-lock" + printErrors: false + onLoaded: root.locked = true + onLoadFailed: root.locked = false + } + Timer { + interval: 2000 + running: true + repeat: true + onTriggered: file.reload() + } +} diff --git a/desktop/shell/shell/plugins/status/StatusCluster.qml b/desktop/shell/shell/plugins/status/StatusCluster.qml new file mode 100644 index 00000000..160e260b --- /dev/null +++ b/desktop/shell/shell/plugins/status/StatusCluster.qml @@ -0,0 +1,89 @@ +import QtQuick +import Quickshell +import Quickshell.Services.Pipewire +import qs.Commons +import qs.Commons as Commons +import "../panels/network" as Network +import "../panels/bluetooth" as BluetoothStatus +import "../panels/power" as Power + +// The status cluster (SHELL-SPEC, step 2): mic muted, rotation lock and Stay +// Awake while on, Bluetooth while on, Wi-Fi, battery percentage and glyph. +// The bar's and the lock's: the host passes what only the shell knows (Stay +// Awake) and decides whether a tap does anything (activated, with the module). +Row { + id: root + + property bool stayAwake: false + property bool rotationLocked: rotation.locked + property color color: Commons.Color.bar.text + property int glyphSize: Style.font.body + property int textSize: Style.font.bodySmall + property bool interactive: false + signal activated(string module) + + spacing: Style.space(10) + + Network.Status { id: network } + BluetoothStatus.Status { id: bluetooth } + Power.Status { id: battery } + RotationLock { id: rotation } + + readonly property var source: Pipewire.defaultAudioSource + PwObjectTracker { objects: root.source ? [root.source] : [] } + // A virtual source is untyped in Quickshell; its mute goes through wpctl. + readonly property bool micMuted: UntypedInput.active + ? (UntypedInput.known && UntypedInput.muted) + : !!(source && source.audio && source.audio.muted) + + readonly property var items: [ + { module: "microphone", glyph: "󰍭", shown: root.micMuted }, + { module: "rotation", glyph: "󰝳", shown: root.rotationLocked }, + { module: "stayAwake", glyph: "", shown: root.stayAwake }, + { module: "bluetooth", glyph: bluetooth.icon, shown: bluetooth.enabled }, + { module: "network", glyph: network.icon, shown: network.icon !== "" }, + { module: "battery", glyph: battery.icon, shown: battery.batteryPresent, + label: battery.displayedPercentage === null ? "" : Commons.I18n.formatNumber(battery.displayedPercentage) + "%" } + ] + + Repeater { + model: root.items + Item { + id: entry + required property var modelData + visible: modelData.shown && modelData.glyph !== "" + height: Math.max(glyph.implicitHeight, label.implicitHeight) + width: entryRow.implicitWidth + Row { + id: entryRow + anchors.verticalCenter: parent.verticalCenter + spacing: Style.space(3) + Text { + id: label + anchors.verticalCenter: parent.verticalCenter + visible: text !== "" + textFormat: Text.PlainText + text: entry.modelData.label || "" + color: root.color + font.family: Style.font.family + font.pixelSize: root.textSize + } + Text { + id: glyph + anchors.verticalCenter: parent.verticalCenter + text: entry.modelData.glyph + color: root.color + font.family: Style.font.family + font.pixelSize: root.glyphSize + } + } + MouseArea { + anchors.fill: parent + anchors.margins: -Style.space(4) + enabled: root.interactive + cursorShape: Qt.PointingHandCursor + onClicked: root.activated(entry.modelData.module) + } + } + } +} diff --git a/docs/upstream.md b/docs/upstream.md index dc8afcdb..b4c3df24 100644 --- a/docs/upstream.md +++ b/docs/upstream.md @@ -64,7 +64,9 @@ only by Home and Power), the idle service (omarchy-powerd's idle), the keyboard panel, menu and overlays (below the on-screen keyboard), the app grid (a text field for the on-screen keyboard, and no version under the selected app; the shell itself opens the launcher instead), the menu's bar logo (opens the -launcher), the image picker (fits a phone's width), `Commons/Color.qml` (cyan, blue and yellow from the theme, `lock.scrim`), network rows (long press for Forget and +launcher), the image picker (fits a phone's width), `Commons/Color.qml` (cyan, blue and yellow from the theme, `lock.scrim`), the network, power and Bluetooth panels (the +state behind their bar icon in each one's `Status.qml`, shared with the status +cluster), network rows (long press for Forget and Change passphrase), Bluetooth pairing feedback, the background (no Hyprland boot cover or theme intro videos, software decode at panel size, no startup signal of its own when the session starts locked), the lock (taken at session @@ -82,7 +84,8 @@ charger PM readiness. **Translations.** `default/i18n/en/cli.json` holds only the keys of the commands shipped here; `shell.json` adds the auto-brightness and captive-portal keys. -**Our own files** (no upstream counterpart): the launcher +**Our own files** (no upstream counterpart): the status cluster +(`shell/plugins/status/`), the launcher (`shell/launcher/`, `bin/omarchy-launcher-recent-files`, `bin/omarchy-launcher-backdrop`), the labwc config, theme renderer and window buttons (`labwc-*`, `render-labwc-*.py`), the on-screen keyboard