diff --git a/.chezmoiscripts/run_onchange_after_15-tools.sh.tmpl b/.chezmoiscripts/run_onchange_after_15-tools.sh.tmpl index 26a4551..80d5a28 100644 --- a/.chezmoiscripts/run_onchange_after_15-tools.sh.tmpl +++ b/.chezmoiscripts/run_onchange_after_15-tools.sh.tmpl @@ -55,4 +55,14 @@ fi if [ ! -e "$HOME/.local/bin/strata" ]; then curl -fsSL https://raw.githubusercontent.com/lgse/strata/main/install.sh | bash -s -- --with-desktop-entry --with-file-manager fi + +# System file chooser: strata serves org.freedesktop.impl.portal.FileChooser +# for portal-aware apps (browsers, GTK). --install-portal writes the .portal +# and D-Bus service under ~/.local/share, prepends "strata;" to the +# FileChooser line of ~/.config/xdg-desktop-portal/-portals.conf +# (copied from the system one if absent; strata owns that file, not chezmoi, +# so `strata --uninstall-portal` can restore it), and restarts the portal. +if [ -e "$HOME/.local/bin/strata" ] && [ ! -e "${XDG_DATA_HOME:-$HOME/.local/share}/xdg-desktop-portal/portals/strata.portal" ]; then + "$HOME/.local/bin/strata" --install-portal +fi {{- end }} diff --git a/docs/chezmoi/scripts.mdx b/docs/chezmoi/scripts.mdx index 4938df3..77ebb12 100644 --- a/docs/chezmoi/scripts.mdx +++ b/docs/chezmoi/scripts.mdx @@ -79,9 +79,12 @@ On any other OS the script renders to just the shebang and comments and does not | mise tools | `mise` installed (warning otherwise) | `mise use -g ` for each `packages.shared.mise` entry absent from `mise ls --global --json`, then `mise install `. A tool already in the global config keeps its pinned version. omp and opencode come from here | | old omp binary | `~/.local/bin/omp` is a regular file and `mise which omp` resolves | Deletes it: a copy from omp's own installer (`omp.sh/install`) sits ahead of mise's shims on `PATH` | | strata | Linux, roles `desktop`/`laptop`, no `~/.local/bin/strata` | `curl -fsSL https://raw.githubusercontent.com/lgse/strata/main/install.sh \| bash -s -- --with-desktop-entry --with-file-manager` | +| strata file chooser | Linux, roles `desktop`/`laptop`, `~/.local/bin/strata` exists and `~/.local/share/xdg-desktop-portal/portals/strata.portal` does not | `strata --install-portal` | The strata flags install the binary, `~/.local/share/applications/io.github.lgse.Strata.desktop`, and the `org.freedesktop.FileManager1` D-Bus service in `~/.local/share/dbus-1/services` ("Open file location" from other apps). The folder default (`inode/directory`) comes from the managed `~/.config/mimeapps.list` instead of `--with-folder-association`, because `xdg-mime default` would replace that symlink with a plain file. The installer's own dependency step runs `sudo -n pacman`, which fails without cached credentials, so its runtime packages are declared in `packages.arch.desktop.pacman` and are already present when it runs. +`strata --install-portal` makes strata the system file chooser for portal-aware apps (browsers, GTK file dialogs). It writes `strata.portal` and the `org.freedesktop.impl.portal.desktop.strata` D-Bus service under `~/.local/share`, prepends `strata;` to the `org.freedesktop.impl.portal.FileChooser` line of `~/.config/xdg-desktop-portal/-portals.conf` (on Umbriel `umbriel-portals.conf`, copied from `/usr/share/xdg-desktop-portal/` when absent, so the compositor's backends stay as fallbacks), marks the in-app offer answered (`~/.config/strata/portal-opt-in-v1`), and restarts `xdg-desktop-portal.service`. That config file is strata's, not chezmoi's: `strata --uninstall-portal` restores it. Check: `gdbus call --session --dest org.freedesktop.impl.portal.desktop.strata --object-path /org/freedesktop/portal/desktop --method org.freedesktop.DBus.Properties.Get org.freedesktop.impl.portal.FileChooser version` prints `uint32 4`. Apps that draw their own picker instead of calling the portal are unchanged. + ## 20-gh-extensions [#20-gh-extensions] `.chezmoiscripts/run_onchange_after_20-gh-extensions.sh.tmpl` installs each `packages.shared.gh_extensions` entry on every OS. It is a fish script (`#!/usr/bin/env fish`), so fish sources `~/.config/fish` first: `PATH` (mise, `~/.local/bin`, `~/.cargo/bin`) and `GITHUB_TOKEN` (from `gh auth token` in `conf.d/10-env.fish`) are those of a fish session. It runs after every file is applied and after [15-tools](#15-tools), so the fish config and `~/.cargo/env.fish` exist. diff --git a/docs/desktop/fonts-and-apps.mdx b/docs/desktop/fonts-and-apps.mdx index 91c7dff..1f6a99a 100644 --- a/docs/desktop/fonts-and-apps.mdx +++ b/docs/desktop/fonts-and-apps.mdx @@ -61,7 +61,7 @@ Victor Mono Nerd Font is installed on every role by `run_onchange_before_10-pack | Web links | `x-scheme-handler/http`, `https`, `chrome` | `brave-origin.desktop` | | Browser internals | `x-scheme-handler/about`, `unknown` | `chromium.desktop` | | PDF | `application/pdf` | `brave-origin.desktop` | -| Directories | `inode/directory` | `io.github.lgse.Strata.desktop` ([strata](/chezmoi/scripts#15-tools), which also registers the `org.freedesktop.FileManager1` service for "Open file location") | +| Directories | `inode/directory` | `io.github.lgse.Strata.desktop` ([strata](/chezmoi/scripts#15-tools), which also registers the `org.freedesktop.FileManager1` service for "Open file location" and serves the portal file chooser) | | Mail | `x-scheme-handler/mailto` | `omamail.desktop` | | Windows executables | `application/vnd.microsoft.portable-executable` | `wine.desktop` | | AI tools | `x-scheme-handler/claude` | `com.anthropic.Claude.desktop` |