about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-16 19:15:54 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-16 19:15:54 -0700
commita15a9c6c4d268f3cb667219c79778ff476ec0a5e (patch)
treedfdb9e7adf8084194a4362fafffba3903e3db997
parentbluetooh: enable on aptos (diff)
downloadworld-a15a9c6c4d268f3cb667219c79778ff476ec0a5e.tar.gz
zsh: manage tmux and start sway
If login, start sway. If tmux is not running, start it.
Diffstat (limited to '')
-rw-r--r--home/zsh/default.nix14
-rw-r--r--home/zsh/tmux.zsh3
2 files changed, 16 insertions, 1 deletions
diff --git a/home/zsh/default.nix b/home/zsh/default.nix
index 392ccfc..0ee9e43 100644
--- a/home/zsh/default.nix
+++ b/home/zsh/default.nix
@@ -31,13 +31,25 @@ in {
         REPORTTIME = 5;
       };
 
-      shellAliases = { ll = "ls -l --color=auto"; };
+      shellAliases = {
+        ll = "ls -l --color=auto";
+        lt = "ls -ltrh --color=auto";
+        drone = "DRONE_TOKEN=$(pass api/drone.fcuny.xyz) drone";
+      };
 
       defaultKeymap = "emacs";
+
+      initExtraFirst = ''
+        if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
+          exec sway
+        fi
+      '';
+
       initExtra = lib.concatMapStrings builtins.readFile [
         ./completion-style.zsh
         ./options.zsh
         ./prompt.zsh
+        ./tmux.zsh
       ];
     };
   };
diff --git a/home/zsh/tmux.zsh b/home/zsh/tmux.zsh
new file mode 100644
index 0000000..4120512
--- /dev/null
+++ b/home/zsh/tmux.zsh
@@ -0,0 +1,3 @@
+if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
+  tmux attach -t default || tmux new -s default
+fi