From d6cb4bb995952f2bca87689c276d47a0a5da54a4 Mon Sep 17 00:00:00 2001 From: Nerkyator Date: Thu, 29 Oct 2026 11:10:12 +0100 Subject: [PATCH 1/4] phone/dev: launch apps and open a terminal in the nested session Every launch from the phone shell goes through omamobile-launch, which run-desktop never put on PATH, so tapping an app did nothing (#121, item 1). run-desktop now exports PATH with the package's bin/. Three helpers there would act on the laptop from inside the harness: omamobile-bt-agent becomes this computer's default BlueZ agent when the Bluetooth panel opens, omamobile-fp-enroll enrolls on its fingerprint reader, and omamobile-set-pin changes the account password. phone/dev/bin comes first on PATH with stand-ins that refuse to run; the first two print the error event their panel already shows. ALT+Return ran alacritty, which Omarchy no longer installs (item 3). It now runs xdg-terminal-exec (foot here), started directly rather than through Omarchy's uwsm launchers, so it opens in the nested session. Tested on a laptop (Omarchy 4.0.6, Hyprland 0.56.2) with phone/dev/run-desktop alone: apps started from the app drawer and ALT+Return open in the nested window (WAYLAND_DISPLAY=wayland-2), and omamobile-launch resolves to the package's bin/; the stand-ins print their error and exit 1. The host's activation environment, windows, shell and notifications owner were unchanged afterwards. tests/all passes. Co-Authored-By: Claude Opus 5.5 --- phone/README.md | 7 ++++++- phone/dev/bin/omamobile-bt-agent | 8 ++++++++ phone/dev/bin/omamobile-fp-enroll | 10 ++++++++++ phone/dev/bin/omamobile-set-pin | 6 ++++++ phone/dev/hyprland.lua | 5 +++-- phone/dev/run-desktop | 5 +++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100755 phone/dev/bin/omamobile-bt-agent create mode 100755 phone/dev/bin/omamobile-fp-enroll create mode 100755 phone/dev/bin/omamobile-set-pin diff --git a/phone/README.md b/phone/README.md index 1dee95243..1775ac456 100644 --- a/phone/README.md +++ b/phone/README.md @@ -19,6 +19,11 @@ real `~/.config/omarchy` is never touched. Plugin edits hot-reload. Inside the window, `ALT+Return` opens a terminal. +The session has the package's `bin/` on `PATH`, so apps launch through +`omamobile-launch` as on the phone. The helpers that would act on this +computer (`omamobile-bt-agent`, `omamobile-fp-enroll`, `omamobile-set-pin`) +are replaced by stand-ins in `dev/bin` that refuse to run. + ## Layout | Path | What it is | @@ -26,4 +31,4 @@ Inside the window, `ALT+Return` opens a terminal. | `profile/shell.json` | Phone layout for the shell (bar, plugins, idle) | | `plugins/` | Phone plugins: status bar, quick settings, launcher and agent bar ([plugins/README.md](plugins/README.md)) | | `screenshots/` | The phone profile in the desktop harness | -| `dev/` | Desktop harness: nested Hyprland config and launcher | +| `dev/` | Desktop harness: nested Hyprland config, launcher, and stand-ins for helpers that would act on the desktop (`dev/bin`) | diff --git a/phone/dev/bin/omamobile-bt-agent b/phone/dev/bin/omamobile-bt-agent new file mode 100755 index 000000000..670267ac8 --- /dev/null +++ b/phone/dev/bin/omamobile-bt-agent @@ -0,0 +1,8 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for omamobile-bt-agent, which would make itself the +# default Bluetooth agent of this computer. The error event is what the +# quick-settings Bluetooth panel shows. +echo '{"event": "error", "message": "Not available in the desktop harness"}' +echo "omamobile-bt-agent: not run in the desktop harness: it would act on this computer's Bluetooth" >&2 +exit 1 diff --git a/phone/dev/bin/omamobile-fp-enroll b/phone/dev/bin/omamobile-fp-enroll new file mode 100755 index 000000000..521273b7a --- /dev/null +++ b/phone/dev/bin/omamobile-fp-enroll @@ -0,0 +1,10 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for omamobile-fp-enroll, which would enroll on this +# computer's fingerprint reader through fprintd. The fingerprint plugin then +# reports no sensor. +if [[ ${1:-} == enroll ]]; then + echo '{"event": "error", "kind": "no-device", "message": "Not available in the desktop harness"}' +fi +echo "omamobile-fp-enroll: not run in the desktop harness: it would act on this computer's fingerprint reader" >&2 +exit 1 diff --git a/phone/dev/bin/omamobile-set-pin b/phone/dev/bin/omamobile-set-pin new file mode 100755 index 000000000..e85979226 --- /dev/null +++ b/phone/dev/bin/omamobile-set-pin @@ -0,0 +1,6 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for omamobile-set-pin, which sets the account +# password: on this computer, the password of the desktop's own account. +echo "omamobile-set-pin: not run in the desktop harness: it would change this computer's account password" >&2 +exit 1 diff --git a/phone/dev/hyprland.lua b/phone/dev/hyprland.lua index 0c75e6256..b436ee14e 100644 --- a/phone/dev/hyprland.lua +++ b/phone/dev/hyprland.lua @@ -20,8 +20,9 @@ hl.config({ misc = { disable_hyprland_logo = true, disable_splash_rendering = true, disable_watchdog_warning = true }, }) --- The outer desktop owns SUPER, so the phone session uses ALT -hl.bind("ALT + RETURN", hl.dsp.exec_cmd("alacritty"), { description = "Terminal" }) +-- The outer desktop owns SUPER, so the phone session uses ALT. The default +-- terminal, started directly rather than through uwsm, opens in this session +hl.bind("ALT + RETURN", hl.dsp.exec_cmd("xdg-terminal-exec"), { description = "Terminal" }) hl.on("hyprland.start", function() -- Omarchy's shell, from the dev copy, with the phone profile's home directory diff --git a/phone/dev/run-desktop b/phone/dev/run-desktop index 0db97a5a3..51150c7aa 100755 --- a/phone/dev/run-desktop +++ b/phone/dev/run-desktop @@ -41,5 +41,10 @@ print(c[-1]["address"] if c else "")') done ) & +# The phone package's commands, as on the phone (every launch goes through +# omamobile-launch), behind dev/bin's stand-ins for those that would act on +# this computer +export PATH="$ROOT/phone/dev/bin:$ROOT/packages/omamobile-shell/bin:$PATH" + export PHONE_DEV_SHELL_CMD="env HOME=$FAKE_HOME OMARCHY_PATH=$OMARCHY_PATH quickshell -p $DEV/shell" exec env -u HYPRLAND_INSTANCE_SIGNATURE Hyprland -c "$ROOT/phone/dev/hyprland.lua" From 1aab105ac388e0371a35aded9c10e30c6c90e9a8 Mon Sep 17 00:00:00 2001 From: Nerkyator Date: Thu, 29 Oct 2026 11:48:01 +0100 Subject: [PATCH 2/4] phone/dev: give the nested session an Omarchy tree omarchy-shell finds Panels the phone shell opens through omarchy-shell never opened in the harness: recents from the dock swipe and the home pill, the clipboard, fingerprint setup (#121, item 4). omarchy-shell finds the shell at $OMARCHY_PATH/shell, through qs ipc (and, from Omarchy 4.5, a socket named from the same string), while the harness ran a copy of the shell elsewhere with OMARCHY_PATH left at /usr/share/omarchy. run-desktop now builds ~/android/phone-dev/omarchy: a real copy of the shell, every other entry linked to the Omarchy it was started from. The nested session runs with OMARCHY_PATH set to it and the shell started from $OMARCHY_PATH/shell, so omarchy-shell reaches the nested shell, and the display filter keeps it off the desktop's. An interactive or login bash sets OMARCHY_PATH back (Omarchy's env-bootstrap), so phone/dev/bin gets an omarchy-shell that restores it from PHONE_DEV_OMARCHY_PATH. With omarchy-shell working, Omarchy's menu can open in the session too, and its Update > Process > Shell (like omarchy-font-set) runs omarchy-restart-shell, which takes OMARCHY_PATH from the systemd user manager and stops that shell on every display: the desktop's. phone/dev/bin refuses it. Tested on a laptop (Omarchy 4.0.6, Hyprland 0.56.2): omarchy-shell shell ping answers from the nested Hyprland's exec, an interactive bash and a login bash, and listPlugins lists the phone plugins; the dock swipe and the home pill open recents. The desktop's shell still answered its own ping, and its windows and the systemd activation environment were unchanged afterwards. tests/all passes. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-shell/plugins/README.md | 10 ++--- phone/README.md | 12 ++++++ phone/dev/bin/omarchy-restart-shell | 9 +++++ phone/dev/bin/omarchy-shell | 8 ++++ phone/dev/run-desktop | 44 ++++++++++++++++++---- 5 files changed, 71 insertions(+), 12 deletions(-) create mode 100755 phone/dev/bin/omarchy-restart-shell create mode 100755 phone/dev/bin/omarchy-shell diff --git a/packages/omamobile-shell/plugins/README.md b/packages/omamobile-shell/plugins/README.md index 0580c6726..39d3383e4 100644 --- a/packages/omamobile-shell/plugins/README.md +++ b/packages/omamobile-shell/plugins/README.md @@ -881,13 +881,13 @@ names an output directory). ## Testing in the desktop harness -`phone/dev/run-desktop` copies the shell and runs it in a nested Hyprland, so -point IPC at that copy and its Wayland display, never at -`/usr/share/omarchy/shell` (your real desktop): +`phone/dev/run-desktop` copies the shell into an Omarchy tree of its own and +runs it in a nested Hyprland, so point IPC at that tree and its Wayland +display, never at `/usr/share/omarchy` (your real desktop): ```sh -HOME=~/android/phone-dev/home WAYLAND_DISPLAY=wayland-2 \ - quickshell ipc -p ~/android/phone-dev/shell call shell listPlugins +OMARCHY_PATH=~/android/phone-dev/omarchy WAYLAND_DISPLAY=wayland-2 \ + omarchy-shell shell listPlugins ``` (`quickshell list --all` shows which `wayland-N` the nested shell is on.) diff --git a/phone/README.md b/phone/README.md index 1775ac456..103baf7fb 100644 --- a/phone/README.md +++ b/phone/README.md @@ -24,6 +24,18 @@ The session has the package's `bin/` on `PATH`, so apps launch through computer (`omamobile-bt-agent`, `omamobile-fp-enroll`, `omamobile-set-pin`) are replaced by stand-ins in `dev/bin` that refuse to run. +The shell runs from an Omarchy tree of its own, `~/android/phone-dev/omarchy`: +a copy of your Omarchy's shell, with everything else linked to your Omarchy. +`OMARCHY_PATH` points there in the session, so `omarchy-shell` (and the +panels it opens, such as recents) reaches the nested shell and never your +desktop's. A `dev/bin` stand-in keeps that working in a terminal, whose bash +resets `OMARCHY_PATH`, and another refuses `omarchy-restart-shell`, which +would restart your desktop's shell. From a desktop terminal, reach the +nested shell with +`OMARCHY_PATH=~/android/phone-dev/omarchy WAYLAND_DISPLAY=wayland-N omarchy-shell …`. +Harnesses from before this kept the copy in `~/android/phone-dev/shell`; +nothing uses it now, so it can be deleted. + ## Layout | Path | What it is | diff --git a/phone/dev/bin/omarchy-restart-shell b/phone/dev/bin/omarchy-restart-shell new file mode 100755 index 000000000..184354543 --- /dev/null +++ b/phone/dev/bin/omarchy-restart-shell @@ -0,0 +1,9 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for omarchy-restart-shell (the menu's Update > +# Process > Shell, omarchy-font-set, omarchy-refresh-shell). The real one +# takes OMARCHY_PATH from the systemd user manager, which is the desktop's, +# and stops that shell on every display: from here it would restart this +# computer's desktop shell. +echo "omarchy-restart-shell: not run in the desktop harness: it would restart this computer's desktop shell; close and reopen run-desktop instead" >&2 +exit 1 diff --git a/phone/dev/bin/omarchy-shell b/phone/dev/bin/omarchy-shell new file mode 100755 index 000000000..5e00f8f84 --- /dev/null +++ b/phone/dev/bin/omarchy-shell @@ -0,0 +1,8 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for omarchy-shell. The nested shell runs from +# run-desktop's own Omarchy tree, which an interactive bash takes out of +# OMARCHY_PATH again (Omarchy's env-bootstrap), so put it back and run the +# real omarchy-shell from that tree. +export OMARCHY_PATH="${PHONE_DEV_OMARCHY_PATH:?not in the desktop harness}" +exec "$OMARCHY_PATH/bin/omarchy-shell" "$@" diff --git a/phone/dev/run-desktop b/phone/dev/run-desktop index 51150c7aa..7430dd3bc 100755 --- a/phone/dev/run-desktop +++ b/phone/dev/run-desktop @@ -8,14 +8,39 @@ set -euo pipefail ROOT="$(cd "$(dirname "$(readlink -f "$0")")/../.." && pwd)" -DEV="${PHONE_DEV:-$HOME/android/phone-dev}" -OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}" +# Absolute and without a trailing slash: omarchy-shell finds the shell by +# this exact string (qs ipc, and from Omarchy 4.5 the shell's socket name) +DEV="$(realpath -m -- "${PHONE_DEV:-$HOME/android/phone-dev}")" +OMARCHY_SRC="$(readlink -f -- "${OMARCHY_PATH:-/usr/share/omarchy}")" +LAYOUT="$DEV/omarchy" FAKE_HOME="$DEV/home" -# A private copy of the shell gives it its own config path, so IPC calls -# can't reach the desktop's running shell by accident (and vice versa) -mkdir -p "$DEV" -rsync -a --delete "$OMARCHY_PATH/shell/" "$DEV/shell/" +if [[ -n ${PHONE_DEV_OMARCHY_PATH:-} ]]; then + echo "run-desktop: run it from the desktop, not from inside the harness" >&2 + exit 1 +fi +if [[ ! -f $OMARCHY_SRC/shell/shell.qml ]]; then + echo "run-desktop: no Omarchy shell in $OMARCHY_SRC" >&2 + exit 1 +fi + +# The nested session's own Omarchy tree. Its shell is a private copy, which +# gives it its own config path, so IPC calls can't reach the desktop's +# running shell by accident (and vice versa); the rest links to the real +# tree. OMARCHY_PATH points here in the nested session, so omarchy-shell +# finds the nested shell at $OMARCHY_PATH/shell. +mkdir -p "$LAYOUT" +rsync -a --delete "$OMARCHY_SRC/shell/" "$LAYOUT/shell/" +for entry in "$OMARCHY_SRC"/*; do + name=${entry##*/} + [[ $name == shell ]] && continue + # ln -sfn onto a real directory would put the link inside it + if [[ -L $LAYOUT/$name || ! -e $LAYOUT/$name ]]; then + ln -sfn "$entry" "$LAYOUT/$name" + fi +done +# Links to what a newer Omarchy no longer has +find "$LAYOUT" -mindepth 1 -maxdepth 1 -xtype l -delete mkdir -p "$FAKE_HOME/.config/omarchy" "$FAKE_HOME/.local/state/omarchy" ln -sfn "$HOME/.local/state/omarchy/current" "$FAKE_HOME/.local/state/omarchy/current" @@ -46,5 +71,10 @@ print(c[-1]["address"] if c else "")') # this computer export PATH="$ROOT/phone/dev/bin:$ROOT/packages/omamobile-shell/bin:$PATH" -export PHONE_DEV_SHELL_CMD="env HOME=$FAKE_HOME OMARCHY_PATH=$OMARCHY_PATH quickshell -p $DEV/shell" +# The nested session's Omarchy, for everything it starts. An interactive +# bash sets OMARCHY_PATH back to the system's (Omarchy's env-bootstrap), so +# dev/bin's omarchy-shell takes it from PHONE_DEV_OMARCHY_PATH. +export OMARCHY_PATH="$LAYOUT" PHONE_DEV_OMARCHY_PATH="$LAYOUT" + +export PHONE_DEV_SHELL_CMD="env HOME=$FAKE_HOME OMARCHY_PATH=$OMARCHY_PATH quickshell -p $OMARCHY_PATH/shell" exec env -u HYPRLAND_INSTANCE_SIGNATURE Hyprland -c "$ROOT/phone/dev/hyprland.lua" From 2f13dfc1ed692f91ad816879a895f4afdab63e81 Mon Sep 17 00:00:00 2001 From: Nerkyator Date: Thu, 29 Oct 2026 11:57:14 +0100 Subject: [PATCH 3/4] phone/dev: no idle lock in the nested session The phone profile locks after 60 s idle. Now that omarchy-shell reaches the nested shell, the harness window locked too, behind this computer's account password, and the idle lock first runs omarchy-system-lock, whose cleanup (pkill of the screensaver, 1password --lock) acts on the whole desktop session. A phone emulator doesn't lock on its own either. run-desktop now writes its copy of the profile's shell.json with the idle lock off (0). The screensaver is already off in the profile, so the idle service starts no timer at all. Only the harness's copy changes; the profile in the package keeps its 60 s. Tested on a laptop (Omarchy 4.0.6): after 85 s idle the window still shows the home screen, and the shell logs "idle-cycle-cancel: idle-timers-disabled". Co-Authored-By: Claude Opus 5.5 --- phone/README.md | 4 +++- phone/dev/run-desktop | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/phone/README.md b/phone/README.md index 103baf7fb..e72fe98c7 100644 --- a/phone/README.md +++ b/phone/README.md @@ -17,7 +17,9 @@ inside it. It uses a private home directory under `~/android/phone-dev/home` that links your current Omarchy theme and this directory's plugins, so your real `~/.config/omarchy` is never touched. Plugin edits hot-reload. -Inside the window, `ALT+Return` opens a terminal. +Inside the window, `ALT+Return` opens a terminal. The window never locks on +its own, as in a phone emulator: the harness turns the profile's idle lock +off in its copy of `shell.json`. The session has the package's `bin/` on `PATH`, so apps launch through `omamobile-launch` as on the phone. The helpers that would act on this diff --git a/phone/dev/run-desktop b/phone/dev/run-desktop index 7430dd3bc..87bfcdcb2 100755 --- a/phone/dev/run-desktop +++ b/phone/dev/run-desktop @@ -45,8 +45,19 @@ find "$LAYOUT" -mindepth 1 -maxdepth 1 -xtype l -delete mkdir -p "$FAKE_HOME/.config/omarchy" "$FAKE_HOME/.local/state/omarchy" ln -sfn "$HOME/.local/state/omarchy/current" "$FAKE_HOME/.local/state/omarchy/current" ln -sfn "$ROOT/packages/omamobile-shell/plugins" "$FAKE_HOME/.config/omarchy/plugins" -# Copied, not linked: the shell writes to shell.json when settings change -cp "$ROOT/packages/omamobile-shell/profile/shell.json" "$FAKE_HOME/.config/omarchy/shell.json" +# Copied, not linked: the shell writes to shell.json when settings change. +# Without the idle lock (0 is off), as a phone emulator never locks: the +# profile's lock after 60 s would lock the window behind this computer's +# account password, and omarchy-system-lock's cleanup reaches the desktop. +python3 -I - "$ROOT/packages/omamobile-shell/profile/shell.json" "$FAKE_HOME/.config/omarchy/shell.json" <<'EOF' +import json, sys +with open(sys.argv[1]) as f: + config = json.load(f) +config.setdefault("idle", {})["lock"] = 0 +with open(sys.argv[2], "w") as f: + json.dump(config, f, indent=2) + f.write("\n") +EOF # Once the nested window appears on the desktop, float it at the phone's # 13:6 aspect. Uses the desktop compositor's own dispatchers; no config changes. From 0b03d36274fcc15bf314174eb6818986471bf61c Mon Sep 17 00:00:00 2001 From: Nerkyator Date: Fri, 30 Oct 2026 11:41:03 +0100 Subject: [PATCH 4/4] phone/dev: open D-Bus-activated apps in the nested session Files still opened on the desktop when started from the harness (#121, item 2). Its entry has DBusActivatable=true, so gtk-launch asks the session bus, which the nested session shares with this computer, to start org.gnome.Nautilus, and the bus starts it from the systemd user manager, with the desktop's environment. phone/dev/bin now has a gtk-launch stand-in, which launches reach by name through uwsm-app with the caller's PATH. For an entry GIO would activate over D-Bus (DBusActivatable=true and a basename that is a bus name, GLib's own test), it runs /usr/bin/gtk-launch with DBUS_SESSION_BUS_ADDRESS at /dev/null (unset, GLib would still find $XDG_RUNTIME_DIR/bus), and GIO runs the entry's Exec in the nested session instead. Every other entry goes to the real gtk-launch unchanged, and omamobile-launch is unchanged, so nothing differs on the phone. The stand-in's header and phone/README.md list what such an app loses without the session bus, and the hand-offs to and from the desktop that remain. The shell runs with its own HOME, and Omarchy's app library reads $HOME/.local/share for hidden entries and icons, so the nested drawer hid an app the desktop shows (imv); without uwsm's XDG_DATA_HOME it would also miss this computer's own entries, Omarchy's web apps among them (#121's web-app note). run-desktop now puts the real data directory first in the shell's XDG_DATA_DIRS, and builds the shell's command with printf %q, since Hyprland runs it with sh -c. Tested on a laptop (Omarchy 4.0.6, Hyprland 0.56.2, glib 2.90.1): Files, from the app drawer and through omamobile-launch, opens in the nested window (WAYLAND_DISPLAY=wayland-2, session bus at /dev/null) in an app-graphical.slice scope, and nothing opens on the desktop. inotify shows the stand-in, then /usr/bin/gtk-launch, opened for each launch, and foot keeps the session bus. The drawer finds imv with the change and not without it. A Quickshell DesktopEntries probe with the harness's HOME lists 36 entries without XDG_DATA_HOME and 38 with the new XDG_DATA_DIRS, with or without it. The desktop's windows, its shell and the systemd activation environment were unchanged afterwards. tests/all passes. Co-Authored-By: Claude Opus 5.5 --- phone/README.md | 14 +++++++++++++ phone/dev/bin/gtk-launch | 43 ++++++++++++++++++++++++++++++++++++++++ phone/dev/run-desktop | 12 ++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 phone/dev/bin/gtk-launch diff --git a/phone/README.md b/phone/README.md index e72fe98c7..dc4e81728 100644 --- a/phone/README.md +++ b/phone/README.md @@ -26,6 +26,20 @@ The session has the package's `bin/` on `PATH`, so apps launch through computer (`omamobile-bt-agent`, `omamobile-fp-enroll`, `omamobile-set-pin`) are replaced by stand-ins in `dev/bin` that refuse to run. +The session shares this computer's D-Bus, so an app that starts through +D-Bus activation (Files, for one) would open on the desktop. `dev/bin`'s +`gtk-launch` starts those without the session bus, so they open in the +window but lose what they do over it (for Files, the Trash, Recent and +Network locations), and what they open has no session bus either: a page +Files opens in the browser starts the browser without its keyring. An app +that hands off to an instance already open on the desktop still opens +there, and that includes the browser and so Omarchy's web apps; while one +started in the window is running, the desktop's own launches of it open in +the window instead. + +The app list shows this computer's own entries too, Omarchy's web apps +among them, and hides what the desktop hides. + The shell runs from an Omarchy tree of its own, `~/android/phone-dev/omarchy`: a copy of your Omarchy's shell, with everything else linked to your Omarchy. `OMARCHY_PATH` points there in the session, so `omarchy-shell` (and the diff --git a/phone/dev/bin/gtk-launch b/phone/dev/bin/gtk-launch new file mode 100755 index 000000000..4142dde68 --- /dev/null +++ b/phone/dev/bin/gtk-launch @@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Desktop harness stand-in for gtk-launch, which app launches reach through +# uwsm-app with the caller's PATH (omamobile-launch, Omarchy's app library). +# The nested session shares this computer's session bus, so GIO starts an +# entry with DBusActivatable=true through D-Bus activation, with the user +# manager's environment, and the app opens on the desktop (Files, for one). +# For those entries only, run gtk-launch with its bus address at /dev/null +# (unset, GLib would still find the bus at $XDG_RUNTIME_DIR/bus): GIO then +# runs the entry's Exec here. Every other entry starts as it would anyway. +# +# Limits: +# - an app started without the session bus loses what it does over it: for +# Files, the Trash, Recent and Network locations (moving files to the +# trash still works), and settings changes aren't saved; +# - what such an app opens has no session bus either: a page Files opens in +# the browser starts the browser without its keyring, unless the browser +# is already open on the desktop; +# - an app that hands off to an instance already open on the desktop +# (Telegram, Brave) still opens there. +# +# GIO activates an entry over D-Bus only when its name is a bus name, as +# org.gnome.Nautilus is, so the check below asks the same of the entry GIO +# resolves. It runs /usr/bin/python3: a python3 earlier on PATH (mise, a +# virtualenv) may have no PyGObject, and the app would open on the desktop. +if [[ -n ${1:-} && $1 != -* ]] && /usr/bin/python3 -I - "$1" <<'EOF' +import os, sys +import gi +gi.require_version("GioUnix", "2.0") +from gi.repository import Gio, GioUnix +app_id = sys.argv[1] if sys.argv[1].endswith(".desktop") else sys.argv[1] + ".desktop" +try: + app = GioUnix.DesktopAppInfo.new(app_id) +except TypeError: # no such entry, which gtk-launch reports itself + sys.exit(1) +name = os.path.basename(app.get_filename()).removesuffix(".desktop") +bus_name = Gio.dbus_is_name(name) and not name.startswith(":") +sys.exit(0 if app.get_boolean("DBusActivatable") and bus_name else 1) +EOF +then + export DBUS_SESSION_BUS_ADDRESS=unix:path=/dev/null +fi +exec /usr/bin/gtk-launch "$@" diff --git a/phone/dev/run-desktop b/phone/dev/run-desktop index 87bfcdcb2..54e41eaf2 100755 --- a/phone/dev/run-desktop +++ b/phone/dev/run-desktop @@ -87,5 +87,15 @@ export PATH="$ROOT/phone/dev/bin:$ROOT/packages/omamobile-shell/bin:$PATH" # dev/bin's omarchy-shell takes it from PHONE_DEV_OMARCHY_PATH. export OMARCHY_PATH="$LAYOUT" PHONE_DEV_OMARCHY_PATH="$LAYOUT" -export PHONE_DEV_SHELL_CMD="env HOME=$FAKE_HOME OMARCHY_PATH=$OMARCHY_PATH quickshell -p $OMARCHY_PATH/shell" +# The shell has its own HOME, and Omarchy's app library looks in +# $HOME/.local/share for which entries are hidden and for icons (and, +# without uwsm's XDG_DATA_HOME, for this computer's own entries, Omarchy's +# web apps among them). So the real data directory goes first in the +# shell's XDG_DATA_DIRS, for omamobile-launch too, and its entries win over +# the system's as they do on the desktop. +data_dirs="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +# Hyprland runs it with sh -c +printf -v PHONE_DEV_SHELL_CMD '%q ' env HOME="$FAKE_HOME" OMARCHY_PATH="$OMARCHY_PATH" \ + XDG_DATA_DIRS="$data_dirs" quickshell -p "$OMARCHY_PATH/shell" +export PHONE_DEV_SHELL_CMD exec env -u HYPRLAND_INSTANCE_SIGNATURE Hyprland -c "$ROOT/phone/dev/hyprland.lua"