feat(mc): open files with their configured app via xdg-open

Ship `mc.ext.ini` as the `local.mc.extIni` option (like `local.mc.menu`):
Enter browses archives in-place as before and delegates every other type to
`xdg-open`. Add public `mime.nix` with `xdg.mimeApps` defaults (pdf ->
zathura, images -> imv, audio/video -> mpv, office -> libreoffice) -- public
because those handlers are; personal browser/mail defaults stay private.

Also document, at the Hyprland swallow config, how swallowing differs from an
app opening fullscreen/maximized (LibreOffice restores its own maximized state
and looks swallowed but isn't).
This commit is contained in:
2026-07-12 22:09:01 +02:00
parent 7205841c4d
commit 4be1c4fb67
4 changed files with 196 additions and 6 deletions
+20 -2
View File
@@ -81,7 +81,7 @@ let
'';
in
{
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ./mc.nix ];
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ./mc.nix ./mime.nix ];
# Put ~/.local/bin (the XDG user-bin dir) on PATH so hand-dropped scripts run
# by name without wiring each through nix.
@@ -521,7 +521,25 @@ in
# Matches on the *parent* terminal's class. Needs standalone foot: in
# server/client mode all windows share one process, so PID ancestry can't
# tell them apart and swallowing breaks — that's why $mod+Return runs
# `foot`, not `footclient`.
# `foot`, not `footclient`. Swallow is decided by getSwallower() walking
# the new window's parent-PID chain (up to 25 hops) for a window whose
# class matches swallow_regex; swallow_exception_regex, if set, matches the
# *terminal's title*, not the new window's class (a common misreading).
#
# Do NOT confuse swallowing with an app opening fullscreen/maximized — they
# look identical (the launching terminal vanishes) but are different things:
# - real swallow removes the terminal from the layout and restores it only
# when the swallower closes; you cannot un-swallow a live window.
# - a fullscreen/maximized app merely covers the workspace; the launcher
# is still a tile underneath and $mod+f / $mod SHIFT f toggles it back.
# `hyprctl clients` is decisive: a real swallow shows the terminal
# hidden=true and the new window swallowing!=0x0. LibreOffice trips this —
# it restores its own maximized state on open (from mc or a shell), so a
# document appears to "swallow" mc when it is only fullscreen. And being
# single-instance (one soffice.bin owns every window via IPC handoff), when
# it genuinely does swallow, that is fixed by whatever launched its daemon,
# not per-open — so it can't do the tile-from-mc / swallow-from-shell split
# that single-process handlers like zathura/imv get for free.
enable_swallow = true;
swallow_regex = "^(foot)$";
};