zellij: rework layout configuration
extend the base zellij home-manager module to include the option to define layouts with zjstatus, opinionated module; will never be upstreamed in current state also re-enable cava as build failure has been fixed in nixpkgs
This commit is contained in:
parent
602b82fb04
commit
b07798e0e8
4 changed files with 184 additions and 65 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
osConfig,
|
osConfig,
|
||||||
config,
|
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
hozen,
|
hozen,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
|
@ -13,6 +11,7 @@
|
||||||
|
|
||||||
cfg = osConfig.ooknet.console.tools.zellij;
|
cfg = osConfig.ooknet.console.tools.zellij;
|
||||||
in {
|
in {
|
||||||
|
imports = [./options.nix];
|
||||||
config = mkIf (cfg.enable || console.multiplexer == "zellij") {
|
config = mkIf (cfg.enable || console.multiplexer == "zellij") {
|
||||||
programs.zellij = {
|
programs.zellij = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -38,18 +37,37 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
# Layouts
|
# layout configurations
|
||||||
xdg.configFile = {
|
layouts = {
|
||||||
# Default layout
|
default = {
|
||||||
"zellij/layouts/default.kdl" = import ./layouts/defaultLayout.nix {inherit pkgs config osConfig hozen;};
|
tabs =
|
||||||
# Layout for bash scripts
|
#kdl
|
||||||
"zellij/layouts/script.kdl" = import ./layouts/scriptLayout.nix {inherit pkgs config osConfig hozen;};
|
''
|
||||||
# Layout for configuring my flake
|
tab name="terminal" focus=true {
|
||||||
"zellij/layouts/flake.kdl" = import ./layouts/flakeLayout.nix {inherit pkgs config osConfig hozen;};
|
pane name="term" focus=true
|
||||||
# Additional keybinds
|
}
|
||||||
"zellij/config.kdl".text =
|
'';
|
||||||
|
};
|
||||||
|
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
|
# kdl
|
||||||
''
|
''
|
||||||
keybinds clear-defaults=true {
|
keybinds clear-defaults=true {
|
||||||
|
|
@ -57,7 +75,7 @@ in {
|
||||||
bind "Alt 1" { GoToTab 1; }
|
bind "Alt 1" { GoToTab 1; }
|
||||||
bind "Alt 2" { GoToTab 2; }
|
bind "Alt 2" { GoToTab 2; }
|
||||||
bind "Alt 3" { GoToTab 3; }
|
bind "Alt 3" { GoToTab 3; }
|
||||||
bind "Alt 4" { GoToTab 4; }
|
bind "Alt 4" { GoToTab 4; }
|
||||||
bind "Alt 5" { GoToTab 5; }
|
bind "Alt 5" { GoToTab 5; }
|
||||||
bind "Alt 6" { GoToTab 6; }
|
bind "Alt 6" { GoToTab 6; }
|
||||||
bind "Alt 7" { GoToTab 7; }
|
bind "Alt 7" { GoToTab 7; }
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,28 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
hozen,
|
hozen,
|
||||||
osConfig,
|
osConfig,
|
||||||
|
ook,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (hozen) color;
|
inherit (hozen) color;
|
||||||
|
inherit (ook.lib.generators) mkZellijLayout;
|
||||||
in {
|
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
|
kdl
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
115
modules/home/console/tools/multiplexer/zellij/options.nix
Normal file
115
modules/home/console/tools/multiplexer/zellij/options.nix
Normal file
|
|
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -75,7 +75,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
cava = {
|
cava = {
|
||||||
enable = false; # FIX ME!!!
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
general.framerate = 60;
|
general.framerate = 60;
|
||||||
color = {
|
color = {
|
||||||
|
|
@ -91,57 +91,26 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."zellij/layouts/music.kdl".text =
|
programs.zellij.layouts.music = {
|
||||||
mkIf (zellij.enable || multiplexer == "zellij")
|
icon = "";
|
||||||
/*
|
tabs =
|
||||||
kdl
|
# kdl
|
||||||
*/
|
''
|
||||||
''
|
tab name="spotify" focus=true {
|
||||||
layout {
|
pane name="spotify" {
|
||||||
default_tab_template {
|
borderless true
|
||||||
pane size=2 borderless=true {
|
command "${getExe self'.packages.spotify-player}"
|
||||||
plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
|
focus true
|
||||||
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}"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
children
|
pane name="Visualizer" {
|
||||||
}
|
borderless false
|
||||||
|
split_direction "horizontal"
|
||||||
tab name="spotify" focus=true {
|
size "20%"
|
||||||
pane name="spotify" {
|
command "${getExe pkgs.cava}"
|
||||||
borderless true
|
|
||||||
command "${getExe pkgs.spotify-player}"
|
|
||||||
focus true
|
|
||||||
}
|
|
||||||
//pane name="Visualizer" {
|
|
||||||
// borderless false
|
|
||||||
// split_direction "horizontal"
|
|
||||||
// size "20%"
|
|
||||||
// command "cava"
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
home.shellAliases = mkIf (zellij.enable || multiplexer == "zellij") {
|
home.shellAliases = mkIf (zellij.enable || multiplexer == "zellij") {
|
||||||
zjm = "zellij --layout music";
|
zjm = "zellij --layout music";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue