Skip to content

Commit

Permalink
add start-zellij
Browse files Browse the repository at this point in the history
  • Loading branch information
MayNiklas committed Dec 8, 2023
1 parent bc93287 commit b53459d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
preview-update = pkgs.preview-update;
s3uploader = pkgs.s3uploader;
start-tmux = pkgs.start-tmux;
start-zellij = pkgs.start-zellij;
update-input = pkgs.update-input;
vs-fix = pkgs.vs-fix;
};
Expand Down
2 changes: 2 additions & 0 deletions home-manager/profiles/server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
gen-module = pkgs.callPackage ../../packages/gen-module { };
preview-update = pkgs.callPackage ../../packages/preview-update { };
start-tmux = pkgs.callPackage ../../packages/start-tmux { };
start-zellij = pkgs.callPackage ../../packages/start-zellij { };
update-input = pkgs.callPackage ../../packages/update-input { };
vs-fix = pkgs.callPackage ../../packages/vs-fix { };
in
Expand All @@ -29,6 +30,7 @@
gen-module
preview-update
start-tmux
start-zellij
update-input
vs-fix

Expand Down
1 change: 1 addition & 0 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ self: super: {
preview-update = super.pkgs.callPackage ../packages/preview-update { };
s3uploader = super.pkgs.callPackage ../packages/s3uploader { };
start-tmux = super.pkgs.callPackage ../packages/start-tmux { };
start-zellij = super.pkgs.callPackage ../packages/start-zellij { };
update-input = super.pkgs.callPackage ../packages/update-input { };
# tautulli = super.pkgs.python3Packages.callPackage ../packages/tautulli { };
verification-listener =
Expand Down
14 changes: 14 additions & 0 deletions packages/start-zellij/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ writeShellScriptBin
, zellij
, fzf
, ...
}:
writeShellScriptBin "start-zellij" ''
ZJ_SESSIONS=$(${zellij}/bin/zellij list-sessions -n)
NO_SESSIONS=$(echo "$ZJ_SESSIONS" | wc -l)
if [ "$NO_SESSIONS" -ge 2 ]; then
${zellij}/bin/zellij attach "$(echo "$ZJ_SESSIONS" | ${fzf}/bin/fzf | cut -d' ' -f1)"
else
${zellij}/bin/zellij attach -c
fi
''

0 comments on commit b53459d

Please sign in to comment.