Skip to content

omamobile-shell 0.2.128: the phone's file chooser and permission sheet survive Omarchy's Secret-portal migration - #727

Open
den-kloot wants to merge 3 commits into
derekross:mainfrom
den-kloot:portal-user-config
Open

den-kloot wants to merge 3 commits into
derekross:mainfrom
den-kloot:portal-user-config

Conversation

@den-kloot

Copy link
Copy Markdown
Contributor

Omarchy's migration 1788261467.sh ("Expose GNOME Keyring to sandboxed apps through the Secret portal", omarchy-settings 4.5) writes ~/.config/xdg-desktop-portal/hyprland-portals.conf containing default=hyprland;gtk and the Secret line. xdg-desktop-portal reads the user's file first, so after that migration the phone's picks in /etc/xdg/xdg-desktop-portal/hyprland-portals.conf stop applying:

  • FileChooser=gnome;gtk: file dialogs are GTK 3's desktop chooser again. It needs 623 px, and the Pixel 9a has 405 px, so Hyprland squeezes its buffer to fit the screen and the text is drawn tall and narrow.
  • Access=omamobile;gtk: the permission question goes back to GTK's dialog.

Here it showed up in the WhatsApp web app, under Attach › Photos & videos. On this phone the migration ran with omamobile-update on 2026-11-12.

Change: at each login, omamobile-setup-user copies every line from the /etc file whose interface the user's file doesn't name yet. The added lines go under a comment. xdg-desktop-portal is restarted only when a line was added.

  • If there is no user file, nothing is created.
  • A line the user set themselves (e.g. FileChooser=gtk) is kept.
  • It runs at every login, not once, because the migration can arrive with any later update.

Tests: test/setup-user.sh passes on the phone. The new case starts from Omarchy's file and runs two logins. It checks that both lines are added once, that the Secret line stays, and that the portal restarts once. It also checks that a user's own FileChooser line is kept and that no file is created where there was none. I haven't run test/all.

On a Pixel 9a (omamobile-shell 0.2.127, omarchy-settings 4.5.0-3):

  • With Omarchy's file in place, a portal OpenFile call opened xdg-desktop-portal-gtk.
  • After the new step ran, the file had the two extra lines and the same call opened Nautilus (org.gnome.Nautilus) full screen.
  • In WhatsApp, Attach › Photos & videos picked a file through Nautilus.
Before (GTK 3 chooser, squeezed) After (Nautilus)

The version is 0.2.128, which #555 also uses. Renumber as needed.

Found with an AI assistant (Claude), tested on my phone.

🤖 Generated with Claude Code

…t survive Omarchy's Secret-portal migration

Omarchy's migration 1788261467 ("Expose GNOME Keyring to sandboxed apps
through the Secret portal") writes ~/.config/xdg-desktop-portal/
hyprland-portals.conf with default=hyprland;gtk and the Secret line.
xdg-desktop-portal takes the user's file first, so after that migration
the phone's picks in /etc/xdg/xdg-desktop-portal/hyprland-portals.conf
(FileChooser=gnome;gtk, Access=omamobile;gtk) no longer applied: file
dialogs were GTK 3's desktop chooser again. It needs 623 px; on the
Pixel 9a's 405 px Hyprland squeezed its buffer to the screen, text drawn
tall and narrow (WhatsApp web app, Attach > Photos & videos).

omamobile-setup-user now adds, at each login, every line of the /etc file
whose interface the user's file doesn't name yet, under a comment, and
restarts xdg-desktop-portal only when it added one. No user file: nothing
is made. A line the user set (FileChooser=gtk) stays. Every login, not
once, since the migration can arrive with any later update.

test/setup-user.sh: Omarchy's file, two logins: both lines added once,
Secret kept, one portal restart; a user's own FileChooser line kept; no
file made where there was none.

On a Pixel 9a (omamobile-shell 0.2.127, omarchy-settings 4.5.0-3): with
Omarchy's file in place a portal OpenFile opened xdg-desktop-portal-gtk;
after the new step the file gained the two lines and the same call
opened Nautilus (org.gnome.Nautilus), full screen; WhatsApp's Attach >
Photos & videos picked a file through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you for this, and for tracking it down to the migration rather than to the chooser. I checked it against Omarchy 4.5.0-3's own packages: the migration writes exactly the file you describe, and omarchy-settings also puts the same file in /etc/skel, so every user made on a 4.5 image starts with it. That makes your fix more important than the description says: it is on fresh installs too, and very likely on my Pixel 7 Pro.

The change reads well: only the interfaces the user's file doesn't name, the user's own line kept, nothing created where there is no file, the portal restarted only when something was added, and a test that checks each of those. I ran the new step on its own against a few files in a scratch folder and it behaved as described, including a file without a final newline.

A few small things, none of them blocking, if you'd like to take them in the same push:

  1. If ~/.config/xdg-desktop-portal/hyprland-portals.conf is a symlink (Omarchy's migration checks for one, so dotfile setups exist), the echo >> either writes into the linked file or, if that is read-only, fails, and with set -e the setup unit then fails at every login. Skipping a symlinked or unwritable file, with a line in the output, would avoid both.
  2. grep -q "^${line%%=*}=" misses a user's line written with spaces around = (FileChooser = gtk), and the phone's line is then added after it as a duplicate. Allowing blanks around the = (and escaping the dots, which are wildcards in the pattern now) would keep the user's choice in that case too.
  3. The lines go at the end of the file, which is right while the file has only [preferred]. If you'd like it to be explicit, check that the last group is [preferred], or skip otherwise.
  4. Could you paste a tools/phone-smoke report from the 9a with this build? CONTRIBUTING asks for one with a package change.

On the version: #555 also uses 0.2.128, as you noted. I'll set the number when I merge, so please leave it as it is.

Before merging I'll run it on my Pixel 7 Pro: read the user's portal file, install this build, log in again, and open a file chooser and a permission request. I'll report here.

derekross added a commit that referenced this pull request Nov 14, 2026
…ys suspend is verified (#737)

* omamobile-shell 0.2.129: auto-sleep on by default where the device says suspend is verified

omamobile-sleepd (s2idle 30 s after the screen goes off behind a secure
lock) shipped off on every phone. On the Pixel 7 Pro it is now verified:
a night asleep with about 22 h of standby, power off, and double tap
waking the phone from sleep (SUSPEND-PLAN, 2026-11-13). Turn the toggle on
once, at login, on a phone whose device package installs
/usr/share/omamobile/auto-sleep-default; every other phone keeps it off,
and a user who turns it off keeps it off. With the modem up the phone
still doesn't sleep (its inhibitor stays until linux-omarchy-mobile#232).

0.2.128 is claimed by #555 and #727.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* omamobile-shell: the default-off test allows only the device-gated auto-sleep step

The package test refused any code that turns the omamobile-sleep toggle
on. #737 adds exactly one such step, gated on the device package's
auto-sleep-default. The test now allows that one line and checks that the
gate sits right above it; anything else that turns the toggle on still
fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
den-kloot and others added 2 commits November 24, 2026 08:15
# Conflicts:
#	packages/omamobile-shell/test/setup-user.sh
#	packages/omamobile-shell/version
…er-group file alone

Review of derekross#727:

- A symlinked ~/.config/xdg-desktop-portal/hyprland-portals.conf (dotfile
  setups) or one the user can't write is left as it is, with a line in the
  login's output, instead of writing through the link or failing the setup
  unit under set -e at every login.
- A user's line with blanks around the = ("FileChooser = gtk") counts as
  theirs, and the key's dots are escaped in the pattern, so they no longer
  match any character.
- The lines are only added while the file's last group is [preferred],
  since they go at the end.

test/setup-user.sh checks each case; taking out the symlink check, the
writable check, the group check, the blanks or the escaping each fails a
check of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@den-kloot

Copy link
Copy Markdown
Contributor Author

@derekross, points 1 to 3 are in ed9410ce, on today's main (merged in, not rebased; the conflicts were the version file, now 0.2.143 and yours to set, and the end of test/setup-user.sh, where both sides are kept):

  1. Symlink or not writable. A symlinked or read-only ~/.config/xdg-desktop-portal/hyprland-portals.conf is left alone with a line on stderr ("… is a symlink or not writable; the phone's portal picks aren't added to it"). Nothing is written through the link, and the setup unit doesn't fail.
  2. Blanks around =. The check is now ^[[:space:]]*<key with escaped dots>[[:space:]]*=, so FileChooser = kde keeps the user's choice with no duplicate, and an orgXfreedesktopX… line no longer hides the phone's line.
  3. [preferred] last. The lines are only added while the file's last group is [preferred]; otherwise the file is left alone, again with a line in the output.

test/setup-user.sh checks each case: FileChooser = kde, a key with other characters in place of the dots, a file ending in another group, a symlink into a dotfiles folder, and a read-only file. I took out each rule on its own (the symlink check, the writable check, the group check, the blanks, the escaping), and each time a check of its own failed. The README's File dialogs paragraph says what's left alone.

On the 9a, packages/omamobile-shell/test/all passes on this head, with the same exception as in #539: test/power-overlap.sh ("delay 1 produced wrong screen state or brightness") fails on this phone on unchanged main too.

Point 4, tools/phone-smoke: not yet. It needs this build installed on the 9a and root, so it'll come in a later comment.

Measured on my phone with Claude.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking all three points, and for the mutation runs: I repeated the symlink one here, and with that check removed the test fails on its own line, as you say. The rules now read well, and reading the phone's lines from our own /etc file, so the two can never drift apart, is a nice design.

I owe you an apology, though, and some news that should have been here a week ago. On 18 November W4HO-ham opened #886 for the same bug, with the same fix in the same function, and I wrote there that I expected to take #886 and credit your find in its commit, once I had run it on my Pixel 7 Pro. I never said so here, so you spent this morning on a branch I hadn't told you was in question. I'm sorry about that.

The two can't both land, and I haven't made the final choice yet; I'll make it when I do the 7 Pro run I promised you on the 13th: the user's portal file before and after a login, a file chooser from Chromium, and a permission request. Whichever goes in, your find and your work on the rules are credited in the commit. Your smoke report from the 9a is still welcome, but it doesn't hold anything up.

@derekross

Copy link
Copy Markdown
Owner

Decision: this is the one we take. Thank you for reworking it. I owe you an apology for not telling you sooner that #886 fixed the same bug in the same function. Both are correct; yours keeps one source for the phone's portal picks, and its comment line in the user's file is a nice touch. Next is my run on the Pixel 7 Pro (a log-out and log-in, then the user's portal file checked), then I'll merge main in, set the next shell number and squash it.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this on my Pixel 7 Pro today, built from your head merged with main, and my phone had exactly the bug: Omarchy 4.5's file in ~/.config/xdg-desktop-portal/hyprland-portals.conf held only default=hyprland;gtk and the Secret line. After the login step (omamobile-setup-user) the file keeps both of Omarchy's lines and gains your comment line plus org.freedesktop.impl.portal.Access=omamobile;gtk and org.freedesktop.impl.portal.FileChooser=gnome;gtk under [preferred]; a second run leaves it byte for byte the same, and it stays a regular file owned by the user. It passes on the 7 Pro. It needs main merged in and the next shell number before the squash; I'll push that to your branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants