Skip to content

Expand Nautilus into usage as file picker in Open/Save dialog (provides space to preview)#6019

Open
tyvsmith wants to merge 2 commits into
basecamp:devfrom
tyvsmith:file-picker-gnome-portal
Open

Expand Nautilus into usage as file picker in Open/Save dialog (provides space to preview)#6019
tyvsmith wants to merge 2 commits into
basecamp:devfrom
tyvsmith:file-picker-gnome-portal

Conversation

@tyvsmith
Copy link
Copy Markdown
Contributor

@tyvsmith tyvsmith commented Jun 2, 2026

Summary

  • Routes the org.freedesktop.impl.portal.FileChooser portal interface to xdg-desktop-portal-gnome so Open/Save dialogs use the Nautilus-style file picker (sidebar, preview, modern layout) instead of the basic GtkFileChooser shown by xdg-desktop-portal-gtk.
  • Other portal interfaces (screenshot, screencast, settings, etc.) continue to be served by hyprland and gtk — the override is scoped to FileChooser only.

What changed

File Change
install/omarchy-base.packages Adds xdg-desktop-portal-gnome
config/xdg-desktop-portal/hyprland-portals.conf New file with the FileChooser override (copied to ~/.config/ by the existing install/config/config.sh)
migrations/1780365321.sh Installs the package, copies the portal config, restarts xdg-desktop-portal for existing users

Why

The current default — xdg-desktop-portal-gtk handling FileChooser — gives the legacy GtkFileChooser dialog: no sidebar, no space to preview, single-column file list. This is jarring next to Nautilus, which is already Omarchy's default file manager and which the floating-window rule at default/hypr/apps/system.lua:3 already expects to see for save/open dialogs.

xdg-desktop-portal-gnome launches Nautilus itself as the picker (verified via hyprctl clients: the picker window's class is org.gnome.Nautilus, matching the existing floating-window rule), so no Hyprland rule changes are needed.

Trade-offs

  • Adds xdg-desktop-portal-gnome as an explicit dep. It pulls gnome-desktop-4 and libadwaita; most of its other deps (nautilus, gtk4, gdk-pixbuf2) are already installed via Omarchy's base set.
  • Behavior change for existing users — the migration handles the transition automatically.

Test plan

  • Fresh install: confirm xdg-desktop-portal-gnome is pulled in and ~/.config/xdg-desktop-portal/hyprland-portals.conf is in place
  • Trigger a file picker from Chromium / Firefox / Discord — confirm the Nautilus-style picker appears with sidebar and preview
  • Existing install: run the migration and confirm the picker swap takes effect after the portal restart (no logout required)
  • Confirm screenshot / screencast portals still work (still routed to hyprland)
  • Active use -- Have run configuration for 3 months
screenshot-2026-06-01_19-41-07

Routes the FileChooser portal to xdg-desktop-portal-gnome so file
dialogs use the Nautilus-style picker with sidebar and preview
instead of the basic GtkFileChooser shown by xdg-desktop-portal-gtk.
Other portal interfaces continue to be served by hyprland and gtk.
@tyvsmith tyvsmith changed the title Use GNOME file picker portal for previews in Open/Save dialogs Use Nautilus as file picker in Open/Save dialogs via replacing GTK with Gnome portal Jun 2, 2026
@tyvsmith tyvsmith changed the title Use Nautilus as file picker in Open/Save dialogs via replacing GTK with Gnome portal Expand Nautilus into usage as file picker in Open/Save dialogs Jun 2, 2026
@tyvsmith tyvsmith marked this pull request as ready for review June 2, 2026 02:38
Copilot AI review requested due to automatic review settings June 2, 2026 02:38
@tyvsmith tyvsmith changed the title Expand Nautilus into usage as file picker in Open/Save dialogs Expand Nautilus into usage as file picker in Open/Save dialog (provides space to preview) Jun 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR configures Hyprland setups to use the GNOME portal implementation specifically for the FileChooser interface (to enable previews in Open/Save dialogs), while keeping other portals preferred as Hyprland/GTK.

Changes:

  • Adds a migration script that installs xdg-desktop-portal-gnome, writes portal config, and restarts the user portal service
  • Adds xdg-desktop-portal-gnome to the base package list
  • Introduces an xdg-desktop-portal config file to prefer GNOME for FileChooser

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
migrations/1780365321.sh Installs GNOME portal, copies portal config into user config dir, restarts portal service
install/omarchy-base.packages Ensures GNOME portal is included by default for fresh installs
config/xdg-desktop-portal/hyprland-portals.conf Sets portal backend preferences, forcing FileChooser to GNOME

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1780365321.sh
Comment on lines +1 to +8
echo "Use GNOME file picker portal for previews in Open/Save dialogs"

omarchy-pkg-add xdg-desktop-portal-gnome

mkdir -p ~/.config/xdg-desktop-portal
cp $OMARCHY_PATH/config/xdg-desktop-portal/hyprland-portals.conf ~/.config/xdg-desktop-portal/

systemctl --user restart xdg-desktop-portal
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applying this one — it conflicts with the established convention for omarchy migrations.

  • Shebang: Migrations are never executed directly. omarchy-migrate runs each one with bash "$file", so a #!/usr/bin/env bash line would be inert. 311 of the 313 existing migrations have no shebang.
  • Strict mode: Exactly one existing migration uses set -e, and none use set -euo pipefail. Failure handling is already centralized in the runner: if a migration exits non-zero, omarchy-migrate catches it and offers a gum confirm "Skip and continue?" prompt. Adding set -euo pipefail to a single migration would diverge from the whole corpus and change failure semantics inconsistently.

(The SC2148 shellcheck warning that prompted this fires on every migration in the repo and is intentionally ignored.)

Comment thread migrations/1780365321.sh Outdated
omarchy-pkg-add xdg-desktop-portal-gnome

mkdir -p ~/.config/xdg-desktop-portal
cp $OMARCHY_PATH/config/xdg-desktop-portal/hyprland-portals.conf ~/.config/xdg-desktop-portal/
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 646db06. Replaced the manual mkdir -p + cp with the idiomatic omarchy-refresh-config xdg-desktop-portal/hyprland-portals.conf, which quotes its paths internally — so there is no longer an unquoted $OMARCHY_PATH in the migration.

Comment thread migrations/1780365321.sh Outdated
Comment on lines +5 to +6
mkdir -p ~/.config/xdg-desktop-portal
cp $OMARCHY_PATH/config/xdg-desktop-portal/hyprland-portals.conf ~/.config/xdg-desktop-portal/
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 646db06. Switched to omarchy-refresh-config, which is omarchy's standard helper for this. Before overwriting it writes a timestamped backup (hyprland-portals.conf.bak.<epoch>), diffs old vs new, and only keeps the backup if the file actually changed — so a user with local customizations keeps a copy rather than losing them silently.

Comment thread migrations/1780365321.sh
mkdir -p ~/.config/xdg-desktop-portal
cp $OMARCHY_PATH/config/xdg-desktop-portal/hyprland-portals.conf ~/.config/xdg-desktop-portal/

systemctl --user restart xdg-desktop-portal
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applying this one.

  • Restarting only xdg-desktop-portal is correct. The org.freedesktop.impl.portal.FileChooser = gnome preference is read by the frontend xdg-desktop-portal service, which then dispatches to backends. The GNOME backend is D-Bus–activated on demand, so restarting the frontend is sufficient to pick up the new routing — restarting xdg-desktop-portal-gnome itself is unnecessary. This matches the existing portal-config migration migrations/1763478660.sh, which restarts only xdg-desktop-portal-hyprland for the same reason.
  • try-restart vs restart: During omarchy-migrate the portal is already running inside the live graphical session, so the two behave identically here — and plain restart additionally (re)starts it if needed, which is the desired outcome. No migration in the repo uses try-restart; plain systemctl --user restart is the established pattern.
  • "No user systemd session" case: doesn't apply — omarchy is a systemd/uwsm/Hyprland session and migrations run within it.

Replaces the manual mkdir -p + cp with the idiomatic omarchy-refresh-config
helper, which creates the target dir, quotes paths, and makes a timestamped
backup before overwriting so any existing user customizations are preserved.

Addresses Copilot review feedback on PR basecamp#6019.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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