added yazi as filechooser for xdg, and added override for some

conflicted package
This commit is contained in:
Prouk committed 2026-10-23 15:18:56 +02:00
1 parent fd79c661a1
commit 24216aca9d
9 files changed
+93 -16

No files matched your search

+3
View File
@@ -47,6 +47,9 @@ environment {
// Electron/Chromium: Automatically flags apps (VS Code, Discord, Obsidian) to use Wayland.
ELECTRON_OZONE_PLATFORM_HINT "auto"
// GTK: Route file dialogs through the XDG portal (yazi file picker).
GDK_DEBUG "portals"
// =========================================================================
// 5. DESKTOP SESSION IDENTIFICATION
// =========================================================================
+1
View File
@@ -16,6 +16,7 @@ binds {
Mod+Down { focus-workspace-down; }
Mod+R { switch-preset-column-width; }
Mod+Shift+R { switch-preset-column-width-back; }
Mod+Ctrl+R { reset-window-height; }
+1 -1
View File
@@ -7,7 +7,7 @@ layout {
preset-column-widths {
proportion 0.33333
proportion 0.5
proportion 0.66667
proportion 1.0
}
default-column-width { proportion 0.5; }
+7
View File
@@ -3,6 +3,13 @@ window-rule {
open-floating true
}
window-rule {
match title="^termfilechooser$"
open-floating true
default-column-width { proportion 0.6; }
default-window-height { proportion 0.6; }
}
window-rule {
geometry-corner-radius 12
clip-to-geometry true
+1
View File
@@ -4,6 +4,7 @@
imports = [
./shell.nix
./dotfiles.nix
./portal.nix
./packages
];
+5 -1
View File
@@ -34,6 +34,10 @@ in
programs.zen-browser = {
enable = true;
setAsDefaultBrowser = true;
profiles.default.sine.enable = true;
profiles.default = {
sine.enable = true;
# Use the XDG portal (yazi, see home/portal.nix) for file dialogs.
settings."widget.use-xdg-desktop-portal.file-picker" = 1;
};
};
}
+53
View File
@@ -0,0 +1,53 @@
{ pkgs, config, ... }:
let
termfilechooser = pkgs.xdg-desktop-portal-termfilechooser;
in
{
# Use yazi (in alacritty) as the file picker for every app that goes through
# the XDG FileChooser portal.
#
# Portal/D-Bus files are found through XDG_DATA_DIRS (user profile), so we
# deliberately don't enable HM's `xdg.portal`: it would point
# NIX_XDG_DESKTOP_PORTAL_DIR at the user profile only and hide the
# system-wide gnome/gtk portals that niri relies on.
home.packages = [ termfilechooser ];
# The D-Bus activation file references this unit by name, and HM doesn't
# link `share/systemd/user` from packages.
systemd.user.services.xdg-desktop-portal-termfilechooser = {
Unit = {
Description = "Portal service (terminal file chooser implementation)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.impl.portal.desktop.termfilechooser";
ExecStart = "${termfilechooser}/libexec/xdg-desktop-portal-termfilechooser";
Environment = [ "PATH=${config.home.profileDirectory}/bin:/run/current-system/sw/bin" ];
Restart = "on-failure";
Slice = "session.slice";
};
};
xdg.configFile = {
# Overrides niri's shipped niri-portals.conf, so its entries are repeated here.
"xdg-desktop-portal/niri-portals.conf".text = ''
[preferred]
default=gnome;gtk;
org.freedesktop.impl.portal.Access=gtk;
org.freedesktop.impl.portal.Notification=gtk;
org.freedesktop.impl.portal.Secret=gnome-keyring;
org.freedesktop.impl.portal.FileChooser=termfilechooser;
'';
"xdg-desktop-portal-termfilechooser/config".text = ''
[filechooser]
cmd=${termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh
default_dir=$HOME
env=TERMCMD=alacritty --title termfilechooser -e
open_mode=suggested
save_mode=suggested
'';
};
}