Skip to content

omamobile-shell 0.2.134: the touch file chooser and the permission sheet survive Omarchy 4.5's portal file - #886

Open
W4HO-ham wants to merge 2 commits into
derekross:mainfrom
W4HO-ham:shell-portal-user-file
Open

W4HO-ham wants to merge 2 commits into
derekross:mainfrom
W4HO-ham:shell-portal-user-file

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Since my Pixel 9a took Omarchy 4.5, a web page's "attach a file" opened GTK 3's desktop file dialog again instead of Nautilus's touch chooser: I could get into Pictures, but no tap, double tap or Open would enter a folder below it.

The cause is a file Omarchy 4.5 gives every user, ~/.config/xdg-desktop-portal/hyprland-portals.conf, with default=hyprland;gtk. xdg-desktop-portal (1.22.1, xdp_portal_config_find) asks each configuration file in turn for the interface's own line and then for that same file's default before it goes on to the next file. So the user's default answers for FileChooser and for Access, and the two lines omamobile-shell ships in /etc/xdg/xdg-desktop-portal/hyprland-portals.conf are never reached. The permission question falls back to GTK's dialog the same way.

omamobile-setup-user now adds the two lines to the user's own file, under its [preferred] group, at any login that finds one missing (an Omarchy update may write the file again), and restarts a running xdg-desktop-portal when it changed something. A file that already names the interface is left alone, whatever it names, so an owner who wants another backend says so there. A user with no such file gets none.

Tested:

  • test/setup-user.sh: Omarchy's file gets both lines once and keeps its own, a second login changes nothing and restarts nothing, an owner's own FileChooser line is kept, a rewritten file gets the lines back, and no file is made where there is none. test/all passes, and tools/pr-check origin/main.
  • On my Pixel 9a (7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, Omarchy 4.5), first by hand: with the two lines in the user's file and xdg-desktop-portal restarted, Chromium's file input opened org.gnome.Nautilus ("Open Files"), a tap opened Pictures and a folder below it, and a picked file reached the page. Before, the window was xdg-desktop-portal-gtk.
  • Then the new step itself, run there as the session's user against the file as Omarchy wrote it: both lines went in under [preferred] and xdg-desktop-portal restarted once; a second run changed nothing and restarted nothing.

Not tested: the package installed as a package on a phone (the step ran from this branch's script, not from an installed omamobile-shell), and the permission sheet after the change (only the file chooser was tried by hand).

tests/packages fails in omamobile-omarchy on my laptop with and without this change (qmlformat on two of the installed Omarchy's files), nothing else.

It bumps omamobile-shell to 0.2.134, and so does my swipe pull request that follows; whichever lands second gets a rebase from me.

…eet survive Omarchy 4.5's portal file

Omarchy 4.5 gives every user a ~/.config/xdg-desktop-portal/hyprland-portals.conf with a default= line. xdg-desktop-portal (1.22.1, xdp_portal_config_find) asks each configuration file in turn for the interface's own line and then for that file's default before it goes on to the next file, so the user's default answers for FileChooser and Access, and the two lines this package ships in /etc/xdg are never reached. A web page's file input opened GTK 3's desktop dialog again, where no tap, double tap or Open enters a folder, and the permission question fell back to GTK's dialog.

omamobile-setup-user now adds the two lines to the user's own file, under its [preferred] group, at any login that finds one missing (an Omarchy update may write the file again), and restarts a running xdg-desktop-portal when it changed something. A file that names the interface is left alone, whatever it names, and a user with no such file gets none.

Tested: test/setup-user.sh (Omarchy's file gets both lines once and keeps its own; a second login changes and restarts nothing; an owner's own FileChooser line is kept; a rewritten file gets the lines back; no file is made where there is none) and test/all (333). On a Pixel 9a the same two lines were put into the user's file by hand and xdg-desktop-portal restarted: Chromium's file input then opened org.gnome.Nautilus, a tap opened Pictures and a folder below it, and a picked file reached the page; before, the window was xdg-desktop-portal-gtk. The package's own step then ran there against the file as Omarchy wrote it (2026-11-18): both lines went in under [preferred] and xdg-desktop-portal restarted once; a second run changed nothing and restarted nothing.
@derekross

Copy link
Copy Markdown
Owner

Thank you for this, and for reading xdg-desktop-portal's lookup rather than guessing at it. I checked both halves against the sources: omarchy-settings 4.5.0-3 puts that hyprland-portals.conf in /etc/skel and Omarchy's migration 1788261467 installs it for existing users, and in xdg-desktop-portal 1.22.1 xdp_portal_config_find() does ask each file for the interface's line and then for that file's default before it moves on. So this is on every phone with Omarchy 4.5, mine included, not only your 9a.

One thing you couldn't have known from the code: @den-kloot opened #727 for the same bug on 2026-11-13, with the same fix (the phone's lines added to the user's file at each login). I reviewed it then and still owe it a run on my Pixel 7 Pro, so the delay is mine. The two can't both land. Yours is clean against main and puts the lines under [preferred], which is what I had asked #727 for, so I expect to take this one and credit #727's find in the commit; I'll say so on both once I've run it on the 7 Pro (the user's file before and after a login, a file chooser from Chromium, and a permission request, which you say you didn't try).

I ran the new step on its own against a few files in a scratch folder and it does what you describe: both lines once, Omarchy's two kept, one restart, nothing on the second run. Three small things, none blocking, if you'd like to take them in the same push:

  1. If the user's hyprland-portals.conf is a symlink (Omarchy's migration checks for one, so dotfile setups exist), sed -i replaces the link with a regular file. Skipping a link, with a line in the output, would leave such a setup alone.
  2. If sed -i can't write (a directory the user can't write to), it exits 4, and with set -e the setup stops there at every login, before the Calls plugin and everything after it. An || true on that sed, or the step at the end of the script, avoids that.
  3. An owner's line written as FileChooser = gtk, with spaces, isn't matched, so the phone's line is added above it. The owner's line still wins (the later of two equal keys does), so nothing breaks; allowing blanks before the = would just keep the file as they wrote it.

On the version: #887, #888, #890 and #204 also say 0.2.134. If this is the first of them to merge it keeps the number as it is; the later ones each need a push of the next free number before they merge, and I'll say which when I get there. CONTRIBUTING asks for a tools/phone-smoke report with a package change; if the 9a is at hand, please paste one.

…e file alone and reads an owner's line with blanks

From the review of this pull request. A user's hyprland-portals.conf that is a link (a dotfile setup) is left as it is, with a line saying what it lacks, since sed -i would replace the link with a copy. A file sed can't write to is reported and the rest of omamobile-setup-user goes on, where under set -e it stopped the setup at every login. An owner's line written with blanks around its "=" counts as theirs, so no second line is added above it.

Tested: test/setup-user.sh gains the three cases (a linked file stays a link and unchanged, with the line; an unwritable directory is reported and the setup ends normally with nothing half-written; an owner's line with blanks is kept and no second one is added), and test/all passes.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thank you for checking it against the sources, and for pointing me to #727: I hadn't seen it, and I'm glad for den-kloot's find to be credited.

All three are in a second commit (08d5b79):

  1. A hyprland-portals.conf that is a link is left as it is, with a line naming the two lines it lacks.
  2. A file sed -i can't write to is reported and the setup goes on. Nothing stops at that step any more.
  3. An owner's line with blanks around its = counts as theirs, and no second line goes above it.

test/setup-user.sh has a case for each: the link stays a link and unchanged, with its line in the output; an unwritable directory is reported and the script ends normally with nothing half-written; the owner's line with blanks is kept alone. test/all and tools/pr-check origin/main pass.

The phone-smoke report will follow tonight. The palmtop is on the published kernel for a sleep series all day, and I'd rather the report came from its everyday state.

@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, all three are in as I'd hoped, each with its test: the link stays a link, an unwritable file is reported and the setup goes on, and an owner's line with blanks counts as theirs. CI is green on the new head and nothing is open on the code.

Two things are left, both mine. I still owe this a login on my Pixel 7 Pro (the user's file before and after, the file chooser from Chromium, and a permission request), and I'll close #727 with den-kloot's find credited in this commit once that run is done. The phone-smoke report from the palmtop is welcome whenever it comes off its sleep series; it doesn't hold anything up.

On the number: #890 goes in first and keeps 0.2.134, so this one becomes 0.2.135. I'll push that to your branch myself when it's this one's turn, unless you'd rather do it.

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