bins: port over tstart
This commit is contained in:
parent
4f2e1023d6
commit
92dbb2474a
@ -7,7 +7,9 @@ let
|
||||
(import ./check-restart.nix { inherit (pkgs) perl; });
|
||||
xinStatus = pkgs.writeScriptBin "xin-status"
|
||||
(import ./xin-status.nix { inherit (pkgs) perl perlPackages; });
|
||||
|
||||
tstart = pkgs.writeScriptBin "tstart" (import ./tstart.nix {
|
||||
inherit (pkgs) tmux;
|
||||
});
|
||||
sfetch = pkgs.writeScriptBin "sfetch" (import ./sfetch.nix {
|
||||
inherit gosignify;
|
||||
inherit (pkgs) curl;
|
||||
@ -18,6 +20,7 @@ in {
|
||||
checkRestart
|
||||
ix
|
||||
sfetch
|
||||
tstart
|
||||
xclip
|
||||
xinStatus
|
||||
];
|
||||
|
40
bins/tstart.nix
Normal file
40
bins/tstart.nix
Normal file
@ -0,0 +1,40 @@
|
||||
{ tmux }:
|
||||
let
|
||||
tmuxBin = "${tmux}/bin/tmux";
|
||||
in ''
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
SNAME="Main"
|
||||
SSES="-s $SNAME"
|
||||
IDX=1
|
||||
|
||||
if ${tmuxBin} ls | grep -q "^''${SNAME}:"; then
|
||||
${tmuxBin} -u2 at -t "$SNAME"
|
||||
else
|
||||
${tmuxBin} -2 new-session -d $SSES
|
||||
if [ -e ~/.tmux.windows ]; then
|
||||
count=$IDX
|
||||
for n in $(cat ~/.tmux.windows); do
|
||||
if [ $n == "_" ]; then
|
||||
${tmuxBin} new-window
|
||||
else
|
||||
if [ $count -eq $IDX ]; then
|
||||
${tmuxBin} rename-window "$n"
|
||||
else
|
||||
${tmuxBin} new-window -n "$n"
|
||||
fi
|
||||
fi
|
||||
((count=count+1))
|
||||
done
|
||||
else
|
||||
${tmuxBin} rename-window "IRC"
|
||||
${tmuxBin} new-window -n "Mail"
|
||||
${tmuxBin} new-window -n "Misc"
|
||||
${tmuxBin} new-window
|
||||
fi
|
||||
${tmuxBin} select-window -t$IDX
|
||||
${tmuxBin} -2 attach-session -t $SNAME
|
||||
fi
|
||||
''
|
Loading…
Reference in New Issue
Block a user