use xdg-open as fallback for opening files

use xdg-open for opening everything
This commit is contained in:
Adithya 2024-05-16 00:07:16 +05:30
parent cafd19c97e
commit 1b8649f6fc
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C

View file

@ -1,4 +1,4 @@
{ config, ... }: { { config, pkgs, ... }: {
programs = { programs = {
fd = { fd = {
enable = true; enable = true;
@ -19,24 +19,22 @@
image_quality = 90; image_quality = 90;
}; };
opener = { opener = {
open-image = [
{ run = "${config.programs.imv.package}/bin/imv-dir $0"; orphan = true; }
];
edit-text = [ edit-text = [
{ run = "${config.programs.neovim.package}/bin/nvim $0"; block = true; } { run = "${config.programs.neovim.package}/bin/nvim $0"; block = true; }
]; ];
play = [
{ run = "${config.programs.mpv.package}/bin/mpv $0"; orphan = true; }
];
terminal = [ terminal = [
{ run = "${config.programs.kitty.package}/bin/kitty --class=yazi -d=$0"; orphan = true; } { run = "${config.programs.kitty.package}/bin/kitty --class=yazi -d=$0"; orphan = true; }
]; ];
open = [
{ run = "${pkgs.xdg-utils}/bin/xdg-open $0"; orphan = true; }
];
}; };
open.rules = [ open.rules = [
{ mime = "image/*"; use = "open-image"; }
{ mime = "text/*"; use = [ "edit-text" ]; } { mime = "text/*"; use = [ "edit-text" ]; }
{ mime = "video/*"; use = [ "play" ]; } { mime = "application/json"; use = [ "edit-text" ]; }
{ mime = "inode/directory"; use = [ "terminal" ]; } { mime = "inode/directory"; use = [ "terminal" ]; }
{ mime = "*"; use = [ "open" ]; }
{ name = "*"; use = [ "open" ]; }
]; ];
}; };
}; };