nix-config/modules/home-manager/cli/tmux-sessionizer.nix

42 lines
830 B
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}:
2024-12-10 21:40:33 +00:00
with lib;
{
options.homeManagerModules.tmux-sessionizer.enable = mkEnableOption "Enable tmux-sessionizer";
config = mkIf config.homeManagerModules.tmux-sessionizer.enable {
2024-12-15 10:16:25 +00:00
home.packages = with pkgs; [ tmux-sessionizer ];
2025-03-17 20:05:16 +00:00
home.file."${config.xdg.configHome}/tmux-sessionizer/default".source = "${
pkgs.writeShellApplication {
name = ".tmux-sessionizer";
runtimeInputs = with pkgs; [
tmux
];
text = ''
set +o errexit
set +o nounset
2025-03-17 20:05:16 +00:00
if [[ "$PWD" == "$XDG_REPOS_DIR/os" || "$PWD" == "$XDG_REPOS_DIR/personal" ]]; then
2024-12-07 00:20:47 +00:00
clear
return
fi
2025-03-25 00:36:27 +00:00
tmux new-window -d -n scratch
2025-03-27 19:11:00 +00:00
nvim .
clear
'';
}
}/bin/.tmux-sessionizer";
};
}