Skip to content

Desktop Integration

ilyamiro edited this page Nov 2, 2026 · 1 revision

Ski can take three roles in a desktop session besides being an application:

Role Who asks for it Mechanism
Default file manager Any program that opens a folder The inode/directory MIME handler
"Show in folder" service Browsers, download managers The D-Bus service org.freedesktop.FileManager1
System file dialog Programs that use the xdg-desktop-portal ("Open", "Save as") The portal interface org.freedesktop.impl.portal.FileChooser

On NixOS

The NixOS module sets up all three. It:

  • sets inode/directory to ski.desktop;
  • adds Ski's D-Bus services;
  • adds Ski as an xdg-desktop-portal backend and selects it for org.freedesktop.impl.portal.FileChooser;
  • sets GTK_USE_PORTAL=1, so GTK 3 programs ask the portal.

Log out and in after nixos-rebuild switch.

With home-manager's xdg.portal

home-manager's xdg.portal writes ~/.config/xdg-desktop-portal/portals.conf, which takes precedence over the system file, and points NIX_XDG_DESKTOP_PORTAL_DIR at the per-user profile, which does not contain ski.portal. The dialogs then stay GTK's. Add Ski to the home-manager configuration as well:

xdg.portal = {
  enable = true;
  # osConfig is the NixOS configuration; add `osConfig` to the module arguments
  extraPortals = [ pkgs.xdg-desktop-portal-gtk osConfig.programs.ski.package ];
  config.common = {
    default = "*";
    "org.freedesktop.impl.portal.FileChooser" = "ski";
  };
};

On other distributions

The .deb, .rpm and .tar.gz packages install the needed files. After a Cargo install, copy them from assets/ in a checkout:

File Destination Change
ski.portal /usr/share/xdg-desktop-portal/portals/ none
org.freedesktop.impl.portal.desktop.ski.service /usr/share/dbus-1/services/ replace @out@ with the install prefix, for example /usr
org.freedesktop.FileManager1.service /usr/share/dbus-1/services/ replace @out@ with the install prefix

Then select Ski as the file dialog in ~/.config/xdg-desktop-portal/portals.conf:

[preferred]
org.freedesktop.impl.portal.FileChooser=ski

ski.portal also lists the desktops it serves in its UseIn= line. When several installed portals offer a file dialog, the one named in portals.conf is used, so this line is what selects Ski.

To make Ski the default file manager:

xdg-mime default ski.desktop inode/directory

Log out and in afterwards.

Programs and the portal

A program shows Ski's dialog only if it asks the portal for one.

Program Setting
GTK 3 programs GTK_USE_PORTAL=1 in the session environment
Firefox widget.use-xdg-desktop-portal.file-picker = 1 in about:config (on NixOS: programs.firefox.preferences)
Chromium and its derivatives --enable-features=UseXdgDesktopPortal, unless the build already uses it
Programs with a dialog of their own Keep their dialog

The file dialog

Ski as a save dialog

The dialog is a Ski window with a file name field and a confirm button at the bottom. It has four modes:

Mode Purpose Result
Open Choose one or more existing files The chosen files
Folder Choose an existing folder The folder
Save Name one new file The path of the new file
Save files Choose the folder that several named files go into The folder

Rules of the dialog:

  • It browses and chooses only. It does not move, rename or delete files. It can create a folder in Save and Folder mode.
  • Saving over an existing file asks for confirmation for each file.
  • Typing the name of a folder in the file name field and pressing Enter opens that folder.
  • Filters given by the program (*.png, image/*) apply to the listing. MIME filters use the system's shared-mime-info database.
  • It starts in the folder the same program last chose something in.
  • It closes when the program withdraws the request.
  • It keeps its own list or grid choice, separate from the main window's.

Window placement

On Wayland the dialog attaches itself to the window of the program that asked (xdg-foreign). Compositors then float it and center it on that window, as they do for GTK dialogs. On X11 it is centered. When the program gives no window, the dialog has a fixed size, which most compositors float and center.

It opens at the size it had when last closed, 760×520 the first time. Its app id is ski-chooser. If a tiling compositor tiles it, add a rule. For sway:

for_window [app_id="ski-chooser"] floating enable, move position center

"Show in folder"

When a browser asks the org.freedesktop.FileManager1 service to show a file, Ski opens the file's folder with the file selected. D-Bus starts Ski for this when it is not running.

Clone this wiki locally