OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
HASH      b07798e0e877
DATE      2025-01-21
SUBJECT   zellij: rework layout configuration
FILES     4 CHANGED
HASH      b07798e0e877
DATE      2025-01-21
SUBJECT   zellij: rework layout configuration
FILES     4 CHANGED
 

diff --git a/modules/home/console/tools/multiplexer/zellij/default.nix b/modules/h
ome/console/tools/multiplexer/zellij/default.nix
index de5de56..6e13853 100644
--- a/modules/home/console/tools/multiplexer/zellij/default.nix
+++ b/modules/home/console/tools/multiplexer/zellij/default.nix
@@ -1,8 +1,6 @@
 {
   osConfig,
-  config,
   lib,
-  pkgs,
   hozen,
   ...
 }: let
@@ -13,6 +11,7 @@
 
   cfg = osConfig.ooknet.console.tools.zellij;
 in {
+  imports = [./options.nix];
   config = mkIf (cfg.enable || console.multiplexer == "zellij") {
     programs.zellij = {
       enable = true;
@@ -38,18 +37,37 @@ in {
           };
         };
       };
-    };
 
-    # Layouts
-    xdg.configFile = {
-      # Default layout
-      "zellij/layouts/default.kdl" = import ./layouts/defaultLayout.nix {inherit 
pkgs config osConfig hozen;};
-      # Layout for bash scripts
-      "zellij/layouts/script.kdl" = import ./layouts/scriptLayout.nix {inherit pk
gs config osConfig hozen;};
-      # Layout for configuring my flake
-      "zellij/layouts/flake.kdl" = import ./layouts/flakeLayout.nix {inherit pkgs
 config osConfig hozen;};
-      # Additional keybinds
-      "zellij/config.kdl".text =
+      # layout configurations
+      layouts = {
+        default = {
+          tabs =
+            #kdl
+            ''
+              tab name="terminal" focus=true {
+                pane name="term" focus=true
+              }
+            '';
+        };
+        flake = {
+          tabs =
+            # kdl
+            ''
+              tab name="terminal" focus=true {
+                pane name="term" cwd="$FLAKE" focus=true
+              }
+              tab name="editor" {
+                pane name="edit" edit="$FLAKE"
+              }
+              tab name="git" {
+                pane name="git" cwd="$FLAKE" command="lazygit"
+              }
+            '';
+        };
+      };
+
+      # keybind configuration
+      extraSettings =
         # kdl
         ''
           keybinds clear-defaults=true {
@@ -57,7 +75,7 @@ in {
                   bind "Alt 1" { GoToTab 1; }
                   bind "Alt 2" { GoToTab 2; }
                   bind "Alt 3" { GoToTab 3; }
-                  bind "Alt 4" { GoToTab 4; }
+              bind "Alt 4" { GoToTab 4; }
                   bind "Alt 5" { GoToTab 5; }
                   bind "Alt 6" { GoToTab 6; }
                   bind "Alt 7" { GoToTab 7; }

diff --git a/modules/home/console/tools/mult
iplexer/zellij/default.nix b/modules/home/co
nsole/tools/multiplexer/zellij/default.nix
index de5de56..6e13853 100644
--- a/modules/home/console/tools/multiplexer
/zellij/default.nix
+++ b/modules/home/console/tools/multiplexer
/zellij/default.nix
@@ -1,8 +1,6 @@
 {
   osConfig,
-  config,
   lib,
-  pkgs,
   hozen,
   ...
 }: let
@@ -13,6 +11,7 @@
 
   cfg = osConfig.ooknet.console.tools.zelli
j;
 in {
+  imports = [./options.nix];
   config = mkIf (cfg.enable || console.mult
iplexer == "zellij") {
     programs.zellij = {
       enable = true;
@@ -38,18 +37,37 @@ in {
           };
         };
       };
-    };
 
-    # Layouts
-    xdg.configFile = {
-      # Default layout
-      "zellij/layouts/default.kdl" = import
 ./layouts/defaultLayout.nix {inherit pkgs c
onfig osConfig hozen;};
-      # Layout for bash scripts
-      "zellij/layouts/script.kdl" = import 
./layouts/scriptLayout.nix {inherit pkgs con
fig osConfig hozen;};
-      # Layout for configuring my flake
-      "zellij/layouts/flake.kdl" = import .
/layouts/flakeLayout.nix {inherit pkgs confi
g osConfig hozen;};
-      # Additional keybinds
-      "zellij/config.kdl".text =
+      # layout configurations
+      layouts = {
+        default = {
+          tabs =
+            #kdl
+            ''
+              tab name="terminal" focus=tru
e {
+                pane name="term" focus=true
+              }
+            '';
+        };
+        flake = {
+          tabs =
+            # kdl
+            ''
+              tab name="terminal" focus=tru
e {
+                pane name="term" cwd="$FLAK
E" focus=true
+              }
+              tab name="editor" {
+                pane name="edit" edit="$FLA
KE"
+              }
+              tab name="git" {
+                pane name="git" cwd="$FLAKE
" command="lazygit"
+              }
+            '';
+        };
+      };
+
+      # keybind configuration
+      extraSettings =
         # kdl
         ''
           keybinds clear-defaults=true {
@@ -57,7 +75,7 @@ in {
                   bind "Alt 1" { GoToTab 1;
 }
                   bind "Alt 2" { GoToTab 2;
 }
                   bind "Alt 3" { GoToTab 3;
 }
-                  bind "Alt 4" { GoToTab 4;
 }
+              bind "Alt 4" { GoToTab 4; }
                   bind "Alt 5" { GoToTab 5;
 }
                   bind "Alt 6" { GoToTab 6;
 }
                   bind "Alt 7" { GoToTab 7;
 }
 

diff --git a/modules/home/console/tools/multiplexer/zellij/layouts/flakeLayout.nix
 b/modules/home/console/tools/multiplexer/zellij/layouts/flakeLayout.nix
index 4a50b5b..d563a58 100644
--- a/modules/home/console/tools/multiplexer/zellij/layouts/flakeLayout.nix
+++ b/modules/home/console/tools/multiplexer/zellij/layouts/flakeLayout.nix
@@ -2,11 +2,28 @@
   pkgs,
   hozen,
   osConfig,
+  ook,
   ...
 }: let
   inherit (hozen) color;
+  inherit (ook.lib.generators) mkZellijLayout;
 in {
-  text =
+  text = mkZellijLayout {
+    zjstatusFile = "${inputs'.zjstatus.packages.default}/bin/zjstatus.wasm";
+    icon = "?";
+    timeZone = "${osConfig.time.timeZone}";
+    tabs = ''
+      tab name="terminal" focus=true {
+        pane name="term" cwd="$FLAKE" focus=true
+      }
+      tab name="editor" {
+        pane name="edit" edit="$FLAKE"
+      }
+      tab name="git" {
+        pane name="git" cwd="$FLAKE" command="lazygit"
+      }
+    '';
+  };
     /*
     kdl
     */

diff --git a/modules/home/console/tools/mult
iplexer/zellij/layouts/flakeLayout.nix b/mod
ules/home/console/tools/multiplexer/zellij/l
ayouts/flakeLayout.nix
index 4a50b5b..d563a58 100644
--- a/modules/home/console/tools/multiplexer
/zellij/layouts/flakeLayout.nix
+++ b/modules/home/console/tools/multiplexer
/zellij/layouts/flakeLayout.nix
@@ -2,11 +2,28 @@
   pkgs,
   hozen,
   osConfig,
+  ook,
   ...
 }: let
   inherit (hozen) color;
+  inherit (ook.lib.generators) mkZellijLayo
ut;
 in {
-  text =
+  text = mkZellijLayout {
+    zjstatusFile = "${inputs'.zjstatus.pack
ages.default}/bin/zjstatus.wasm";
+    icon = "?";
+    timeZone = "${osConfig.time.timeZone}";
+    tabs = ''
+      tab name="terminal" focus=true {
+        pane name="term" cwd="$FLAKE" focus
=true
+      }
+      tab name="editor" {
+        pane name="edit" edit="$FLAKE"
+      }
+      tab name="git" {
+        pane name="git" cwd="$FLAKE" comman
d="lazygit"
+      }
+    '';
+  };
     /*
     kdl
     */
 

diff --git a/modules/home/console/tools/multiplexer/zellij/options.nix b/modules/h
ome/console/tools/multiplexer/zellij/options.nix
new file mode 100644
index 0000000..289bc6d
--- /dev/null
+++ b/modules/home/console/tools/multiplexer/zellij/options.nix
@@ -0,0 +1,115 @@
+{
+  lib,
+  config,
+  inputs',
+  osConfig,
+  hozen,
+  ...
+}: let
+  inherit (hozen) color;
+  inherit (lib) optionalAttrs mapAttrs' nameValuePair mkIf mkOption;
+  inherit (lib.types) nullOr lines submodule str attrsOf;
+
+  cfg = config.programs.zellij;
+
+  mkZellijLayout = {
+    zjstatus,
+    icon ? "?",
+    timeZone,
+    tabs ? '''',
+  }:
+  # kdl
+  ''
+    layout {
+      default_tab_template {
+        pane size=2 borderless=true {
+          plugin location="file:${zjstatus}" {
+            format_left  "{mode}"
+            format_right "{session} {datetime}"
+            format_center "#[fg=#${color.base0D},bold] {tabs}"
+            format_space ""
+
+            border_enabled  "true"
+            border_char     "─"
+            border_format   "#[fg=#${color.base05}]{char}"
+            border_position "bottom"
+
+            hide_frame_for_single_pane "true"
+
+            mode_normal       "#[fg=#${color.base0D}]${icon} "
+            mode_tmux         "#[fg=#${color.base0E}]${icon} "
+            mode_pane         "#[fg=#${color.base08}]${icon} "
+            mode_tab          "#[fg=#${color.base08}]${icon} "
+            mode_rename_tab   "#[fg=#${color.base08}]${icon} "
+            mode_rename_pane  "#[fg=#${color.base08}]${icon} "
+            mode_session      "#[fg=#${color.base08}]${icon} "
+            mode_locked       "#[fg=#${color.base05}]${icon} "
+            mode_move         "#[fg=#${color.base0B}]${icon} "
+            mode_resize       "#[fg=#${color.base0B}]${icon} "
+            mode_prompt       "#[fg=#${color.base0A}]${icon} "
+            mode_search       "#[fg=#${color.base0A}]${icon} "
+            mode_enter_search "#[fg=#${color.base0A}]${icon} "
+
+            tab_normal   "#[bg=#${color.base01}] {name} "
+            tab_active   "#[bg=#${color.base02}] {name} "
+            tab_separator "  "
+
+            datetime        "#[fg=#${color.base05},bold] {format} "
+            datetime_format "%I:%M %p"
+            datetime_timezone "${timeZone}"
+          }
+        }
+      children
+      }
+      ${tabs}
+    }
+  '';
+
+  layoutModule = submodule {
+    options = {
+      icon = mkOption {
+        type = str;
+        description = "Icon to display on the status bar";
+        default = "?";
+      };
+      timeZone = mkOption {
+        type = str;
+        description = "Timezone for the datetime display";
+        default = osConfig.time.timeZone;
+      };
+      zjstatus = mkOption {
+        type = str;
+        default = "${inputs'.zjstatus.packages.default}/bin/zjstatus.wasm";
+      };
+      tabs = mkOption {
+        type = lines;
+        default = '''';
+        description = "KDL configuration for layouts tabs";
+      };
+    };
+  };
+in {
+  options.programs.zellij = {
+    # TODO: turn this into a binds options
+    extraSettings = mkOption {
+      type = nullOr lines;
+      default = null;
+      description = "Additional settings in KDL format";
+    };
+    layouts = mkOption {
+      type = attrsOf layoutModule;
+      description = "Zellij layouts with zjstatus";
+    };
+  };
+  config = mkIf cfg.enable {
+    xdg.configFile =
+      mapAttrs' (name: layout:
+        nameValuePair "zellij/layouts/${name}.kdl" {
+          text = mkZellijLayout layout;
+        })
+      cfg.layouts
+      // optionalAttrs (cfg.extraSettings != null) {
+        "zellij/config.kdl".text = cfg.extraSettings;
+      };
+  };
+}

diff --git a/modules/home/console/tools/mult
iplexer/zellij/options.nix b/modules/home/co
nsole/tools/multiplexer/zellij/options.nix
new file mode 100644
index 0000000..289bc6d
--- /dev/null
+++ b/modules/home/console/tools/multiplexer
/zellij/options.nix
@@ -0,0 +1,115 @@
+{
+  lib,
+  config,
+  inputs',
+  osConfig,
+  hozen,
+  ...
+}: let
+  inherit (hozen) color;
+  inherit (lib) optionalAttrs mapAttrs' nam
eValuePair mkIf mkOption;
+  inherit (lib.types) nullOr lines submodul
e str attrsOf;
+
+  cfg = config.programs.zellij;
+
+  mkZellijLayout = {
+    zjstatus,
+    icon ? "?",
+    timeZone,
+    tabs ? '''',
+  }:
+  # kdl
+  ''
+    layout {
+      default_tab_template {
+        pane size=2 borderless=true {
+          plugin location="file:${zjstatus}
" {
+            format_left  "{mode}"
+            format_right "{session} {dateti
me}"
+            format_center "#[fg=#${color.ba
se0D},bold] {tabs}"
+            format_space ""
+
+            border_enabled  "true"
+            border_char     "─"
+            border_format   "#[fg=#${color.
base05}]{char}"
+            border_position "bottom"
+
+            hide_frame_for_single_pane "tru
e"
+
+            mode_normal       "#[fg=#${colo
r.base0D}]${icon} "
+            mode_tmux         "#[fg=#${colo
r.base0E}]${icon} "
+            mode_pane         "#[fg=#${colo
r.base08}]${icon} "
+            mode_tab          "#[fg=#${colo
r.base08}]${icon} "
+            mode_rename_tab   "#[fg=#${colo
r.base08}]${icon} "
+            mode_rename_pane  "#[fg=#${colo
r.base08}]${icon} "
+            mode_session      "#[fg=#${colo
r.base08}]${icon} "
+            mode_locked       "#[fg=#${colo
r.base05}]${icon} "
+            mode_move         "#[fg=#${colo
r.base0B}]${icon} "
+            mode_resize       "#[fg=#${colo
r.base0B}]${icon} "
+            mode_prompt       "#[fg=#${colo
r.base0A}]${icon} "
+            mode_search       "#[fg=#${colo
r.base0A}]${icon} "
+            mode_enter_search "#[fg=#${colo
r.base0A}]${icon} "
+
+            tab_normal   "#[bg=#${color.bas
e01}] {name} "
+            tab_active   "#[bg=#${color.bas
e02}] {name} "
+            tab_separator "  "
+
+            datetime        "#[fg=#${color.
base05},bold] {format} "
+            datetime_format "%I:%M %p"
+            datetime_timezone "${timeZone}"
+          }
+        }
+      children
+      }
+      ${tabs}
+    }
+  '';
+
+  layoutModule = submodule {
+    options = {
+      icon = mkOption {
+        type = str;
+        description = "Icon to display on t
he status bar";
+        default = "?";
+      };
+      timeZone = mkOption {
+        type = str;
+        description = "Timezone for the dat
etime display";
+        default = osConfig.time.timeZone;
+      };
+      zjstatus = mkOption {
+        type = str;
+        default = "${inputs'.zjstatus.packa
ges.default}/bin/zjstatus.wasm";
+      };
+      tabs = mkOption {
+        type = lines;
+        default = '''';
+        description = "KDL configuration fo
r layouts tabs";
+      };
+    };
+  };
+in {
+  options.programs.zellij = {
+    # TODO: turn this into a binds options
+    extraSettings = mkOption {
+      type = nullOr lines;
+      default = null;
+      description = "Additional settings in
 KDL format";
+    };
+    layouts = mkOption {
+      type = attrsOf layoutModule;
+      description = "Zellij layouts with zj
status";
+    };
+  };
+  config = mkIf cfg.enable {
+    xdg.configFile =
+      mapAttrs' (name: layout:
+        nameValuePair "zellij/layouts/${nam
e}.kdl" {
+          text = mkZellijLayout layout;
+        })
+      cfg.layouts
+      // optionalAttrs (cfg.extraSettings !
= null) {
+        "zellij/config.kdl".text = cfg.extr
aSettings;
+      };
+  };
+}
 

diff --git a/modules/home/workstation/media/music.nix b/modules/home/workstation/m
edia/music.nix
index b5a967f..1855058 100644
--- a/modules/home/workstation/media/music.nix
+++ b/modules/home/workstation/media/music.nix
@@ -75,7 +75,7 @@ in {
       };
 
       cava = {
-        enable = false; # FIX ME!!!
+        enable = true;
         settings = {
           general.framerate = 60;
           color = {
@@ -91,57 +91,26 @@ in {
       };
     };
 
-    xdg.configFile."zellij/layouts/music.kdl".text =
-      mkIf (zellij.enable || multiplexer == "zellij")
-      /*
-      kdl
-      */
-      ''
-        layout {
-        default_tab_template {
-            pane size=2 borderless=true {
-                plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
-                    format_left   "{mode}"
-                    format_right  "{session} {datetime}"
-                    format_center "#[fg=#89B4FA,bold] {tabs}"
-                    format_space  ""
-
-                    border_enabled  "true"
-                    border_char     "─"
-                    border_format   "#[fg=#${color.base0D}]{char}"
-                    border_position "bottom"
-
-                    hide_frame_for_single_pane "true"
-
-                    mode_normal       "#[fg=${color.base0D}]?"
-
-                    tab_normal   "#[bg=#${color.base01}] {name} "
-                    tab_active   "#[bg=#${color.base02}] {name} "
-                    tab_separator "  "
-
-                    datetime        "#[fg=#${color.base05},bold] {format} "
-                    datetime_format "%I:%M %p"
-                    datetime_timezone "${osConfig.time.timeZone}"
-                }
+    programs.zellij.layouts.music = {
+      icon = "?";
+      tabs =
+        # kdl
+        ''
+          tab name="spotify" focus=true {
+            pane name="spotify" {
+              borderless true
+              command "${getExe self'.packages.spotify-player}"
+              focus true
             }
-            children
-        }
-
-            tab name="spotify" focus=true {
-                pane name="spotify" {
-                    borderless true
-                    command "${getExe pkgs.spotify-player}"
-                    focus true
-                }
-                //pane name="Visualizer" {
-                //    borderless false
-                //    split_direction "horizontal"
-                //    size "20%"
-                //    command "cava"
-                //}
+            pane name="Visualizer" {
+              borderless false
+              split_direction "horizontal"
+              size "20%"
+              command "${getExe pkgs.cava}"
             }
-        }
-      '';
+          }
+        '';
+    };
 
     home.shellAliases = mkIf (zellij.enable || multiplexer == "zellij") {
       zjm = "zellij --layout music";

diff --git a/modules/home/workstation/media/
music.nix b/modules/home/workstation/media/m
usic.nix
index b5a967f..1855058 100644
--- a/modules/home/workstation/media/music.n
ix
+++ b/modules/home/workstation/media/music.n
ix
@@ -75,7 +75,7 @@ in {
       };
 
       cava = {
-        enable = false; # FIX ME!!!
+        enable = true;
         settings = {
           general.framerate = 60;
           color = {
@@ -91,57 +91,26 @@ in {
       };
     };
 
-    xdg.configFile."zellij/layouts/music.kd
l".text =
-      mkIf (zellij.enable || multiplexer ==
 "zellij")
-      /*
-      kdl
-      */
-      ''
-        layout {
-        default_tab_template {
-            pane size=2 borderless=true {
-                plugin location="file:${pkg
s.zjstatus}/bin/zjstatus.wasm" {
-                    format_left   "{mode}"
-                    format_right  "{session
} {datetime}"
-                    format_center "#[fg=#89
B4FA,bold] {tabs}"
-                    format_space  ""
-
-                    border_enabled  "true"
-                    border_char     "─"
-                    border_format   "#[fg=#
${color.base0D}]{char}"
-                    border_position "bottom
"
-
-                    hide_frame_for_single_p
ane "true"
-
-                    mode_normal       "#[fg
=${color.base0D}]?"
-
-                    tab_normal   "#[bg=#${c
olor.base01}] {name} "
-                    tab_active   "#[bg=#${c
olor.base02}] {name} "
-                    tab_separator "  "
-
-                    datetime        "#[fg=#
${color.base05},bold] {format} "
-                    datetime_format "%I:%M 
%p"
-                    datetime_timezone "${os
Config.time.timeZone}"
-                }
+    programs.zellij.layouts.music = {
+      icon = "?";
+      tabs =
+        # kdl
+        ''
+          tab name="spotify" focus=true {
+            pane name="spotify" {
+              borderless true
+              command "${getExe self'.packa
ges.spotify-player}"
+              focus true
             }
-            children
-        }
-
-            tab name="spotify" focus=true {
-                pane name="spotify" {
-                    borderless true
-                    command "${getExe pkgs.
spotify-player}"
-                    focus true
-                }
-                //pane name="Visualizer" {
-                //    borderless false
-                //    split_direction "hori
zontal"
-                //    size "20%"
-                //    command "cava"
-                //}
+            pane name="Visualizer" {
+              borderless false
+              split_direction "horizontal"
+              size "20%"
+              command "${getExe pkgs.cava}"
             }
-        }
-      '';
+          }
+        '';
+    };
 
     home.shellAliases = mkIf (zellij.enable
 || multiplexer == "zellij") {
       zjm = "zellij --layout music";
 
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET