nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.8k stars 1.78k forks source link

feature request: zellij add support for layouts #4485

Open colemickens opened 1 year ago

colemickens commented 1 year ago

Description

I want to adopt zjstatus: https://github.com/dj95/zjstatus

It looks like that entails including the plugin in a new custom layout file in layouts/ . Then launching with that layout or setting default_layout in the config.

I can import the KDL converter and use xdgConfigFile to do this by hand, but it would be nice to have module options for it.

colemickens commented 1 year ago

example usage: https://github.com/colemickens/nixcfg/commit/90914d2dd8cbecda7f785f2bb833d55c3887347b

but I can't really figure out if there's even a way to express that KDL in Nix...

stale[bot] commented 9 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

jaythomas commented 3 weeks ago

What do others propose the configuration api look like for this? Maybe just accept a string? This approach would certainly be more straight-forward in my opinion than writing the layouts directly as nix code then serializing the data to kdl nodes from nix. Given kdl node names carry attributes while nix syntax structured data more akin to json it would be more difficult to implement and likely less intuitive to users. Thoughts on implementing it this way?

### my-program-modules/zellij.nix
{ pkgs, ... }:

{
  home-manager.users.nixon.programs.zellij = {
    enable = true;
      settings = {
        default_layout = "my-layout-A";
        layouts = {
          # Inline
          my-layout-A = ''
            layout {
              pane split_direction="vertical" {
                pane
                pane split_direction="horizontal" {
                  pane
                  pane
                }
              }
            }
          '';
          # Or make a string from a file
          my-layout-B = (builtins.readFile ./folder-i-store-layouts-in/my-layout-B.kdl);
        };
        mouse_mode = false;
        pane_frames = false;
        scroll_buffer_size = 30000;
        simplified_ui = true;
        theme = "gruvbox-light";
        ui = {
          pane_frames = {
            hide_session_name = true;
          };
        };
      };
  };
}