yazi only with hotkey

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-09-27 21:42:29 +02:00
parent 5a40c8e1f9
commit f422551ac3
4 changed files with 72 additions and 48 deletions

View File

@@ -91,12 +91,15 @@ lib.mkIf (user != "tv")
if not set -q IN_NIX_SHELL
nxfetch
# yazi
set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
if set -q SESSION_FROM_DE
set -e SESSION_FROM_DE
set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd"
end
rm -f -- "$tmp"
end
rm -f -- "$tmp"
end
'';
functions = {

View File

@@ -385,7 +385,7 @@ lib.mkIf (user != "tv")
"SUPER, R, exec, rofi -show drun"
# "SUPER, T, exec, alacritty"
# "SUPER SHIFT, T, exec, alacritty -e sh -c "ssh nxace""
"SUPER, T, exec, kitty"
"SUPER, T, exec, SESSION_FROM_DE=TRUE kitty"
"SUPER SHIFT, T, exec, kitty -e sh -c 'ssh nxace'"
# "SUPER, Z, "
"SUPER, U, exec, thunderbird "

View File

@@ -1,16 +1,16 @@
{ pkgs, lib, user, rice, ... }:
{ pkgs, lib, system, user, rice, inputs, ... }:
lib.mkIf (user != "tv")
{
home.packages = with pkgs; [
yazi
# yazi
dragon
unar
];
programs.yazi = {
enable = true;
# package = inputs.yazi.packages.${system}.default;
package = inputs.yazi.packages.${system}.default;
enableFishIntegration = true;
settings = {
manager = {
@@ -28,76 +28,96 @@ lib.mkIf (user != "tv")
];
};
opener = {
edit = [
"edit" = [
{ run = ''hx "$@"''; desc = "helix"; block = true;}
{ run = ''codium "$@"''; orphan = true;}
{ run = ''nano "$@"''; desc = "nano"; block = true;}
];
play = [
"play" = [
{ run = ''mpv "$@"''; }
{ run = ''mediainfo "$1"; echo "Press enter to exit"; read''; block = true; desc = "Show mediainfo";}
];
archive = [
"archive" = [
{ run = ''unar "$1"''; desc = "Extract here"; }
{ run = ''tar -x "$1"''; desc = "tar -x"; }
{ run = ''unzip "$1"''; desc = "unzip"; }
];
image = [
"image" = [
{ run = ''imv "$@"''; desc = "imv";}
{ run = ''gimp "$@"''; desc = "gimp";}
{ run = ''swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120 "$@"''; desc = "swww wallpaper";}
];
font = [
{ run = ''fontpreview "$@"''; desc = "fontpreview"; }
"svg" = [
{ run = ''inkscape "$@"''; desc = "inkscape";}
{ run = ''firefoc "$@"''; desc = "firefox";}
];
document = [
"font" = [
{ run = ''fontpreview "$@"''; desc = "fontpreview"; }
{ run = ''fontforge "$@"''; desc = "fortforge"; }
];
"document" = [
{ run = ''zathura "$@"''; desc = "zathura"; }
{ run = ''xournal "$@"''; desc = "xournal"; }
{ run = ''firefox "$@"''; desc = "firefox"; }
];
browser = [
"browser" = [
{ run = ''firefox "$@"''; desc = "firefox"; }
{ run = ''zen "$@"''; desc = "zen"; }
{ run = ''chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"''; desc = "chromium"; }
{ run = ''w3m "$@"''; desc = "w3m"; }
{ run = ''lynx "$@"''; desc = "lynx"; }
];
office = [
"office" = [
{ run = ''libreoffice "$@"''; desc = "libreoffice"; }
{ run = ''libreoffice --view "$@"''; desc = "libreoffice read-only"; }
];
shell = [
{ run = ''sh -c "$@"''; desc = "sh -c"; }
"shell" = [
{ run = ''bash -c "$@"''; desc = "bash -c"; }
{ run = ''fish -c "$@"''; desc = "fish -c"; }
{ run = ''sh -c "$@"''; desc = "sh -c"; }
];
python = [
"python" = [
{ run = ''python "$@"''; desc = "python"; }
];
"directory" = [
{ run = ''lazygit "$@"''; desc = "python"; }
];
};
open.rules = [
{ mime = "text/*"; use = "edit"; }
{ mime = "text/plain"; use = "edit"; }
{ mime = "text/html"; use = ["edit" "browser"]; }
{ mime = "text/htm"; use = ["edit" "browser"]; }
{ mime = "application/x-httpd-php"; use = ["edit" "browser"]; }
{ mime = "application/json"; use = "edit"; }
{ mime = "application/ld+json"; use = "edit"; }
{ mime = "image/*"; use = "image"; }
{ mime = "image/svg"; use = ["image" "edit"]; }
{ mime = "application/pdf"; use = "document"; }
{ mime = "application/epub"; use = "document"; }
{ mime = "video/*"; use = "video"; }
{ mime = "application/vnd.oasis.opendocument.*"; use = "office"; }
{ mime = "application/vnd.ms-powerpoint"; use = "office"; }
{ mime = "application/vnd.ms-excel"; use = "office"; }
{ mime = "text/html"; use = ["edit" "browser"]; }
{ mime = "text/htm"; use = ["edit" "browser"]; }
{ mime = "text/x-python"; use = "python"; }
{ mime = "text/*"; use = "edit"; }
{ mine = "inode/x-empty"; use = "edit"; }
{ mine = "inode/directory"; use = "edit"; }
{ mime = "image/*"; use = "image"; }
{ mime = "image/svg"; use = ["image" "edit"]; }
{ mime = "video/*"; use = "video"; }
{ mime = "application/x-httpd-php"; use = ["edit" "browser"]; }
{ mime = "application/json"; use = "edit"; }
{ mime = "application/ld+json"; use = "edit"; }
{ mime = "application/pdf"; use = "document"; }
{ mime = "application/epub"; use = "document"; }
{ mime = "application/vnd.oasis.opendocument.*"; use = "office"; }
{ mime = "application/vnd.ms-powerpoint"; use = "office"; }
{ mime = "application/vnd.ms-excel"; use = "office"; }
{ mime = "application/vnd.openxmlformats-officedocument.*"; use = ["office" "edit"]; }
{ mime = "application/rtf"; use = "office"; }
{ mime = "application/x-sh"; use = ["edit" "shell"]; }
{ mime = "application/x-python-code"; use = "python"; }
{ mime = "text/x-python"; use = "python"; }
{ mime = "application/xml"; use = "edit"; }
{ mime = "application/xul"; use = "edit"; }
{ mime = "application/x-bzip"; use = "archive"; }
{ mime = "application/x-bzip2"; use = "archive"; }
{ mime = "application/gzip"; use = "archive"; }
{ mime = "application/vnd.rar"; use = "archive"; }
{ mime = "application/x-tar"; use = "archive"; }
{ mime = "application/zip"; use = "archive"; }
{ mime = "application/x-7z-compressed"; use = "archive"; }
{ mime = "application/rtf"; use = "office"; }
{ mime = "application/x-sh"; use = ["edit" "shell"]; }
{ mime = "application/x-python-code"; use = "python"; }
{ mime = "application/xml"; use = "edit"; }
{ mime = "application/xul"; use = "edit"; }
{ mime = "application/x-bzip"; use = "archive"; }
{ mime = "application/x-bzip2"; use = "archive"; }
{ mime = "application/gzip"; use = "archive"; }
{ mime = "application/vnd.rar"; use = "archive"; }
{ mime = "application/x-tar"; use = "archive"; }
{ mime = "application/zip"; use = "archive"; }
{ mime = "application/x-7z-compressed"; use = "archive"; }
];
};
theme = with rice.color; {