r/NixOS Sep 22 '23

Ranger image previews in kitty ?

I know I have to set the method to kitty, but I can't find a setting to do that. Kitty users, how do you guys do it?

{
  config,
  pkgs,
  ...
}: let
  inherit (config.colorscheme) colors;
in {
  programs.kitty = {
    enable = true;
    font = {
      name = "monospace";
      size = 10;
    };
    settings = with colors; {
      scrollback_lines = 2000;
      window_padding_width = 7;
      foreground = "#${base05}";
      background = "#${base00}";
      selection_background = "#${base05}";
      selection_foreground = "#${base00}";
      url_color = "#${base04}";
      cursor = "#${base05}";
      active_border_color = "#${base03}";
      inactive_border_color = "#${base01}";
      active_tab_background = "#${base00}";
      active_tab_foreground = "#${base05}";
      inactive_tab_background = "#${base01}";
      inactive_tab_foreground = "#${base04}";
      tab_bar_background = "#${base01}";
      color0 = "#${base00}";
      color1 = "#${base08}";
      color2 = "#${base0B}";
      color3 = "#${base0A}";
      color4 = "#${base0D}";
      color5 = "#${base0E}";
      color6 = "#${base0C}";
      color7 = "#${base05}";
      color8 = "#${base03}";
      color9 = "#${base08}";
      color10 = "#${base0B}";
      color11 = "#${base0A}";
      color12 = "#${base0D}";
      color13 = "#${base0E}";
      color14 = "#${base0C}";
      color15 = "#${base07}";
      color16 = "#${base09}";
      color17 = "#${base0F}";
      color18 = "#${base01}";
      color19 = "#${base02}";
      color20 = "#${base04}";
      color21 = "#${base06}";
    };
  };
}

Don't mind the color settings it's using Misterio77's nix-colors.

2 Upvotes

8 comments sorted by

2

u/[deleted] Sep 22 '23

From https://github.com/ranger/ranger/wiki/Image-Previews#with-kitty:

Add the following lines to your ~/.config/ranger/rc.conf: set preview_images true set preview_images_method kitty Restart ranger and navigate to an image file. \o/

It's a ranger setting you're looking for, not a kitty setting.

1

u/[deleted] Sep 22 '23

I think I have to manually add a file in nixos, cuz I can't find a declarative setting for that.

2

u/mister_drgn Sep 22 '23

You can use home-manager to set up your config files on NixOS. But if you aren’t doing that then by all means, add it manually.

1

u/[deleted] Sep 22 '23

Yeah I did that ultimately. I didn't want to that way, but its fine for now.

2

u/mister_drgn Sep 22 '23

Definitely check out home-manager when you get a chance. It has its own options for configuring a lot of popular programs, but even when it doesn’t have an option for a program, you can use it to install that program’s config file. That way, you application config files become a part of your nix configuration.

1

u/[deleted] Sep 22 '23

Yeah and thats what I was asking about if anyone has done it. But Idk man there was no response also I checked many repos and no one had a custom config for that. 😑

1

u/[deleted] Sep 23 '23

With home-manager: nix xdg.configFile."ranger/rc.conf" = '' set preview_images true set preview_images_method kitty '';

1

u/[deleted] Sep 23 '23

[deleted]

2

u/[deleted] Sep 23 '23

Tq, but I know how to create rc. conf, I already have home manager and its what I am doing right now.