diff --git a/home_manager/modules/kitty.nix b/home_manager/modules/kitty.nix index 7e35d28..17fe279 100644 --- a/home_manager/modules/kitty.nix +++ b/home_manager/modules/kitty.nix @@ -40,6 +40,8 @@ in "ctrl+shift+t" = "new_tab_with_cwd"; "ctrl+shift+enter" = "new_window_with_cwd"; "ctrl+shift+n" = "new_os_window_with_cwd"; + "ctrl+shift+up" = "previous_window"; + "ctrl+shift+down" = "next_window"; }; font = pkgs.rice.font.monospace; }; diff --git a/home_manager/modules/lf.nix b/home_manager/modules/lf.nix index b52ebf3..152dc8b 100644 --- a/home_manager/modules/lf.nix +++ b/home_manager/modules/lf.nix @@ -1,3 +1,23 @@ +{ pkgs, ... }: +let + lf_kitty_cleaner = pkgs.writeShellScript "lf_kitty_cleaner" '' + kitty +icat --clear --silent --transfer-mode file + ''; + lf_kitty_preview = pkgs.writeShellScript "lf_kitty_preview" '' + file=$1 + w=$2 + h=$3 + x=$4 + y=$5 + + if [[ "$( file -Lb --mime-type "$file")" =~ ^image ]]; then + kitty +icat --silent --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" + exit 1 + fi + + ${pkgs.pistol}/bin/pistol "$file" + ''; +in { programs.lf = { enable = true; @@ -10,5 +30,12 @@ hidden = true; tabstop = 2; }; + previewer = { + source = lf_kitty_preview; + # keybinding = "i"; + }; + extraConfig = '' + set cleaner ${lf_kitty_cleaner} + ''; }; }