aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2024-12-07 19:23:58 +0200
committerZhongheng Liu <z.liu@outlook.com.gr>2024-12-07 19:23:58 +0200
commita2bf84b09e02861c3a0258f0f4f16831c13e63b3 (patch)
treeb7ba88dda16c2e807d049627e5c5e99f68a9b523
parent712e45ca58174ad7b320bbaa12ec7a88ac4052d1 (diff)
downloadnixos-configuration-a2bf84b09e02861c3a0258f0f4f16831c13e63b3.tar.gz
nixos-configuration-a2bf84b09e02861c3a0258f0f4f16831c13e63b3.tar.bz2
nixos-configuration-a2bf84b09e02861c3a0258f0f4f16831c13e63b3.zip
feat: tmux configuration
script: added script to create tmux workspace tmux-config: sets dynamic variable defaultshell to tmux
-rw-r--r--home-manager/stvnliu/programs/tmux.nix2
-rw-r--r--home-manager/stvnliu/scripts/tmux-default.script.nix12
2 files changed, 9 insertions, 5 deletions
diff --git a/home-manager/stvnliu/programs/tmux.nix b/home-manager/stvnliu/programs/tmux.nix
index 55e3787..8522af8 100644
--- a/home-manager/stvnliu/programs/tmux.nix
+++ b/home-manager/stvnliu/programs/tmux.nix
@@ -6,7 +6,7 @@
}: {
programs.tmux = {
enable = true;
- shell = "${pkgs.fish}/bin/fish";
+ shell = config.myShells.defaultShell;
terminal = "screen-256color"; # Fix for apps not recognising full color
mouse = true;
plugins = with pkgs; [
diff --git a/home-manager/stvnliu/scripts/tmux-default.script.nix b/home-manager/stvnliu/scripts/tmux-default.script.nix
index 3f194d5..d2f71c6 100644
--- a/home-manager/stvnliu/scripts/tmux-default.script.nix
+++ b/home-manager/stvnliu/scripts/tmux-default.script.nix
@@ -6,9 +6,13 @@
windowName = "code-mode";
in
pkgs.writeShellScriptBin "tmux-code" ''
- #!/bin/sh
- ${tmux}/bin/tmux new -s ${windowName} -d
- ${tmux}/bin/tmux send-keys -t ${windowName} nvim C-m
- ${tmux}/bin/tmux split-window -h
+ #!${pkgs.bash}/bin/bash
+ ${tmux}/bin/tmux has-session -t ${windowName} 2>/dev/null
+ if [ $? != 0 ]; then
+ # setting up session
+ ${tmux}/bin/tmux new -s ${windowName} -d
+ ${tmux}/bin/tmux send-keys -t ${windowName} nvim C-m
+ ${tmux}/bin/tmux split-window -h
+ fi
${tmux}/bin/tmux attach -t ${windowName}
''