aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2021-10-21 18:53:44 -0400
committerRyan Kavanagh <rak@rak.ac>2021-10-21 18:53:44 -0400
commit368afcc75ba328b0c2bd65854540f1642c734dbd (patch)
tree129d7fc8d2e25d7dd8eaa868d5a1ef07350246d5
parentgoodbye SCS kerberos/afs :( (diff)
improvements to tmcg
Diffstat (limited to '')
-rwxr-xr-xbin/tmcg27
1 files changed, 20 insertions, 7 deletions
diff --git a/bin/tmcg b/bin/tmcg
index fe68830..d94abbc 100755
--- a/bin/tmcg
+++ b/bin/tmcg
@@ -1,11 +1,24 @@
#!/bin/sh
-if ! tmux switch -t mail:catgirl >/dev/null 2>&1; then
+current_session () {
+ tty=$(tty)
+ for s in $(tmux list-sessions -F '#{session_name}'); do
+ tmux list-panes -F '#{pane_tty} #{session_name}' -t "$s"
+ done | grep "${tty}" | awk '{print $2}'
+}
+
+SESSION=$(current_session)
+
+if [ "x${SESSION}" = "x" ]; then
+ SESSION="irc"
+ tmux new-session -s "${SESSION}" -d
+fi
+
+if ! tmux switch -t ${SESSION}:catgirl >/dev/null 2>&1; then
tmux new-window -c '~' -n catgirl catgirl libera
- tmux split-window -t mail:catgirl -c '~' catgirl oftc
- tmux split-window -t mail:catgirl -c '~' catgirl sdf
- tmux split-window -t mail:catgirl -c '~' catgirl tilde
- tmux split-window -t mail:catgirl -c '~' catgirl bitlbee
- tmux set-option -t mail:catgirl remain-on-exit on
- tmux selectl -t mail:catgirl tiled
+ tmux split-window -t ${SESSION}:catgirl -c '~' catgirl oftc
+ tmux split-window -t ${SESSION}:catgirl -c '~' catgirl sdf
+ tmux split-window -t ${SESSION}:catgirl -c '~' catgirl tilde
+ tmux set-option -t ${SESSION}:catgirl remain-on-exit on
+ tmux selectl -t ${SESSION}:catgirl tiled
fi