Skip to content

Commit

Permalink
🔧 zellij config
Browse files Browse the repository at this point in the history
  • Loading branch information
shelken committed Oct 24, 2024
1 parent 8d4cbf6 commit cc449dc
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 31 deletions.
73 changes: 50 additions & 23 deletions home/apps/zellij/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
cp $src $out/bin/zellij_forgot.wasm
'';
};
zjstatus = pkgs.stdenv.mkDerivation rec {
pname = "zjstatus";
version = "v0.17.0";

src = builtins.fetchurl {
url = "https://github.com/dj95/zjstatus/releases/download/${version}/zjstatus.wasm";
sha256 = "sha256:1rbvazam9qdj2z21fgzjvbyp5mcrxw28nprqsdzal4dqbm5dy112";
};
phases = ["installPhase"];

installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/zjstatus.wasm
'';
};
in {
programs.zellij = {
enable = true;
Expand All @@ -33,33 +48,45 @@ in {
enableZshIntegration = false;
};

xdg.configFile."zellij/config.kdl" = {
text = concatStrings [
''
// 主题配色
theme "${theme}"
xdg.configFile = {
"zellij/layouts/basic.kdl".text = builtins.readFile ./layouts/basic.kdl;
"zellij/layouts/basic.swap.kdl".text = builtins.readFile ./layouts/basic.swap.kdl;
"zellij/config.kdl" = {
text = concatStrings [
''
// 主题配色
theme "${theme}"
session_serialization true
simplified_ui false
''
''
//键盘绑定
keybinds {
${keybinds-config}
default_layout "basic"
session_serialization true
simplified_ui false
''
''
//键盘绑定
keybinds {
${keybinds-config}
// 参考:https://github.com/nixypanda/dotfiles/blob/f5d4bb5a1efd006f1db3e29965a12dea09f10356/modules/zellij/default.nix#L56C11-L63C12
// 插件:命令提示
shared_except "locked" {
bind "Ctrl y" {
LaunchOrFocusPlugin "file:${zellij-forgot}/bin/zellij_forgot.wasm" {
"LOAD_ZELLIJ_BINDINGS" "true"
floating true
// 参考:https://github.com/nixypanda/dotfiles/blob/f5d4bb5a1efd006f1db3e29965a12dea09f10356/modules/zellij/default.nix#L56C11-L63C12
// 插件:命令提示
shared_except "locked" {
bind "Ctrl y" {
LaunchOrFocusPlugin "file:${zellij-forgot}/bin/zellij_forgot.wasm" {
"LOAD_ZELLIJ_BINDINGS" "true"
floating true
}
}
}
}
}
''
# origin_file
];
''
# origin_file
''
plugins {
zjstatus location="file:${zjstatus}/bin/zjstatus.wasm" {
${builtins.readFile ./zjstatus/catpuccin.kdl}
}
}
''
];
};
};
}
15 changes: 15 additions & 0 deletions home/apps/zellij/layouts/basic.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
layout {
// pane size=1 borderless=true {
// plugin location="tab-bar"
// }
pane size=1 borderless=true {
plugin location="zjstatus"
}
pane stacked=true name="default" {
pane
pane
}
pane size=2 borderless=true {
plugin location="status-bar"
}
}
100 changes: 100 additions & 0 deletions home/apps/zellij/layouts/basic.swap.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
tab_template name="ui" {
pane size=1 borderless=true {
plugin location="zjstatus"
}
children
pane size=2 borderless=true {
plugin location="status-bar"
}
}

swap_tiled_layout name="vertical" {
ui max_panes=5 {
pane split_direction="vertical" {
pane
pane { children; }
}
}
ui max_panes=8 {
pane split_direction="vertical" {
pane { children; }
pane { pane; pane; pane; pane; }
}
}
ui max_panes=12 {
pane split_direction="vertical" {
pane { children; }
pane { pane; pane; pane; pane; }
pane { pane; pane; pane; pane; }
}
}
}

swap_tiled_layout name="horizontal" {
ui max_panes=5 {
pane
pane
}
ui max_panes=8 {
pane {
pane split_direction="vertical" { children; }
pane split_direction="vertical" { pane; pane; pane; pane; }
}
}
ui max_panes=12 {
pane {
pane split_direction="vertical" { children; }
pane split_direction="vertical" { pane; pane; pane; pane; }
pane split_direction="vertical" { pane; pane; pane; pane; }
}
}
}

swap_tiled_layout name="stacked" {
ui min_panes=5 {
pane split_direction="vertical" {
pane
pane stacked=true { children; }
}
}
}

swap_floating_layout name="staggered" {
floating_panes
}

swap_floating_layout name="enlarged" {
floating_panes max_panes=10 {
pane { x "5%"; y 1; width "90%"; height "90%"; }
pane { x "5%"; y 2; width "90%"; height "90%"; }
pane { x "5%"; y 3; width "90%"; height "90%"; }
pane { x "5%"; y 4; width "90%"; height "90%"; }
pane { x "5%"; y 5; width "90%"; height "90%"; }
pane { x "5%"; y 6; width "90%"; height "90%"; }
pane { x "5%"; y 7; width "90%"; height "90%"; }
pane { x "5%"; y 8; width "90%"; height "90%"; }
pane { x "5%"; y 9; width "90%"; height "90%"; }
pane focus=true { x 10; y 10; width "90%"; height "90%"; }
}
}

swap_floating_layout name="spread" {
floating_panes max_panes=1 {
pane {y "50%"; x "50%"; }
}
floating_panes max_panes=2 {
pane { x "1%"; y "25%"; width "45%"; }
pane { x "50%"; y "25%"; width "45%"; }
}
floating_panes max_panes=3 {
pane focus=true { y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; }
pane { x "50%"; y "1%"; width "45%"; }
}
floating_panes max_panes=4 {
pane { x "1%"; y "55%"; width "45%"; height "45%"; }
pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; height "45%"; }
pane { x "50%"; y "1%"; width "45%"; height "45%"; }
}
}
178 changes: 178 additions & 0 deletions home/apps/zellij/zjstatus/catpuccin.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// Catppuccin theme for the `zjstatus` plugin (v0.17.0+)

// Usage:
// 1. Copy the content to the body of the zjstatus declaration in your config or layout file, see `config.kdl`
// 2. Uncomment the color palette you want to use. Default is Mocha

// {
// -- Catppuccin Mocha --
// color_rosewater "#f5e0dc"
// color_flamingo "#f2cdcd"
// color_pink "#f5c2e7"
// color_mauve "#cba6f7"
// color_red "#f38ba8"
// color_maroon "#eba0ac"
// color_peach "#fab387"
// color_yellow "#f9e2af"
// color_green "#a6e3a1"
// color_teal "#94e2d5"
// color_sky "#89dceb"
// color_sapphire "#74c7ec"
// color_blue "#89b4fa"
// color_lavender "#b4befe"
// color_text "#cdd6f4"
// color_subtext1 "#bac2de"
// color_subtext0 "#a6adc8"
// color_overlay2 "#9399b2"
// color_overlay1 "#7f849c"
// color_overlay0 "#6c7086"
// color_surface2 "#585b70"
// color_surface1 "#45475a"
// color_surface0 "#313244"
// color_base "#1e1e2e"
// color_mantle "#181825"
// color_crust "#11111b"

// -- Catppuccin Latte --
//color_rosewater "#dc8a78"
//color_flamingo "#dd7878"
//color_pink "#ea76cb"
//color_mauve "#8839ef"
//color_red "#d20f39"
//color_maroon "#e64553"
//color_peach "#fe640b"
//color_yellow "#df8e1d"
//color_green "#40a02b"
//color_teal "#179299"
//color_sky "#04a5e5"
//color_sapphire "#209fb5"
//color_blue "#1e66f5"
//color_lavender "#7287fd"
//color_text "#4c4f69"
//color_subtext1 "#5c5f77"
//color_subtext0 "#6c6f85"
//color_overlay2 "#7c7f93"
//color_overlay1 "#8c8fa1"
//color_overlay0 "#9ca0b0"
//color_surface2 "#acb0be"
//color_surface1 "#bcc0cc"
//color_surface0 "#ccd0da"
//color_base "#eff1f5"
//color_mantle "#e6e9ef"
//color_crust "#dce0e8"

// -- Catppuccin Frappé --
//color_rosewater "#f2d5cf"
//color_flamingo "#eebebe"
//color_pink "#f4b8e4"
//color_mauve "#ca9ee6"
//color_red "#e78284"
//color_maroon "#ea999c"
//color_peach "#ef9f76"
//color_yellow "#e5c890"
//color_green "#a6d189"
//color_teal "#81c8be"
//color_sky "#99d1db"
//color_sapphire "#85c1dc"
//color_blue "#8caaee"
//color_lavender "#babbf1"
//color_text "#c6d0f5"
//color_subtext1 "#b5bfe2"
//color_subtext0 "#a5adce"
//color_overlay2 "#949cbb"
//color_overlay1 "#838ba7"
//color_overlay0 "#737994"
//color_surface2 "#626880"
//color_surface1 "#51576d"
//color_surface0 "#414559"
//color_base "#303446"
//color_mantle "#292c3c"
//color_crust "#232634"

// -- Catppuccin Macchiato --
color_rosewater "#f4dbd6"
color_flamingo "#f0c6c6"
color_pink "#f5bde6"
color_mauve "#c6a0f6"
color_red "#ed8796"
color_maroon "#ee99a0"
color_peach "#f5a97f"
color_yellow "#eed49f"
color_green "#a6da95"
color_teal "#8bd5ca"
color_sky "#91d7e3"
color_sapphire "#7dc4e4"
color_blue "#8aadf4"
color_lavender "#b7bdf8"
color_text "#cad3f5"
color_subtext1 "#b8c0e0"
color_subtext0 "#a5adcb"
color_overlay2 "#939ab7"
color_overlay1 "#8087a2"
color_overlay0 "#6e738d"
color_surface2 "#5b6078"
color_surface1 "#494d64"
color_surface0 "#363a4f"
color_base "#24273a"
color_mantle "#1e2030"
color_crust "#181926"

format_left "#[bg=$surface0,fg=$sapphire]#[bg=$sapphire,fg=$crust,bold] {session} #[bg=$surface0] {mode}#[bg=$surface0] {tabs}"
format_center "{notifications}"
format_right "#[bg=$surface0,fg=$flamingo]#[fg=$crust,bg=$flamingo] #[bg=$surface1,fg=$flamingo,bold] {command_user}@{command_host}#[bg=$surface0,fg=$surface1]#[bg=$surface0,fg=$maroon]#[bg=$maroon,fg=$crust]󰃭 #[bg=$surface1,fg=$maroon,bold] {datetime}#[bg=$surface0,fg=$surface1]"
format_space "#[bg=$surface0]"
format_hide_on_overlength "true"
format_precedence "lrc"

border_enabled "false"
border_char "─"
border_format "#[bg=$surface0]{char}"
border_position "top"

hide_frame_for_single_pane "true"

mode_normal "#[bg=$green,fg=$crust,bold] NORMAL#[bg=$surface0,fg=$green]"
mode_tmux "#[bg=$mauve,fg=$crust,bold] TMUX#[bg=$surface0,fg=$mauve]"
mode_locked "#[bg=$red,fg=$crust,bold] LOCKED#[bg=$surface0,fg=$red]"
mode_pane "#[bg=$teal,fg=$crust,bold] PANE#[bg=$surface0,fg=teal]"
mode_tab "#[bg=$teal,fg=$crust,bold] TAB#[bg=$surface0,fg=$teal]"
mode_scroll "#[bg=$flamingo,fg=$crust,bold] SCROLL#[bg=$surface0,fg=$flamingo]"
mode_enter_search "#[bg=$flamingo,fg=$crust,bold] ENT-SEARCH#[bg=$surfaco,fg=$flamingo]"
mode_search "#[bg=$flamingo,fg=$crust,bold] SEARCHARCH#[bg=$surfac0,fg=$flamingo]"
mode_resize "#[bg=$yellow,fg=$crust,bold] RESIZE#[bg=$surfac0,fg=$yellow]"
mode_rename_tab "#[bg=$yellow,fg=$crust,bold] RENAME-TAB#[bg=$surface0,fg=$yellow]"
mode_rename_pane "#[bg=$yellow,fg=$crust,bold] RENAME-PANE#[bg=$surface0,fg=$yellow]"
mode_move "#[bg=$yellow,fg=$crust,bold] MOVE#[bg=$surface0,fg=$yellow]"
mode_session "#[bg=$pink,fg=$crust,bold] SESSION#[bg=$surface0,fg=$pink]"
mode_prompt "#[bg=$pink,fg=$crust,bold] PROMPT#[bg=$surface0,fg=$pink]"

tab_normal "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{floating_indicator}#[bg=$surface0,fg=$surface1]"
tab_normal_fullscreen "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{fullscreen_indicator}#[bg=$surface0,fg=$surface1]"
tab_normal_sync "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{sync_indicator}#[bg=$surface0,fg=$surface1]"
tab_active "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{floating_indicator}#[bg=$surface0,fg=$surface1]"
tab_active_fullscreen "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{fullscreen_indicator}#[bg=$surface0,fg=$surface1]"
tab_active_sync "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{sync_indicator}#[bg=$surface0,fg=$surface1]"
tab_separator "#[bg=$surface0] "

tab_sync_indicator " "
tab_fullscreen_indicator " 󰊓"
tab_floating_indicator " 󰹙"

notification_format_unread "#[bg=surface0,fg=$yellow]#[bg=$yellow,fg=$crust] #[bg=$surface1,fg=$yellow] {message}#[bg=$surface0,fg=$yellow]"
notification_format_no_notifications ""
notification_show_interval "10"

command_host_command "uname -n"
command_host_format "{stdout}"
command_host_interval "0"
command_host_rendermode "static"

command_user_command "whoami"
command_user_format "{stdout}"
command_user_interval "10"
command_user_rendermode "static"

datetime "{format}"
datetime_format "%Y-%m-%d 󰅐 %H:%M"
datetime_timezone "Asia/Shanghai"
// }
Loading

0 comments on commit cc449dc

Please sign in to comment.