Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/omamobile-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ afterwards.

## File dialogs

Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron and Flatpak apps alike) get Nautilus's libadwaita file chooser from xdg-desktop-portal-gnome, not xdg-desktop-portal-gtk's GTK 3 desktop chooser, whose Places sidebar took half of the 480 px width. Nautilus's chooser folds its sidebar away at phone width and has touch-sized rows; `hypr/phone.lua` tiles it, even when it has a parent window, so it fills the screen between the bar and the on-screen keyboard. Only FileChooser goes to the gnome backend: its other interfaces need gnome-shell. It runs without gnome-shell (its Mutter service channel is missing, so it falls back to a plain Wayland connection). xdg-desktop-portal-gtk stays as the fallback and for its other interfaces. GTK apps that would draw their own chooser in-process are sent to the portal too (`GTK_USE_PORTAL=1` for GTK 3, `GDK_DEBUG=portals` for GTK 4, in `environment.d/20-omamobile-osk.conf`); Qt Widgets apps keep Omarchy's `QT_QPA_PLATFORMTHEME=gtk3` for now.
Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron and Flatpak apps alike) get Nautilus's libadwaita file chooser from xdg-desktop-portal-gnome, not xdg-desktop-portal-gtk's GTK 3 desktop chooser, whose Places sidebar took half of the 480 px width. Nautilus's chooser folds its sidebar away at phone width and has touch-sized rows; `hypr/phone.lua` tiles it, even when it has a parent window, so it fills the screen between the bar and the on-screen keyboard. Only FileChooser goes to the gnome backend: its other interfaces need gnome-shell. It runs without gnome-shell (its Mutter service channel is missing, so it falls back to a plain Wayland connection). xdg-desktop-portal-gtk stays as the fallback and for its other interfaces. Omarchy's Secret-portal migration writes the user's own `~/.config/xdg-desktop-portal/hyprland-portals.conf`, whose `default=hyprland;gtk` would hide these picks, so `omamobile-setup-user` adds the phone's lines that file doesn't name yet at each login (a line the user set stays). GTK apps that would draw their own chooser in-process are sent to the portal too (`GTK_USE_PORTAL=1` for GTK 3, `GDK_DEBUG=portals` for GTK 4, in `environment.d/20-omamobile-osk.conf`); Qt Widgets apps keep Omarchy's `QT_QPA_PLATFORMTHEME=gtk3` for now.

## Windows on a phone screen

Expand Down
29 changes: 29 additions & 0 deletions packages/omamobile-shell/bin/omamobile-setup-user
Original file line number Diff line number Diff line change
Expand Up @@ -729,3 +729,32 @@ fi
# installer, so run Omarchy's own script: it creates only what is missing.
keyring=${OMARCHY_PATH:-/usr/share/omarchy}/install/user/default-keyring.sh
if [[ -f $keyring ]]; then bash "$keyring"; fi

# The phone's portal picks (the permission sheet for Access, Nautilus's
# chooser for FileChooser) are in /etc/xdg/xdg-desktop-portal/
# hyprland-portals.conf. Omarchy's migration 1788261467 (the Secret portal)
# writes ~/.config/xdg-desktop-portal/hyprland-portals.conf with its own
# default=hyprland;gtk, and xdg-desktop-portal goes by the first file that
# answers: from then on file dialogs were GTK 3's desktop chooser, which
# Hyprland squeezed to the screen (623 px into 405 on the Pixel 9a, text drawn
# tall and narrow), and the permission question GTK's dialog. Every login,
# since the migration can come with any update: the user's file gets each of
# the phone's lines whose interface it doesn't name yet. One the user set
# stays as it is.
portals=${OMAMOBILE_PORTALS_CONF:-/etc/xdg/xdg-desktop-portal/hyprland-portals.conf}
user_portals=${XDG_CONFIG_HOME:-$HOME/.config}/xdg-desktop-portal/hyprland-portals.conf
if [[ -f $portals && -f $user_portals ]]; then
added=
while IFS= read -r line; do
grep -q "^${line%%=*}=" "$user_portals" && continue
if [[ -z $added ]]; then
[[ -z $(tail -c1 "$user_portals") ]] || echo >>"$user_portals"
echo "# Omarchy Mobile (omamobile-setup-user): the phone's picks from $portals" >>"$user_portals"
fi
echo "$line" >>"$user_portals"
added=1
done < <(grep -E '^org\.freedesktop\.impl\.portal\.[A-Za-z]+=' "$portals")
if [[ -n $added ]]; then
systemctl --user try-restart xdg-desktop-portal.service 2>/dev/null || true
fi
fi
20 changes: 20 additions & 0 deletions packages/omamobile-shell/test/setup-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ run() {
OMAMOBILE_VOICE_MODELS="${RUN_VOICE_MODELS:-$t/no-voice-models}" OMAMOBILE_VOXTYPE="${RUN_VOXTYPE:-voxtype}" \
OMARCHY_PATH="${RUN_OMARCHY_PATH:-$t/omarchy}" \
OMAMOBILE_USER_UNITS="${RUN_USER_UNITS:-$t/no-user-units}" \
OMAMOBILE_PORTALS_CONF="$pkg/portal/hyprland-portals.conf" \
bash bin/omamobile-setup-user "$@" >"$t/out" 2>&1 || { cat "$t/out"; fail "omamobile-setup-user runs"; }
}
run
Expand Down Expand Up @@ -484,3 +485,22 @@ for gliff in no yes; do
done
rm -f "$F/gliff-server"
pass "Omarchy's remote session is off on every phone, once, with or without gliff, and a user can turn it back on"

# Omarchy's Secret-portal migration writes the user's own hyprland-portals.conf,
# which hides the phone's in /etc. Each login adds the phone's lines the file
# doesn't name yet, once, restarts the portal only then, and keeps the user's own.
hp=$t/portals; mkdir -p "$hp/.config/hypr" "$hp/.config/xdg-desktop-portal"; cp "$H"/.config/hypr/*.lua "$hp/.config/hypr/"
up=$hp/.config/xdg-desktop-portal/hyprland-portals.conf
printf '[preferred]\ndefault=hyprland;gtk\norg.freedesktop.impl.portal.Secret=gnome-keyring\n' >"$up"
RUN_HOME=$hp run; RUN_HOME=$hp run
grep -qx 'org.freedesktop.impl.portal.FileChooser=gnome;gtk' "$up" || fail "the user's portals file gets the phone's file chooser"
grep -qx 'org.freedesktop.impl.portal.Access=omamobile;gtk' "$up" || fail "the user's portals file gets the phone's permission sheet"
grep -qx 'org.freedesktop.impl.portal.Secret=gnome-keyring' "$up" || fail "Omarchy's Secret line stays"
[[ $(grep -c '^org.freedesktop.impl.portal.FileChooser=' "$up") == 1 ]] || fail "two logins add the file chooser once"
[[ $(grep -c 'try-restart xdg-desktop-portal' "$hp/calls") == 1 ]] || fail "the portal restarts once, when lines were added"
sed -i 's|^org.freedesktop.impl.portal.FileChooser=.*|org.freedesktop.impl.portal.FileChooser=gtk|' "$up"
RUN_HOME=$hp run
grep -qx 'org.freedesktop.impl.portal.FileChooser=gtk' "$up" || fail "a file chooser the user picked stays"
[[ $(grep -c '^org.freedesktop.impl.portal.FileChooser=' "$up") == 1 ]] || fail "a user's own file chooser line isn't joined by the phone's"
[[ ! -e $H/.config/xdg-desktop-portal/hyprland-portals.conf ]] || fail "without a user portals file none is made"
pass "the user's portals file (Omarchy's Secret migration) gets the phone's file chooser and permission sheet, once"
2 changes: 1 addition & 1 deletion packages/omamobile-shell/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.127
0.2.128