From 5aab80e92ddd68553d13464d80545b8b18977250 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 5 Apr 2024 01:26:38 +0200 Subject: [PATCH] Add ranger (terminal filemgr) --- .../terminal/file-managers/default.nix | 1 + .../terminal/file-managers/ranger.nix | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 home/programs/terminal/file-managers/ranger.nix diff --git a/home/programs/terminal/file-managers/default.nix b/home/programs/terminal/file-managers/default.nix index f6ad61e..342ecf0 100644 --- a/home/programs/terminal/file-managers/default.nix +++ b/home/programs/terminal/file-managers/default.nix @@ -7,6 +7,7 @@ _: { ./yazi ./xplr ./vifm + ./ranger.nix ]; } diff --git a/home/programs/terminal/file-managers/ranger.nix b/home/programs/terminal/file-managers/ranger.nix new file mode 100644 index 0000000..59a2a73 --- /dev/null +++ b/home/programs/terminal/file-managers/ranger.nix @@ -0,0 +1,25 @@ +{ + pkgs, + lib, + osConfig, + config, + ... +}: let + device = osConfig.modules.device; + # TODO: maybe not have a TUI file manager on desktops, when GUI does it better + acceptedTypes = ["laptop" "desktop" "hybrid" "server" "lite"]; + inherit (lib.strings) optionalString; +in { + config = lib.mkIf (builtins.elem device.type acceptedTypes) { + home.packages = with pkgs; [ + ranger + ]; + + # TODO: more file preview methods + xdg.configFile."ranger/rc.conf".text = '' + set preview_images true + ${(optionalString config.programs.kitty.enable "set preview_images_method kitty")} + ''; + }; +} +