diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf6f081..dc2d21d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,11 @@ is missing or empty. - A control center: pull down from the top right, click its icon or press Super+Ctrl+1 for Wi-Fi, Bluetooth, brightness, volume and quick toggles. Long-press for the full settings pages. +- The status bar is back to Omarchy's compact size. Stay Awake sits with the + icons on the right, and the keyboard button is gone: swipe up from the + bottom, or use the control center. +- The launcher opens with a gentle zoom, and can use an opaque background + instead of the blurred wallpaper (Trigger > Toggle). ## [0.3.2] - 2026-11-19 diff --git a/desktop/shell/bin/omarchy-toggle-launcher-opaque b/desktop/shell/bin/omarchy-toggle-launcher-opaque new file mode 100755 index 00000000..747ef6ff --- /dev/null +++ b/desktop/shell/bin/omarchy-toggle-launcher-opaque @@ -0,0 +1,10 @@ +#!/bin/bash + +# omarchy:summary=Show the launcher on the theme's plain background, or on the frosted wallpaper +# Frosted by default. Turned on, the launcher-opaque flag says so; the +# launcher reads it each time it opens. +set -euo pipefail +[[ $# == 0 ]] || { echo 'Usage: omarchy-toggle-launcher-opaque' >&2; exit 2; } +toggles=$HOME/.local/state/omarchy/toggles +mkdir -p "$toggles" +if [[ -e $toggles/launcher-opaque ]]; then rm -f "$toggles/launcher-opaque"; else : >"$toggles/launcher-opaque"; fi diff --git a/desktop/shell/config/omarchy/shell.json b/desktop/shell/config/omarchy/shell.json index c75d48ee..4f5dc7b9 100644 --- a/desktop/shell/config/omarchy/shell.json +++ b/desktop/shell/config/omarchy/shell.json @@ -6,16 +6,17 @@ "background": "opaque", "layout": { "left": [{ "id": "omarchy.menu" }], - "centerBegin": [{ "id": "omarchy.indicators", "items": ["StayAwake"] }], - "center": [{ "id": "omarchy.clock", "format": "HH:mm" }], + "centerBegin": [], + "center": [{ "id": "omarchy.clock", "format": "HH:mm", "narrow": "left" }], "centerEnd": [], "right": [ - { "id": "ipadlinux.keyboard", "narrow": "left" }, - { "id": "omarchy.audio", "narrow": false }, - { "id": "omarchy.bluetooth", "narrow": false }, - { "id": "omarchy.network", "narrow": "left" }, - { "id": "omarchy.monitor", "narrow": false }, - { "id": "omarchy.power" } + { "id": "omarchy.indicators", "items": ["StayAwake"] }, + { "id": "omarchy.audio" }, + { "id": "omarchy.bluetooth" }, + { "id": "omarchy.network" }, + { "id": "omarchy.monitor" }, + { "id": "omarchy.power" }, + { "id": "ipadlinux.controlcenter" } ] } }, diff --git a/desktop/shell/default/i18n/en/shell.json b/desktop/shell/default/i18n/en/shell.json index 17a0f741..76cf4b6e 100644 --- a/desktop/shell/default/i18n/en/shell.json +++ b/desktop/shell/default/i18n/en/shell.json @@ -245,6 +245,7 @@ "clipboard.imageFrom": "Image from %1", "clipboard.screenshotFrom": "Screenshot from %1", "clipboard.search": "Search clipboard…", + "controlCenter.title": "Control center", "controlCenter.auto": "auto", "controlCenter.awake": "Awake", "controlCenter.balanced": "Balanced", @@ -255,6 +256,7 @@ "controlCenter.media": "Media", "controlCenter.mic": "Mic", "controlCenter.night": "Night", + "controlCenter.network": "Network", "controlCenter.notConnected": "Not connected", "controlCenter.off": "Off", "controlCenter.rotation": "Rotation", diff --git a/desktop/shell/default/omarchy/omarchy-menu.jsonc b/desktop/shell/default/omarchy/omarchy-menu.jsonc index 2c54a0ad..1c2eccdf 100644 --- a/desktop/shell/default/omarchy/omarchy-menu.jsonc +++ b/desktop/shell/default/omarchy/omarchy-menu.jsonc @@ -171,6 +171,8 @@ "trigger.toggle.notifications-off": {"icon":"󰂛","label":"Silence Notifications","when":"[[ $(omarchy-shell notifications isDnd) != on ]]","action":"omarchy-toggle-notification-silencing"}, "trigger.toggle.nightlight-on": {"icon":"󰔎","label":"Nightlight On","when":"[[ $(omarchy-toggle-nightlight --status) != *'\"enabled\":true'* ]]","action":"omarchy-toggle-nightlight"}, "trigger.toggle.nightlight-off": {"icon":"󰔎","label":"Nightlight Off","when":"[[ $(omarchy-toggle-nightlight --status) == *'\"enabled\":true'* ]]","action":"omarchy-toggle-nightlight"}, + "trigger.toggle.launcher-opaque": {"icon":"󰀻","label":"Opaque Launcher","when":"! omarchy-toggle-enabled launcher-opaque","action":"omarchy-toggle-launcher-opaque"}, + "trigger.toggle.launcher-frosted": {"icon":"󰀻","label":"Frosted Launcher","when":"omarchy-toggle-enabled launcher-opaque","action":"omarchy-toggle-launcher-opaque"}, "trigger.toggle.screensaver-on": {"icon":"󱄄","label":"Screensaver On","when":"omarchy-toggle-enabled screensaver-off","action":"omarchy-toggle-screensaver"}, "trigger.toggle.screensaver-off": {"icon":"󱄄","label":"Screensaver Off","when":"! omarchy-toggle-enabled screensaver-off","action":"omarchy-toggle-screensaver"}, "trigger.toggle.crash-capture-on": {"icon":"󱚡","label":"Crash Capture On","when":"omarchy-toggle-enabled crash-capture-off","action":"omarchy-toggle-crash-capture"}, diff --git a/desktop/shell/labwc-rc.xml b/desktop/shell/labwc-rc.xml index 6a1df267..6d9d15c5 100644 --- a/desktop/shell/labwc-rc.xml +++ b/desktop/shell/labwc-rc.xml @@ -87,6 +87,22 @@ + + + + + + + + + + + + + + + + diff --git a/desktop/shell/migrations/1795110922.sh b/desktop/shell/migrations/1795110922.sh new file mode 100644 index 00000000..dbd0f4a0 --- /dev/null +++ b/desktop/shell/migrations/1795110922.sh @@ -0,0 +1,12 @@ +echo "Super+Ctrl+A, B, D, N and P open Audio, Bluetooth, Display, Network and Power" + +# Upstream's module keys. A new user's rc.xml has them; an existing one gets +# each one it lacks before the launcher's (Super+Space). +rc="$HOME/.config/labwc/rc.xml" +[[ -f $rc ]] && grep -q '^ ' "$rc" || exit 0 +for pair in a:omarchy.audio b:omarchy.bluetooth d:omarchy.monitor n:omarchy.network p:omarchy.power; do + key=${pair%%:*} module=${pair#*:} + grep -q "key=\"W-C-$key\"" "$rc" && continue + sed "0,/^ /s## \n \n \n #" "$rc" > "$rc.new" + mv -- "$rc.new" "$rc" +done diff --git a/desktop/shell/migrations/1795111372.sh b/desktop/shell/migrations/1795111372.sh new file mode 100644 index 00000000..c5f99564 --- /dev/null +++ b/desktop/shell/migrations/1795111372.sh @@ -0,0 +1,22 @@ +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/migrations/1795111754.sh b/desktop/shell/migrations/1795111754.sh new file mode 100644 index 00000000..4e5538c7 --- /dev/null +++ b/desktop/shell/migrations/1795111754.sh @@ -0,0 +1,36 @@ +echo "The bar's right side: Stay Awake joins it, the keyboard button leaves" + +# The swipe up from the bottom and the control center's Keyboard toggle bring +# the keyboard up; Stay Awake's indicator sits with the status icons. A user's +# own layout (~/.config/omarchy-ipad/shell.json) changes only where it still +# has these as the package placed them. +config="$HOME/.config/omarchy-ipad/shell.json" +[[ -f $config ]] || exit 0 +python3 - "$config" <<'PY' +import json, os, sys +path = sys.argv[1] +with open(path) as f: + config = json.load(f) +layout = config.get("bar", {}).get("layout", {}) +right = layout.get("right") +if not isinstance(right, list): + sys.exit(0) +changed = False +kept = [w for w in right if not (isinstance(w, dict) and w.get("id") == "ipadlinux.keyboard")] +if len(kept) != len(right): + right[:] = kept + changed = True +begin = layout.get("centerBegin") +if isinstance(begin, list): + for widget in list(begin): + if isinstance(widget, dict) and widget.get("id") == "omarchy.indicators" and widget.get("items") == ["StayAwake"]: + begin.remove(widget) + if not any(isinstance(w, dict) and w.get("id") == "omarchy.indicators" for w in right): + right.insert(0, dict(widget, narrow="left")) + changed = True +if changed: + with open(path + ".new", "w") as f: + json.dump(config, f, indent=2) + f.write("\n") + os.replace(path + ".new", path) +PY diff --git a/desktop/shell/migrations/1795116913.sh b/desktop/shell/migrations/1795116913.sh new file mode 100644 index 00000000..d82f8f57 --- /dev/null +++ b/desktop/shell/migrations/1795116913.sh @@ -0,0 +1,46 @@ +echo "A phone's bar: logo and time on the left, status icons on the right" + +# On a phone (a narrow bar) the clock joins the logo and every icon stays on +# the bar, with no overflow pages. A user's own layout +# (~/.config/omarchy-ipad/shell.json) changes only where an entry still has +# the setting the package gave it. +config="$HOME/.config/omarchy-ipad/shell.json" +[[ -f $config ]] || exit 0 +python3 - "$config" <<'PY' +import json, os, sys +path = sys.argv[1] +with open(path) as f: + config = json.load(f) +layout = config.get("bar", {}).get("layout", {}) +missing = object() +# id: (the package's old setting, the new one); missing = no setting. +changes = { + "omarchy.clock": (missing, "left"), + "omarchy.indicators": ("left", missing), + "omarchy.audio": (False, missing), + "omarchy.bluetooth": (False, missing), + "omarchy.network": ("left", missing), + "omarchy.monitor": (False, missing), + "ipadlinux.controlcenter": (False, missing), +} +changed = False +for section in layout.values(): + if not isinstance(section, list): + continue + for entry in section: + if not isinstance(entry, dict) or entry.get("id") not in changes: + continue + old, new = changes[entry["id"]] + if entry.get("narrow", missing) is not old and entry.get("narrow", missing) != old: + continue + if new is missing: + entry.pop("narrow", None) + else: + entry["narrow"] = new + changed = True +if changed: + with open(path + ".new", "w") as f: + json.dump(config, f, indent=2) + f.write("\n") + os.replace(path + ".new", path) +PY diff --git a/desktop/shell/shell/Commons/Style.qml b/desktop/shell/shell/Commons/Style.qml index 3afb2d47..6016cce4 100644 --- a/desktop/shell/shell/Commons/Style.qml +++ b/desktop/shell/shell/Commons/Style.qml @@ -341,8 +341,7 @@ QtObject { } readonly property QtObject bar: QtObject { - // Tablet port: a larger top-bar target without scaling menus or theme text. - readonly property int sizeHorizontal: Math.max(38, root.barToken("size-horizontal", 26)) + readonly property int sizeHorizontal: root.barToken("size-horizontal", 26) readonly property int sizeVertical: root.barToken("size-vertical", 28) // Calibrated notch cutout height in logical px, for panels whose real // cutout differs from the derived default (see BarModel.notchHeight). @@ -351,11 +350,11 @@ QtObject { var v = Number(root.barOverrides["notch-height"]) return (isFinite(v) && v > 0) ? Math.round(v) : 0 } - readonly property int iconSlot: Math.max(40, root.barToken("icon-slot", 27)) - readonly property int iconCanvas: Math.max(22, root.barToken("icon-canvas", 16)) - readonly property int iconFont: Math.max(19, root.barToken("icon-font", 13)) - readonly property int iconSize: Math.min(iconCanvas, Math.max(18, root.barToken("icon-size", 12))) - readonly property int statusSlot: Math.max(28, root.barToken("status-slot", 21)) + readonly property int iconSlot: root.barToken("icon-slot", 27) + readonly property int iconCanvas: root.barToken("icon-canvas", 16) + readonly property int iconFont: root.barToken("icon-font", 13) + readonly property int iconSize: Math.min(iconCanvas, root.barToken("icon-size", 12)) + readonly property int statusSlot: root.barToken("status-slot", 21) } // Off with Hyprland's own animations, as `omarchy toggle animations` turns diff --git a/desktop/shell/shell/Ui/Panel.qml b/desktop/shell/shell/Ui/Panel.qml index c630ac56..9092987a 100644 --- a/desktop/shell/shell/Ui/Panel.qml +++ b/desktop/shell/shell/Ui/Panel.qml @@ -19,11 +19,19 @@ Item { property bool popoutSwitching: false property bool popoutSwitchClosing: false - readonly property bool opened: panelController.open + // Orchard: a host (the control center) can show this panel's content as + // one of its pages instead of the popup. Hosted, opening shows the page, + // closing (Esc in the content) goes back, the popup stays closed and the + // IPC target is the bar's panel's alone. + property var host: null + property bool hostShown: false + readonly property bool hosted: host !== null + readonly property bool opened: hosted ? hostShown : panelController.open + readonly property bool popupOpen: !hosted && panelController.open readonly property color barForeground: bar ? bar.barForeground : Commons.Color.foreground - function open() { panelController.show() } - function close() { panelController.hide() } + function open() { if (hosted) host.showPage(root); else panelController.show() } + function close() { if (hosted) host.leavePage(root); else panelController.hide() } function closeForPopoutSwitch() { popoutSwitchClosing = true close() @@ -48,7 +56,7 @@ Item { ShellIpc { // A panel that answers its target itself leaves this one without one. - target: root.manageIpc ? root.ipcTarget : "" + target: root.manageIpc && !root.hosted ? root.ipcTarget : "" function open(): void { root.open() } function close(): void { root.close() } diff --git a/desktop/shell/shell/Ui/WidgetButton.qml b/desktop/shell/shell/Ui/WidgetButton.qml index e5c08000..0e884eb8 100644 --- a/desktop/shell/shell/Ui/WidgetButton.qml +++ b/desktop/shell/shell/Ui/WidgetButton.qml @@ -70,7 +70,7 @@ Item { readonly property int barSize: bar ? bar.barSize : Style.bar.sizeHorizontal readonly property real scaledHorizontalMargin: Style.spaceReal(horizontalMargin) readonly property real scaledVerticalPadding: Style.spaceReal(verticalPadding) - readonly property bool tooltipHovered: visible && interactive && !concealed && mouseArea.containsMouse + readonly property bool tooltipHovered: visible && interactive && !concealed && pointerHover.hovered // Width of the painted label, for bar chrome that wants to line up with the // text rather than with the slot it sits in. Zero on icon-only buttons. readonly property real labelWidth: label.visible ? label.implicitWidth : 0 @@ -169,6 +169,23 @@ Item { } } + // Orchard: tooltips and hover reveal follow a pointer only. Qt makes mouse + // events of a touch, and the MouseArea's own hover then stayed on after the + // finger had gone, with a tooltip to match. + HoverHandler { + id: pointerHover + enabled: root.interactive + acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad + onHoveredChanged: { + if (root.bar) { + if (hovered) root.bar.showTooltip(root, root.tooltipText) + else root.bar.hideTooltip(root) + } + if (root.maintainIndicatorReveal && root.revealHost && root.revealHost.setIndicatorItemHovered) + root.revealHost.setIndicatorItemHovered(hovered) + } + } + MouseArea { id: mouseArea anchors.fill: parent @@ -177,20 +194,6 @@ Item { enabled: root.interactive hoverEnabled: true cursorShape: root.pressable ? Qt.PointingHandCursor : Qt.ArrowCursor - onEntered: { - if (root.bar) { - root.bar.showTooltip(root, root.tooltipText) - } - if (root.maintainIndicatorReveal && root.revealHost && root.revealHost.setIndicatorItemHovered) - root.revealHost.setIndicatorItemHovered(true) - } - onExited: { - if (root.bar) { - root.bar.hideTooltip(root) - } - if (root.maintainIndicatorReveal && root.revealHost && root.revealHost.setIndicatorItemHovered) - root.revealHost.setIndicatorItemHovered(false) - } onPressed: root.touchLongPressTriggered = false onPressAndHold: function(mouse) { if (root.pressable && mouse.button === Qt.LeftButton diff --git a/desktop/shell/shell/controlcenter/ControlCenter.qml b/desktop/shell/shell/controlcenter/ControlCenter.qml index bc8e7f28..9a536676 100644 --- a/desktop/shell/shell/controlcenter/ControlCenter.qml +++ b/desktop/shell/shell/controlcenter/ControlCenter.qml @@ -12,6 +12,9 @@ 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 +import "../plugins/panels/network" as NetworkPanel +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 @@ -58,6 +61,16 @@ Item { : !(source && source.audio) || source.audio.muted readonly property bool micKnown: UntypedInput.active ? UntypedInput.known : !!(source && source.audio) + // The on-screen keyboard's visibility, as omarchy-keyboard records it. + FileView { + id: keyboardState + path: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/omarchy-keyboard-visible" + watchChanges: true + printErrors: false + onFileChanged: reload() + } + readonly property bool keyboardShown: keyboardState.loaded && keyboardState.text().trim() === "1" + property int brightness: -1 property bool autoBrightness: false @@ -88,12 +101,103 @@ Item { function run(argv) { Quickshell.execDetached(argv) } function omarchy(name) { return (Quickshell.env("OMARCHY_PATH") || "/usr/share/omarchy") + "/bin/" + name } - // Until the pages exist: the bar's panel for that module. + // A module's page: its panel's content, pushed in from the right. A + // module without a page yet opens the bar's panel for it. function openPage(module) { + var panelForPage = root.modules[module] + if (panelForPage) { panelForPage.open(); return } root.close() run(["omarchy-shell", "shell", "toggle", module]) } + // ------------------------------------------------------------ pages + // Each page is a panel of its own (not the bar's), hosted: pageHost stands + // in for the bar it would read its colours and font from, and opening or + // closing it shows or leaves the page. + + QtObject { + id: pageHost + readonly property color foreground: root.text + readonly property color barForeground: root.text + readonly property color urgent: Commons.Color.urgent + readonly property string fontFamily: Style.font.family + readonly property var shell: root.shell + readonly property string position: "top" + readonly property bool vertical: false + readonly property int barSize: Style.bar.sizeHorizontal + // The rest of what a panel's own bar button and popup ask of a bar, + // inert here: hosted, neither is ever shown. + readonly property var activePopout: null + readonly property bool foregroundAnimationEnabled: false + readonly property int sizeHorizontal: Style.bar.sizeHorizontal + readonly property int iconFont: Style.font.icon + readonly property int iconSize: Style.font.icon + readonly property int iconSlot: Style.space(28) + readonly property bool iconCanvas: false + readonly property var clickTargets: [] + function barSizeFor() { return Style.bar.sizeHorizontal } + function showTooltip() {} + function hideTooltip() {} + function requestPopout() { return false } + function releasePopout() {} + function notePopoutCard() {} + function popoutCardFor() { return null } + function targetBelongsToWindow() { return false } + function run(command) { Quickshell.execDetached(["sh", "-c", command]) } + function switchPanelFrom(panel, direction) { return false } + function showPage(panel) { root.showPage(panel) } + function leavePage(panel) { root.leavePage(panel) } + } + + Item { + visible: false + Monitor.Panel { id: displayModule; host: pageHost; bar: pageHost; moduleName: "omarchy.monitor" } + 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 + }) + + property var page: null + // 0 on the main view, 1 on the page; the push in between. + property real pageShift: 0 + NumberAnimation { + id: pageSlide + target: root + property: "pageShift" + duration: Style.duration(300) + easing.type: Easing.OutCubic + onFinished: if (root.pageShift === 0) root.dropPage() + } + + function showPage(panelForPage) { + if (!root.opened) root.open() + if (root.page && root.page !== panelForPage) root.page.hostShown = false + root.page = panelForPage + panelForPage.hostShown = true + pageSlide.to = 1 + pageSlide.restart() + Qt.callLater(function() { if (pageLoader.item) pageLoader.item.forceActiveFocus() }) + } + function leavePage(panelForPage) { + if (root.page !== panelForPage) return + pageSlide.to = 0 + pageSlide.restart() + keyCatcher.forceActiveFocus() + } + function dropPage() { + if (root.page) root.page.hostShown = false + root.page = null + root.pageShift = 0 + } + function toggleWifi() { Networking.wifiEnabled = !Networking.wifiEnabled } function toggleBluetooth() { if (bluetooth.adapter) bluetooth.adapter.enabled = !bluetooth.adapter.enabled } function toggleMic() { @@ -103,10 +207,6 @@ Item { function toggleRotation() { run([omarchy("omarchy-rotation-lock"), rotation.locked ? "off" : "on"]); rotation.locked = !rotation.locked } function toggleAwake() { if (idleService) idleService.setIdleEnabled(root.stayAwake) } function showKeyboard() { root.close(); run([omarchy("omarchy-keyboard"), "toggle"]) } - function sessionActions() { - root.close() - if (root.shell) root.shell.summon("omarchy.menu", JSON.stringify({ menu: "system" })) - } function setVolume(value) { if (sink && sink.audio) sink.audio.volume = Math.max(0, Math.min(1, value)) } @@ -152,7 +252,7 @@ Item { { key: "awake", glyph: "", label: Commons.I18n.t("controlCenter.awake"), on: root.stayAwake, enabled: !!root.idleService, act: root.toggleAwake }, { key: "keyboard", glyph: "󰌌", label: Commons.I18n.t("controlCenter.keyboard"), - on: false, enabled: true, act: root.showKeyboard } + on: root.keyboardShown, enabled: true, act: root.showKeyboard } ] // Live once their backend exists (power profiles, Focus, Night Light, media). readonly property var later: [ @@ -207,11 +307,34 @@ Item { root.focusIndex = -1 } + // A bar panel's popup goes first: the control center is never over one. + function closePopout() { + var bar = root.shell ? root.shell.bar : null + var popout = bar ? bar.activePopout : null + if (popout && typeof popout.close === "function") popout.close() + } + function open() { + root.popupStyle = false + root.show() + } + // A bar item's popup opening puts the control center away (its own + // button's registration aside). + Connections { + target: root.shell ? root.shell.bar : null + function onActivePopoutChanged() { + var popout = root.shell.bar.activePopout + if (root.opened && popout && popout.moduleName !== "ipadlinux.controlcenter") root.close() + } + } + + function show() { + root.closePopout() + if (root.shell && root.shell.launcher && root.shell.launcher.opened) root.shell.launcher.close() root.prepare() root.opened = true root.mapped = true - if (panel.contentRevealed) root.settle(1, 0) + if (panel.contentRevealed) root.animateIn() Qt.callLater(function() { keyCatcher.forceActiveFocus() }) } function close() { @@ -219,10 +342,42 @@ Item { if (!root.opened) return root.closingFromOpen = true root.opened = false - root.settle(0, 0) + if (root.popupStyle) { spring.running = false; popupOut.restart() } + else root.settle(0, 0) } function toggle() { root.opened ? root.close() : root.open() } + // Clicked open from its bar button, it is a popup like the bar's others + // (upstream's KeyboardPanel): it fades in growing from just under full + // size toward the button, goes in two thirds of the time, and the screen + // does not dim. A phone keeps the whole screen. + property bool popupStyle: false + function togglePopup() { + if (root.opened) { root.close(); return } + root.popupStyle = !root.phone + root.show() + } + function animateIn() { + if (root.popupStyle) { spring.running = false; popupOut.stop(); popupIn.restart() } + else root.settle(1, 0) + } + NumberAnimation { + id: popupIn + target: root; property: "reveal"; to: 1 + // Software rendering: at once, as the launcher does there. + duration: root.gpu ? Style.duration(180) : 0 + easing.type: Easing.Bezier + easing.bezierCurve: Style.easeOut + } + NumberAnimation { + id: popupOut + target: root; property: "reveal"; to: 0 + duration: root.gpu ? Style.duration(120) : 0 + easing.type: Easing.Bezier + easing.bezierCurve: Style.easeOut + onFinished: if (!root.opened) { root.mapped = false; root.dropPage() } + } + // A finger pulls it down from the top edge (the bar), or up to put it // away: it follows the finger, past its place only against resistance. // Let go, it keeps the finger's speed and a spring carries it to open or @@ -230,12 +385,16 @@ Item { property bool pulling: false // A long press opened a page while the finger is still down (see above). property bool touchSpent: false - readonly property real pullSpan: Math.max(1, card.y + card.height) + readonly property real pullSpan: Math.max(1, card.y + card.follow) property real pullFrom: 0 function beginPull() { spring.running = false + popupIn.stop() + popupOut.stop() + root.popupStyle = false if (!root.opened) { + root.closePopout() root.prepare() root.reveal = 0 root.mapped = true @@ -299,23 +458,63 @@ Item { root.reveal = root.springTarget root.springVelocity = 0 running = false - if (!root.opened) root.mapped = false + if (!root.opened) { root.mapped = false; root.dropPage() } } } } - // Moving: the spring or a finger. - readonly property bool moving: spring.running || root.pulling + // Open as a popup, the bar knows its card as it knows its other popups' + // (KeyboardPanel notes them): a popup taking over in the same section + // morphs from this card, not from an older one. + function notePopupCard() { + var bar = root.shell ? root.shell.bar : null + if (!root.popupStyle || !root.opened || !bar || typeof bar.notePopoutCard !== "function") return + bar.notePopoutCard({ screen: panel.screen ? panel.screen.name : "", x: card.x, y: card.y, + width: card.width, height: card.height }) + } + onPopupStyleChanged: Qt.callLater(notePopupCard) + Connections { + target: card + function onHeightChanged() { root.notePopupCard() } + } + + // Moving: the spring, a finger, or a popup's fade. + readonly property bool moving: spring.running || root.pulling || popupIn.running || popupOut.running // While open, a note for the Home button (omarchy-home-button closes it). readonly property string openNote: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/omarchy-control-center-open" - onOpenedChanged: Quickshell.execDetached(opened ? ["touch", openNote] : ["rm", "-f", openNote]) + // One writer, run again until the note matches: two detached commands could + // finish out of order and leave the note behind a closed control center, + // and Home would then only ever "close" it. A note left from an earlier + // shell goes at start. + property bool noteWritten: true + function writeOpenNote() { + if (noteWriter.running || root.noteWritten === root.opened) return + noteWriter.writing = root.opened + noteWriter.command = root.opened ? ["touch", root.openNote] : ["rm", "-f", root.openNote] + noteWriter.running = true + } + Process { + id: noteWriter + property bool writing: false + onExited: { + root.noteWritten = writing + root.writeOpenNote() + } + } + Component.onCompleted: writeOpenNote() + onOpenedChanged: { + writeOpenNote() + Qt.callLater(notePopupCard) + } ShellIpc { target: "omarchy.controlcenter" function toggle(): void { root.toggle() } function open(): void { if (!root.opened) root.open() } function close(): void { root.close() } + // Open at a module's page: omarchy.monitor, … + function page(module: string): void { root.openPage(module) } } // ------------------------------------------------------------- window @@ -324,10 +523,21 @@ Item { id: panel shown: root.mapped WlrLayershell.namespace: "omarchy-control-center" + // Where the bar shows above it (as a popup, and always on a phone) the + // bar stays the bar: a click on an item there reaches it, and its popup + // closes this one. Pulled down on an iPad, it dims and takes the screen. + mask: root.popupStyle || root.phone ? popupInput : null + Region { id: popupInput; item: popupInputArea } + Item { + id: popupInputArea + y: root.barInset + width: parent.width + height: Math.max(0, parent.height - root.barInset) + } onContentRevealedChanged: if (contentRevealed && root.opened && !root.pulling) { root.reveal = 0 - root.settle(1, 0) + root.animateIn() keyCatcher.forceActiveFocus() } @@ -339,7 +549,13 @@ Item { width: parent.width height: parent.height - y color: root.phone ? Commons.Color.menu.background : Commons.Color.menu.scrim - opacity: Math.max(0, Math.min(1, root.reveal)) + // Software rendering dims in one step rather than blending the whole + // screen again on every frame of a pull. + // A phone's sheet comes in quickly at first, easing out, and is opaque + // only as the pull arrives; it goes with its content. + opacity: root.popupStyle ? 0 : root.phone + ? (!root.gpu || root.leaving ? card.opacity : 1 - Math.pow(1 - Math.max(0, Math.min(1, root.reveal)), 2.5)) + : (root.gpu ? Math.max(0, Math.min(1, root.reveal)) : (root.reveal > 0 ? 1 : 0)) MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton @@ -354,7 +570,7 @@ Item { Keys.onPressed: function(event) { var cell = root.focusedCell() switch (event.key) { - case Qt.Key_Escape: root.close(); break + case Qt.Key_Escape: if (root.page) root.leavePage(root.page); else root.close(); break case Qt.Key_Tab: root.stepFocus(1); break case Qt.Key_Backtab: root.stepFocus(-1); break case Qt.Key_Up: root.moveFocus(0, -1); break @@ -425,12 +641,21 @@ Item { id: card // While it moves, drawn once into a texture that is only scaled, moved // and faded (cheap on any GPU); at rest drawn directly, sharp. - layer.enabled: root.moving + layer.enabled: root.moving && root.gpu layer.smooth: true x: root.phone ? 0 : parent.width - width - Style.gapsOut y: root.phone ? root.barInset : root.barInset + Style.gapsOut width: root.phone ? parent.width : root.cardWidth - height: root.phone ? parent.height - root.barInset : content.implicitHeight + root.pad * 2 + // The main view's height, the page's, and the push between them. + readonly property real mainHeight: content.implicitHeight + root.pad * 2 + readonly property real pageHeight: pageView.implicitHeight + root.pad * 2 + readonly property real contentHeight: mainHeight + (pageHeight - mainHeight) * root.pageShift + height: root.phone ? parent.height - root.barInset : contentHeight + // What the finger holds: the card's bottom, or on a phone (where the + // card is the screen) the bottom of its content; the empty sheet below + // comes in under the thumb. + readonly property real follow: root.phone ? Style.space(12) + contentHeight : height + clip: true color: root.phone ? "transparent" : Commons.Color.popups.background // The bar's popups' own border (KeyboardPanel): the theme's spec. borderSpec: root.phone ? Border.none() @@ -439,21 +664,24 @@ Item { // Its bottom edge is where the finger is: reveal is the finger's way // down as a share of the card's bottom. On the way it grows out of its // own top centre and fades in; the slide is what keeps the scaled bottom under the finger. - readonly property real grow: 0.86 + 0.14 * root.reveal + // As a popup: it grows from 97 % toward its button and fades. + // Software rendering only moves it (its bottom still under the finger): + // no scaling or fading for the CPU to redraw each frame. + readonly property real grow: !root.gpu ? 1 : (root.popupStyle ? 0.97 + 0.03 * root.reveal : 0.86 + 0.14 * root.reveal) transform: [ Scale { - origin.x: card.width / 2 + origin.x: root.popupStyle ? card.width : card.width / 2 origin.y: 0 xScale: card.grow yScale: card.grow }, - Translate { y: root.reveal * root.pullSpan - card.y - card.height * card.grow } + Translate { y: root.popupStyle ? 0 : root.reveal * root.pullSpan - card.y - card.follow * card.grow } ] // Coming in: solid within the first quarter of the way, most of it at // once. Going out (let go to close, or pushed up from open): it fades // with its way up, gone as its bottom edge reaches the status bar. readonly property real barShare: Math.min(0.9, root.barInset / root.pullSpan) - opacity: root.leaving + opacity: !root.gpu ? (root.reveal > 0 ? 1 : 0) : root.popupStyle ? root.reveal : root.leaving ? Math.max(0, Math.min(1, (root.reveal - barShare) / (1 - barShare))) : 1 - Math.pow(1 - Math.max(0, Math.min(1, root.reveal / 0.25)), 2) @@ -461,7 +689,8 @@ Item { Column { id: content - x: root.pad + x: root.pad - root.pageShift * card.width + visible: root.pageShift < 1 y: root.pad + (root.phone ? Style.space(12) : 0) width: parent.width - root.pad * 2 spacing: root.gap @@ -549,25 +778,49 @@ Item { } } - // Battery line and the session actions (iPad: here; phone: at the foot). + // The battery line (iPad: here; phone: at the foot). Item { id: footer width: content.width height: root.touchMin - visible: !root.phone + // Only with a battery to show: nothing else lives here. + visible: !root.phone && root.batteryLine !== "" FooterParts { anchors.fill: parent } } } Item { - visible: root.phone - x: root.pad + 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 + // icon turns into the way back when hosted). + Column { + id: pageView + visible: root.page !== null + x: root.pad + (1 - root.pageShift) * card.width + y: root.pad + (root.phone ? Style.space(12) : 0) + width: parent.width - root.pad * 2 + spacing: root.gap + + Loader { + id: pageLoader + width: parent.width + active: root.page !== null + sourceComponent: root.page ? root.page.pageContent : null + // As tall as its content, within the screen; the content scrolls + // beyond that. + readonly property real header: 0 + readonly property real room: root.screenHeight - card.y - root.pad * 2 - header - Style.gapsOut + height: item ? Math.min(item.implicitHeight, root.phone ? card.height - root.pad * 2 - header - Style.space(12) : room) : 0 + } + } } } @@ -639,7 +892,7 @@ Item { } } } - // Tap toggles; a right click opens the page. Held still (0.2 s), the + // Tap toggles; a right click opens the page. Held still (0.4 s), the // touch arms the page as on a slider: the tile shows it is held, lifting // opens the page, sliding off cancels. One rule for every control: a tap // never opens another level. @@ -647,7 +900,7 @@ Item { id: tileMouse anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton - pressAndHoldInterval: 200 + pressAndHoldInterval: 400 // A button keeps its touch: sliding off cancels, and the control center // is not dragged away. preventStealing: true @@ -745,6 +998,8 @@ Item { property bool pageArrow: false signal moved(real value) signal longPressed() + // Left and right move it; Enter opens its page. + onActivated: slider.longPressed() function adjust(delta) { if (slider.available) slider.moved(Math.max(0, Math.min(1, slider.value + delta))) } color: Style.controlFill(false, false, root.text, Commons.Color.accent) clip: true @@ -787,12 +1042,12 @@ Item { enabled: slider.available preventStealing: true // The level goes where the finger is: on a tap when it lifts, on a - // drag as soon as it moves and from then on. Held still (0.2 s), the + // drag as soon as it moves and from then on. Held still (0.4 s), the // touch arms the page instead and changes nothing: the slider shows it // is held, lifting opens the page, sliding off cancels (and back on // arms it again). Nothing happens on the touch itself before it is // known which it is. - pressAndHoldInterval: 200 + pressAndHoldInterval: 400 property point pressedAt property bool moving: false property bool held: false @@ -890,7 +1145,8 @@ Item { } component FooterParts: Item { - // Battery line: opens the battery page; the power button the session. + // 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 !== "" @@ -911,22 +1167,5 @@ Item { } MouseArea { anchors.fill: parent; onClicked: batteryCell.activate() } } - Cell { - id: powerCell - anchors.right: parent.right - width: root.touchMin - height: parent.height - color: "transparent" - border.width: focused ? Math.max(1, Style.space(1)) : 0 - onActivated: root.sessionActions() - Text { - anchors.centerIn: parent - text: "󰐥" - color: Commons.Color.urgent - font.family: Style.font.family - font.pixelSize: Style.font.title - } - MouseArea { anchors.fill: parent; onClicked: powerCell.activate() } - } } } diff --git a/desktop/shell/shell/launcher/Launcher.qml b/desktop/shell/shell/launcher/Launcher.qml index 044cc53a..dc38be2f 100644 --- a/desktop/shell/shell/launcher/Launcher.qml +++ b/desktop/shell/shell/launcher/Launcher.qml @@ -552,7 +552,17 @@ Item { } } - Component.onCompleted: wallpaperProc.running = true + Component.onCompleted: { wallpaperProc.running = true; opaqueProc.running = true } + + // Orchard: Trigger > Toggle > Opaque Launcher shows it on the theme's + // plain background instead of the frosted wallpaper (no blurred copy is + // made then). Read as it opens. + property bool opaque: false + Process { + id: opaqueProc + command: ["omarchy-toggle-enabled", "launcher-opaque"] + onExited: function(code) { root.opaque = code === 0 } + } // The background plugin names the new wallpaper the moment a theme or // background switch sets it, before its own fade: the blurred copy is made @@ -572,7 +582,7 @@ Item { readonly property real backdropTint: 0.8 readonly property color backdropColor: Commons.Color.menu.background // Everything but the size: what makes a background outdated. - readonly property string backdropLook: wallpaper + readonly property string backdropLook: wallpaper && !opaque ? ["frosted4", wallpaper, Math.round(backdropColor.r * 255), Math.round(backdropColor.g * 255), Math.round(backdropColor.b * 255), backdropTint].join("|") : "" readonly property string backdropKey: backdropKeyFor(backdropWidth, backdropHeight) readonly property string backdropPath: backdropPathFor(backdropKey) @@ -650,12 +660,18 @@ Item { } function open() { + // A bar popup, or the control center, goes first: the launcher is never + // shown over one. + var bar = root.shell ? root.shell.bar : null + if (bar && bar.activePopout && typeof bar.activePopout.close === "function") bar.activePopout.close() + if (root.shell && root.shell.controlCenter && root.shell.controlCenter.opened) root.shell.controlCenter.close() if (root.appLibrary) root.appLibrary.refreshIcons() if (root.appsStale || root.apps.length === 0) root.rebuild() // Stop Screenrecording and the session list follow what is true now. if (root.menu) root.menu.evaluateGuards() // A wallpaper changed since: the next open shows it. wallpaperProc.running = true + opaqueProc.running = true root.endSearch() root.pageIndex = 0 root.zone = "" @@ -687,6 +703,14 @@ Item { else root.open() } + // A bar item's popup opening puts the launcher away. + Connections { + target: root.shell ? root.shell.bar : null + function onActivePopoutChanged() { + if (root.opened && root.shell.bar.activePopout) root.close() + } + } + function rebuild() { root.appsStale = false var rows = root.appLibrary ? root.appLibrary.sortedEntries("") : [] @@ -986,12 +1010,15 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt } } - // The bar's strip closes the launcher, as the bar's logo would. - MouseArea { + // The bar is not dimmed, so it stays the bar: its strip is outside + // the launcher's input, and a click there reaches the bar's own item (a + // popup it opens puts the launcher away, see below). + mask: Region { item: launcherInput } + Item { + id: launcherInput + y: root.barInset width: parent.width - height: root.barInset - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: root.close() + height: Math.max(0, parent.height - root.barInset) } // Anywhere else that nothing takes: put search away, never close. @@ -1081,8 +1108,9 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt Scale { origin.x: content.width / 2 origin.y: 0 - xScale: 0.98 + 0.02 * root.reveal - yScale: 0.98 + 0.02 * root.reveal + // Comes in settling from just over its size (and goes the same way). + xScale: 1.03 - 0.03 * root.reveal + yScale: 1.03 - 0.03 * root.reveal }, Translate { y: Style.space(10) * (1 - root.reveal) } ] @@ -1096,12 +1124,15 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt BorderSurface { id: searchBox readonly property bool hot: searchHover.hovered - width: parent.width - (content.trailing > 0 ? content.trailing + Style.spacing.lg : 0) - height: root.searchHeight - Behavior on width { + // Only Cancel coming and going animates the field; the launcher's + // own size (set as its window maps on open) takes effect at once. + property real cancelShare: root.searching ? 1 : 0 + Behavior on cancelShare { enabled: root.gpu && root.opened NumberAnimation { duration: Style.duration(180); easing.type: Easing.OutCubic } } + width: parent.width - searchBox.cancelShare * (cancelButton.width + Style.spacing.lg) + height: root.searchHeight radius: Style.cornerRadius // Focus in the shipped [controls] mirrors hover, whose border is // fainter than idle's, so a focused field would read as less active @@ -1313,6 +1344,9 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt // finger gets 44 points, more than the highlight shows. Item { id: settingsButton + // In the inactive tabs' colour, brighter only while focused, as a + // tab is. + readonly property bool lit: root.keyFocus("tabs", root.settingsStop) anchors.right: parent.right height: parent.height width: settingsRow.implicitWidth + Style.space(16) @@ -1332,7 +1366,7 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt Text { anchors.verticalCenter: parent.verticalCenter text: "\uf013" - color: root.text + color: settingsButton.lit ? root.text : root.faint font.family: Style.font.menuFamily font.pixelSize: Style.font.body } @@ -1340,7 +1374,7 @@ LC_ALL=C pacman -Qi omarchy-a 2>/dev/null | awk \'/^Depends On/ { on = 1 } /^Opt anchors.verticalCenter: parent.verticalCenter textFormat: Text.PlainText text: Commons.I18n.t("launcher.settings") - color: root.text + color: settingsButton.lit ? root.text : root.faint font.family: Style.font.menuFamily font.pixelSize: Style.font.subtitle } diff --git a/desktop/shell/shell/plugins/bar/Bar.qml b/desktop/shell/shell/plugins/bar/Bar.qml index ab1470e9..4ce54d96 100644 --- a/desktop/shell/shell/plugins/bar/Bar.qml +++ b/desktop/shell/shell/plugins/bar/Bar.qml @@ -2980,7 +2980,9 @@ Item { root.unregisterModuleSlot(slot) } - HoverHandler { id: moduleHover } + // Orchard: hover is a pointer's. A finger leaves no hover behind (Qt + // makes mouse events of a touch, which kept a slot hovered after it). + HoverHandler { id: moduleHover; acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad } // The widget at its own size. Lifted out by a drag, it folds away with // its room. diff --git a/desktop/shell/shell/plugins/bar/BarModel.js b/desktop/shell/shell/plugins/bar/BarModel.js index cdc1493c..a36410c8 100644 --- a/desktop/shell/shell/plugins/bar/BarModel.js +++ b/desktop/shell/shell/plugins/bar/BarModel.js @@ -396,7 +396,9 @@ function layoutWidgets(layout, memo) { // widgets of a tablet's bar run into the clock. It is made from the one layout // in shell.json by each entry's `narrow` setting: false takes the widget // off the first page, a section's name moves it to the end of that section, -// and an entry without the setting stays where it is. The entries themselves +// "hidden" leaves it out of a narrow bar altogether (Orchard: a phone reaches +// it through the control center instead), and an entry without the setting +// stays where it is. The entries themselves // are passed on untouched, so a widget keeps its settings in either layout. // // No widget is dropped for good: when some are off the first page, the right @@ -417,6 +419,7 @@ function narrowOverflow(layout) { var list = Array.isArray(source[sections[r]]) ? source[sections[r]] : [] for (var i = 0; i < list.length; i++) { var hint = isPlainObject(list[i]) ? list[i].narrow : undefined + if (hint === "hidden") continue if (hint === false) held.push(list[i]) else if (sections[r] === "left" && (hint === undefined || hint === "left")) ownLeft++ } @@ -454,7 +457,7 @@ function narrowLayout(layout, page) { var list = Array.isArray(source[sections[r]]) ? source[sections[r]] : [] for (var i = 0; i < list.length; i++) { var hint = isPlainObject(list[i]) ? list[i].narrow : undefined - if (hint === false) continue + if (hint === false || hint === "hidden") continue var target = sections.indexOf(hint) !== -1 ? hint : sections[r] if (shown > 0 && (target === "right" || (target === "left" && target !== sections[r]))) continue out[target].push(list[i]) diff --git a/desktop/shell/shell/plugins/control-center/BarWidget.qml b/desktop/shell/shell/plugins/control-center/BarWidget.qml new file mode 100644 index 00000000..dd704ad4 --- /dev/null +++ b/desktop/shell/shell/plugins/control-center/BarWidget.qml @@ -0,0 +1,40 @@ +import QtQuick +import Quickshell +import qs.Ui +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. +BarWidget { + id: root + moduleName: "ipadlinux.controlcenter" + implicitWidth: button.implicitWidth + implicitHeight: button.implicitHeight + + readonly property var center: root.bar && root.bar.shell ? root.bar.shell.controlCenter : null + + // Open as a popup, it is the bar's open popup like any other: the bar + // draws its mark under this button, and another item's popup opening (or + // the bar's switching between them) closes it through close(). + readonly property bool popupShown: !!root.center && root.center.opened && root.center.popupStyle + onPopupShownChanged: { + if (!root.bar) return + if (root.popupShown) root.bar.requestPopout(root) + else root.bar.releasePopout(root) + } + function open() { if (root.center && !root.center.opened) root.center.togglePopup() } + function close() { if (root.center && root.center.opened) root.center.close() } + function closeForPopoutSwitch() { root.close() } + + BarIconButton { + id: button + anchors.fill: parent + bar: root.bar + text: "󰘮" + tooltipText: I18n.t("controlCenter.title") + onPressed: function(mouseButton) { + if (mouseButton === Qt.LeftButton && root.center) root.center.togglePopup() + } + } +} diff --git a/desktop/shell/shell/plugins/control-center/manifest.json b/desktop/shell/shell/plugins/control-center/manifest.json new file mode 100644 index 00000000..a7f7c0fe --- /dev/null +++ b/desktop/shell/shell/plugins/control-center/manifest.json @@ -0,0 +1,17 @@ +{ + "schemaVersion": 1, + "id": "ipadlinux.controlcenter", + "name": "Control center", + "version": "1.0.0", + "author": "iPad Linux", + "description": "Open the control center", + "kinds": ["bar-widget"], + "entryPoints": { "barWidget": "BarWidget.qml" }, + "barWidget": { + "displayName": "Control center", + "description": "Open the control center", + "category": "System", + "defaultSection": "right", + "allowMultiple": false + } +} diff --git a/desktop/shell/shell/plugins/keyboard/BarWidget.qml b/desktop/shell/shell/plugins/keyboard/BarWidget.qml index 02d285c2..8bcf292e 100644 --- a/desktop/shell/shell/plugins/keyboard/BarWidget.qml +++ b/desktop/shell/shell/plugins/keyboard/BarWidget.qml @@ -1,5 +1,6 @@ import QtQuick import Quickshell +import Quickshell.Io import qs.Ui BarWidget { @@ -8,11 +9,21 @@ BarWidget { implicitWidth: button.implicitWidth implicitHeight: button.implicitHeight + // Lit while the keyboard is up, as omarchy-keyboard records it. + FileView { + id: keyboardState + path: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/omarchy-keyboard-visible" + watchChanges: true + printErrors: false + onFileChanged: reload() + } + BarIconButton { id: button anchors.fill: parent bar: root.bar text: "󰌌" + active: keyboardState.loaded && keyboardState.text().trim() === "1" onPressed: function(mouseButton) { if (mouseButton === Qt.LeftButton && root.bar) root.bar.run(Quickshell.env("OMARCHY_PATH") + "/bin/omarchy-keyboard toggle") diff --git a/desktop/shell/shell/plugins/panels/audio/Panel.qml b/desktop/shell/shell/plugins/panels/audio/Panel.qml index 6c6ecaa5..30582cde 100644 --- a/desktop/shell/shell/plugins/panels/audio/Panel.qml +++ b/desktop/shell/shell/plugins/panels/audio/Panel.qml @@ -753,12 +753,15 @@ Panel { } } + // The content, for a host that shows it as a page (the control center). + readonly property Component pageContent: panel.content + KeyboardPanel { id: panel anchorItem: button owner: root bar: root.bar - open: root.opened + open: root.popupOpen focusTarget: panel.loadedContent contentWidth: panel.fittedContentWidth(Style.space(380)) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight, Style.space(560)) @@ -820,13 +823,24 @@ Panel { Text { id: heroIcon textFormat: Text.PlainText - text: root.outputIcon() + // Orchard: as a control center page, the way back. + text: root.hosted ? "󰁍" : root.outputIcon() color: root.bar.foreground font.family: root.bar.fontFamily font.pixelSize: Style.font.display - opacity: root.outputMuted ? 0.5 : 1.0 + opacity: root.hosted ? 1.0 : (root.outputMuted ? 0.5 : 1.0) anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + // Pressed, it shrinks, as the control center's controls do. + scale: backPress.pressed ? 0.85 : 1 + Behavior on scale { NumberAnimation { duration: Style.duration(120); easing.type: Easing.OutCubic } } + MouseArea { + id: backPress + anchors.fill: parent + anchors.margins: -Style.space(10) + enabled: root.hosted + onClicked: root.close() + } } // Compact on/off switch on the trailing edge of the hero, and the diff --git a/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml b/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml index 3d8a6834..0e5b9c06 100644 --- a/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml +++ b/desktop/shell/shell/plugins/panels/bluetooth/Panel.qml @@ -681,7 +681,7 @@ Panel { } ShellIpc { - target: "omarchy.bluetooth" + target: root.hosted ? "" : "omarchy.bluetooth" function open() { root.open() } function close() { root.close() } @@ -702,12 +702,15 @@ Panel { } } + // The content, for a host that shows it as a page (the control center). + readonly property Component pageContent: panel.content + KeyboardPanel { id: panel anchorItem: button owner: root bar: root.bar - open: root.opened + open: root.popupOpen focusTarget: panel.loadedContent contentWidth: panel.fittedContentWidth(Style.space(380)) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight) @@ -746,11 +749,22 @@ Panel { textFormat: Text.PlainText anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - text: root.icon + // Orchard: as a control center page, the way back. + text: root.hosted ? "󰁍" : root.icon color: root.bar.foreground font.family: root.bar.fontFamily font.pixelSize: Style.font.display - opacity: root.adapter && root.adapter.enabled ? 1.0 : 0.5 + opacity: root.hosted ? 1.0 : (root.adapter && root.adapter.enabled ? 1.0 : 0.5) + // Pressed, it shrinks, as the control center's controls do. + scale: backPress.pressed ? 0.85 : 1 + Behavior on scale { NumberAnimation { duration: Style.duration(120); easing.type: Easing.OutCubic } } + MouseArea { + id: backPress + anchors.fill: parent + anchors.margins: -Style.space(10) + enabled: root.hosted + onClicked: root.close() + } } // Compact on/off switch on the trailing edge of the hero, and the diff --git a/desktop/shell/shell/plugins/panels/monitor/Panel.qml b/desktop/shell/shell/plugins/panels/monitor/Panel.qml index c960c910..e8f3ce95 100644 --- a/desktop/shell/shell/plugins/panels/monitor/Panel.qml +++ b/desktop/shell/shell/plugins/panels/monitor/Panel.qml @@ -34,17 +34,11 @@ Panel { property string displaysJson: "" property var displays: [] - // Orchard: the tablet's own rows, which upstream's panel does not have: - // ambient-light auto-brightness (hidden without the tool), rotation lock, - // and Stay Awake (the shell's idle service owns its state and bar icon). + // Orchard: the tablet's own row, which upstream's panel does not have: + // ambient-light auto-brightness (hidden without the tool). Rotation lock and + // Stay Awake are the control center's toggles. property bool autoAvailable: false property bool autoOn: false - readonly property var idleService: bar?.shell?.firstPartyServiceFor("omarchy.idle") - readonly property bool stayAwake: idleService ? idleService.stayAwake === true : false - property bool rotationLocked: false - property bool rotationLoaded: false - readonly property string rotationHelper: (Quickshell.env("OMARCHY_PATH") || - "/usr/share/omarchy") + "/bin/omarchy-rotation-lock" // Orchard: the screen turns with the iPad (arch-ipad-rotate-output, under // the rotation lock); labwc has no command to turn it by hand, so upstream's // rotate menu stays shut. @@ -391,7 +385,7 @@ Panel { } ShellIpc { - target: "omarchy.monitor" + target: root.hosted ? "" : "omarchy.monitor" function brightness(percent: string): string { return root.brightnessIpc(percent) } function state(): string { return root.stateIpc() } @@ -407,7 +401,6 @@ Panel { function refresh() { if (!stateProc.running) stateProc.running = true if (!autoReadProc.running && !autoWriteProc.running) autoReadProc.running = true - if (!rotationRead.running && !rotationWrite.running) rotationRead.running = true } // The focused display's brightness, for the bar icon's wheel and IPC. @@ -854,24 +847,6 @@ Panel { onRunningChanged: if (!running) root.refresh() } - Process { - id: rotationRead - command: [root.rotationHelper, "status"] - stdout: StdioCollector { - onStreamFinished: { - try { - root.rotationLocked = JSON.parse(text).locked === true - root.rotationLoaded = true - } catch (_) { root.rotationLoaded = false } - } - } - } - - Process { - id: rotationWrite - onExited: function(exitCode, exitStatus) { root.refresh() } - } - BarIconButton { id: button anchors.fill: parent @@ -888,12 +863,15 @@ Panel { } } + // The content, for a host that shows it as a page (the control center). + readonly property Component pageContent: panel.content + KeyboardPanel { id: panel anchorItem: button owner: root bar: root.bar - open: root.opened + open: root.popupOpen focusTarget: panel.loadedContent contentWidth: panel.fittedContentWidth(Style.space(380)) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight, Style.space(860)) @@ -963,12 +941,23 @@ Panel { Text { id: heroIcon textFormat: Text.PlainText - text: root.displayGlyph(root.current) + // Orchard: as a control center page, the way back. + text: root.hosted ? "󰁍" : root.displayGlyph(root.current) color: root.bar.foreground font.family: root.bar.fontFamily font.pixelSize: Style.font.display anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + // Pressed, it shrinks, as the control center's controls do. + scale: backPress.pressed ? 0.85 : 1 + Behavior on scale { NumberAnimation { duration: Style.duration(120); easing.type: Easing.OutCubic } } + MouseArea { + id: backPress + anchors.fill: parent + anchors.margins: -Style.space(10) + enabled: root.hosted + onClicked: root.close() + } } Column { @@ -1139,37 +1128,6 @@ Panel { onClicked: root.setAuto(!root.autoOn) } - // ---------- Orchard: rotation lock and Stay Awake ---------- - PanelSeparator { - foreground: root.bar.foreground - } - - Toggle { - width: parent.width - label: "Rotation lock" - description: root.rotationLocked ? "Keep the current orientation" : "Turn the display with the iPad" - checked: root.rotationLocked - enabled: root.rotationLoaded && !rotationWrite.running - foreground: root.bar.foreground - fontFamily: root.bar.fontFamily - onClicked: { - rotationWrite.command = [root.rotationHelper, root.rotationLocked ? "off" : "on"] - rotationWrite.running = true - } - } - - Toggle { - width: parent.width - label: Commons.I18n.t("bar.stayAwake") - description: root.stayAwake ? "The screen stays on; no automatic lock or sleep" - : "Lock and sleep after the idle timeout" - checked: root.stayAwake - enabled: !!root.idleService - foreground: root.bar.foreground - fontFamily: root.bar.fontFamily - onClicked: root.idleService.setIdleEnabled(root.stayAwake) - } - // ---------- Text size ---------- PanelSeparator { foreground: root.bar.foreground diff --git a/desktop/shell/shell/plugins/panels/network/Panel.qml b/desktop/shell/shell/plugins/panels/network/Panel.qml index c48ba79b..8cb23d85 100644 --- a/desktop/shell/shell/plugins/panels/network/Panel.qml +++ b/desktop/shell/shell/plugins/panels/network/Panel.qml @@ -18,8 +18,10 @@ Panel { manageIpc: false // Centralized close so callers can't forget to drop the passphrase prompt. + // Orchard: as a control center page, closing is going back. function close() { - root.controller.hide() + if (root.hosted) root.host.leavePage(root) + else root.controller.hide() cancelPasswordPrompt() optionsSsid = "" } @@ -240,7 +242,7 @@ Panel { } ShellIpc { - target: "omarchy.network" + target: root.hosted ? "" : "omarchy.network" function open() { root.open() } function close() { root.close() } @@ -1085,12 +1087,15 @@ Panel { // outside-click via an overlay MouseArea + Region mask that lets the bar // remain clickable, fade animation, popout coordination). What stays // here is the wifi-specific UI inside. + // The content, for a host that shows it as a page (the control center). + readonly property Component pageContent: panel.content + KeyboardPanel { id: panel anchorItem: button owner: root bar: root.bar - open: root.opened + open: root.popupOpen focusTarget: root.passwordSsid !== "" && root.credentialFocusTarget ? root.credentialFocusTarget : panel.loadedContent contentWidth: panel.fittedContentWidth(Style.space(380)) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight) @@ -1217,13 +1222,24 @@ Panel { Text { id: heroIcon textFormat: Text.PlainText - text: root.icon - color: root.restricted ? root.bar.urgent : root.bar.foreground + // Orchard: as a control center page, the way back. + text: root.hosted ? "󰁍" : root.icon + color: !root.hosted && root.restricted ? root.bar.urgent : root.bar.foreground font.family: root.bar.fontFamily font.pixelSize: Style.font.display - opacity: root.networkManagerAvailable ? 1.0 : 0.5 + opacity: root.hosted || root.networkManagerAvailable ? 1.0 : 0.5 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + // Pressed, it shrinks, as the control center's controls do. + scale: backPress.pressed ? 0.85 : 1 + Behavior on scale { NumberAnimation { duration: Style.duration(120); easing.type: Easing.OutCubic } } + MouseArea { + id: backPress + anchors.fill: parent + anchors.margins: -Style.space(10) + enabled: root.hosted + onClicked: root.close() + } } // Sharing belongs to the connected-network hero rather than the scan diff --git a/desktop/shell/shell/plugins/panels/power/Panel.qml b/desktop/shell/shell/plugins/panels/power/Panel.qml index eb8f52f7..f571be61 100644 --- a/desktop/shell/shell/plugins/panels/power/Panel.qml +++ b/desktop/shell/shell/plugins/panels/power/Panel.qml @@ -187,7 +187,7 @@ Panel { } ShellIpc { - target: "omarchy.power" + target: root.hosted ? "" : "omarchy.power" function open() { root.open() } function close() { root.close() } @@ -305,12 +305,15 @@ Panel { } } + // The content, for a host that shows it as a page (the control center). + readonly property Component pageContent: panel.content + KeyboardPanel { id: panel anchorItem: button owner: root bar: root.bar - open: root.opened && root.batteryPresent + open: root.popupOpen && root.batteryPresent focusTarget: panel.loadedContent contentWidth: panel.fittedContentWidth(Style.space(380)) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight) @@ -354,7 +357,8 @@ Panel { Text { id: heroIcon textFormat: Text.PlainText - text: root.batteryIcon() + // Orchard: as a control center page, the way back. + text: root.hosted ? "󰁍" : root.batteryIcon() color: root.bar.foreground font.family: root.bar.fontFamily font.pixelSize: Style.font.display @@ -362,6 +366,16 @@ Panel { anchors.verticalCenter: parent.verticalCenter Behavior on color { ColorAnimation { duration: Style.duration(200) } } + // Pressed, it shrinks, as the control center's controls do. + scale: backPress.pressed ? 0.85 : 1 + Behavior on scale { NumberAnimation { duration: Style.duration(120); easing.type: Easing.OutCubic } } + MouseArea { + id: backPress + anchors.fill: parent + anchors.margins: -Style.space(10) + enabled: root.hosted + onClicked: root.close() + } } Column { diff --git a/desktop/shell/shell/shell.qml b/desktop/shell/shell/shell.qml index 64be7023..4235da59 100644 --- a/desktop/shell/shell/shell.qml +++ b/desktop/shell/shell/shell.qml @@ -33,6 +33,7 @@ ShellRoot { ControlCenter { id: controlCenter; shell: shell } // The bar pulls it down from the top edge's right third (Bar.qml). readonly property var controlCenter: controlCenter + readonly property var launcher: appGrid ShellIpc { target: "omarchy.dock" function apps(): void { appGrid.toggle() } diff --git a/docs/upstream.md b/docs/upstream.md index 216cbf77..184778f8 100644 --- a/docs/upstream.md +++ b/docs/upstream.md @@ -45,8 +45,8 @@ apps need Chromium). **Taken unchanged** for the launcher's Uninstall: `omarchy-remove-launcher-entry`. **Changed for touch and the tablet in the shell.** -The Display panel is upstream's with three more rows (auto-brightness, -rotation lock, Stay Awake); its commands run on labwc (`omarchy-monitor-state` +The Display panel is upstream's with one more row (auto-brightness; +rotation lock and Stay Awake are the control center's); its commands run on labwc (`omarchy-monitor-state` reads wlr-randr, `omarchy-brightness-display` takes upstream's `--monitor`), the iPad's `Unknown-1` connector counts as the built-in display, and the rotate menu stays shut (the screen turns with the iPad), as do the resolution @@ -72,7 +72,7 @@ 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 start, lifting Labwc's startup cover; `plugins/lock/Service.qml`), wallpaper readiness (`LockView.qml`), -`Style.qml` (a larger bar target), `config/omarchy/shell.json` (the tablet's bar +`config/omarchy/shell.json` (the tablet's bar and the plugins it turns off). **Menu.** `default/omarchy/omarchy-menu.jsonc`: Activity opens Omactivity, Setup > Monitors opens the Display panel, Maximize @@ -85,7 +85,7 @@ charger PM readiness. shipped here; `shell.json` adds the auto-brightness and captive-portal keys. **Our own files** (no upstream counterpart): the control center -(`shell/controlcenter/`), the status cluster (`shell/plugins/status/`), the launcher +(`shell/controlcenter/`, its bar button `shell/plugins/control-center/`), 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 diff --git a/tests/test_bar_layout.py b/tests/test_bar_layout.py index 06cedb59..0e2d8c65 100644 --- a/tests/test_bar_layout.py +++ b/tests/test_bar_layout.py @@ -17,55 +17,53 @@ def node(self, script, *args): return result.stdout @unittest.skipUnless(shutil.which('node'), 'node is required for bar model validation') - def test_a_phone_bar_fits_beside_the_clock(self): + def test_a_phones_bar_is_logo_and_time_then_status(self): narrow = json.loads(self.node(r''' const model = require(process.argv[1]); const layout = JSON.parse(require('node:fs').readFileSync(process.argv[2], 'utf8')).bar.layout; const before = JSON.stringify(layout); const narrow = model.narrowLayout(layout); if (JSON.stringify(layout) !== before) throw new Error('the configured layout was changed'); -console.log(JSON.stringify(narrow)); +console.log(JSON.stringify({narrow, pages: model.narrowPages(layout)})); ''', BAR / 'BarModel.js', CONFIG)) - ids = {section: [entry['id'] for entry in entries] for section, entries in narrow.items()} - self.assertEqual(ids['left'], ['omarchy.menu', 'ipadlinux.keyboard', 'omarchy.network']) - self.assertEqual(ids['center'], ['omarchy.clock']) - self.assertEqual(ids['right'], ['omarchy.power', 'omarchy.overflow']) - # Touch slots are 40 px, the battery with its percentage two of them, and - # beside a centered clock a 375 px bar has room for three a side. - slots = lambda section: sum(2 if name == 'omarchy.power' else 1 for name in ids[section]) - self.assertLessEqual(slots('left'), 3) - self.assertLessEqual(slots('right'), 3) + ids = {section: [entry['id'] for entry in entries] for section, entries in narrow['narrow'].items()} + # The logo and the time together on the left, the status on the right + # (SHELL-SPEC), and no overflow pages. + 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']) + 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] + self.assertFalse([entry['id'] for entry in configured if entry.get('narrow') == 'hidden']) @unittest.skipUnless(shutil.which('node'), 'node is required for bar model validation') - def test_a_narrow_bar_drops_no_widget(self): - # What does not fit beside the clock is one press of the overflow widget - # away, and the press after the last page is the first page again. + def test_a_narrow_bar_drops_no_widget_it_was_not_told_to(self): + # A widget set to `narrow: false` is one press of the overflow widget + # away, and the press after the last page is the first page again; + # only "hidden" leaves a widget out of a narrow bar. pages = json.loads(self.node(r""" const model = require(process.argv[1]); -const layout = JSON.parse(require('node:fs').readFileSync(process.argv[2], 'utf8')).bar.layout; +const layout = {left: [{id: 'menu'}], center: [{id: 'clock'}], + right: [{id: 'a', narrow: false}, {id: 'b', narrow: false}, {id: 'c', narrow: 'hidden'}, {id: 'power'}]}; const ids = page => Object.fromEntries(Object.entries(model.narrowLayout(layout, page)) .map(([section, entries]) => [section, entries.map(entry => entry.id)])); const count = model.narrowPages(layout); console.log(JSON.stringify({count, pages: [...Array(count + 1).keys()].map(ids), - monitor: model.narrowPageOf(layout, 'omarchy.monitor'), power: model.narrowPageOf(layout, 'omarchy.power'), - none: model.narrowPageOf(layout, 'omarchy.absent'), - plain: model.narrowLayout({left: [{id: 'a'}], right: [{id: 'b'}]}).right.map(entry => entry.id)})); -""", BAR / 'BarModel.js', CONFIG)) - configured = [entry['id'] for entries in json.loads(CONFIG.read_text())['bar']['layout'].values() - for entry in entries] + a: model.narrowPageOf(layout, 'a'), power: model.narrowPageOf(layout, 'power'), + none: model.narrowPageOf(layout, 'absent'), + plain: model.narrowLayout({left: [{id: 'x'}], right: [{id: 'y'}]}).right.map(entry => entry.id)})); +""", BAR / 'BarModel.js')) shown = {name for page in pages['pages'] for entries in page.values() for name in entries} - self.assertEqual(shown - {'omarchy.overflow'}, set(configured)) + self.assertEqual(shown - {'omarchy.overflow'}, {'menu', 'clock', 'a', 'b', 'power'}) self.assertEqual(pages['count'], 2) - second = pages['pages'][1] - self.assertEqual(second['left'], ['omarchy.menu', 'omarchy.audio', 'omarchy.bluetooth']) - self.assertEqual(second['center'], ['omarchy.clock']) - self.assertEqual(second['right'], ['omarchy.monitor', 'omarchy.overflow']) - # Three 40 px touch slots a side, as on the first page. - self.assertTrue(all(len(page[side]) <= 3 for page in pages['pages'] for side in ('left', 'right'))) + self.assertEqual(pages['pages'][0]['right'], ['power', 'omarchy.overflow']) + self.assertEqual(pages['pages'][1]['left'], ['menu', 'a', 'b']) self.assertEqual(pages['pages'][2], pages['pages'][0]) - self.assertEqual((pages['monitor'], pages['power'], pages['none']), (1, 0, -1)) + self.assertEqual((pages['a'], pages['power'], pages['none']), (1, 0, -1)) # A layout with nothing taken off has no overflow widget. - self.assertEqual(pages['plain'], ['b']) + self.assertEqual(pages['plain'], ['y']) manifest = json.loads((BAR / 'widgets/Overflow.manifest.json').read_text()) self.assertEqual(manifest['id'], 'omarchy.overflow') self.assertTrue((BAR / 'widgets' / manifest['entryPoints']['barWidget']).is_file())