Skip to content

Commit

Permalink
feat: add a simple zellij layout for server development (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtrrll authored Aug 27, 2024
1 parent 61c93cf commit fc71fea
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dotfiles/programs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ with lib; {
imports = [
./editors
./shells
./zellij

./alacritty.nix
./bat.nix
Expand All @@ -11,7 +12,6 @@ with lib; {
./fastfetch.nix
./fzf.nix
./git.nix
./zellij.nix
./zoxide.nix
];
options = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
args,
config,
lib,
...
Expand All @@ -8,5 +9,10 @@ with lib; {
programs.zellij = {
enable = true;
};

home.file."layouts" = {
source = ./layouts;
target = "${args.homeDirectory}/.config/zellij/layouts";
};
};
}
42 changes: 42 additions & 0 deletions dotfiles/programs/zellij/layouts/server.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
layout {
default_tab_template {
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
children
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
tab name="server" split_direction="vertical"{
pane size=82 {
pane {
name "server"
}
pane {
command "btop"
name "monitor"
}
}
pane {
focus true
name "console"
}
}
tab focus=true name="workspace" split_direction="vertical"{
pane size=82 {
pane {
args "60" "git" "-c" "color.status=always" "status" "--short"
command "repeat"
name "git status"
}
pane {
name "git"
}
}
pane {
focus true
name "workspace"
}
}
}
1 change: 1 addition & 0 deletions dotfiles/scripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
with lib; {
imports = [
./home.nix
./repeat.nix
];
options = {
dotfiles.scripts = {
Expand Down
23 changes: 23 additions & 0 deletions dotfiles/scripts/repeat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
config,
lib,
pkgs,
...
}:
with lib; {
config = mkIf config.dotfiles.scripts.enable {
home.packages = [
(pkgs.writeShellScriptBin "repeat" ''
if [[ "$#" -lt 2 ]]; then
echo "Usage: $(basename "$0") <interval> <command> [args...]"
exit 1
fi
INTERVAL="$1"
shift
${pkgs.watch}/bin/watch --color -n "$INTERVAL" "$@"
'')
];
};
}

0 comments on commit fc71fea

Please sign in to comment.