ivaaaan/smug

-i flag opens new sessions

codegoalie opened this issue · 3 comments

Describe the bug
Just found smug and really liking saving so may keystrokes setting up windows and panes! Thanks so much!

It's my understanding that if I use the -i flag, the new windows and panes should be opened in the current tmux session. However, smug seems to always open new sessions. Behavior appears to be the same with or without the flag.

Smug config

session: stream

root: ~/workspace/music/

windows:
  - name: player
    layout: main-horizontal
    commands:
      - cd player
      - ./start.sh
    panes:
      - type: horizontal
        commands:
          - cd stream-list
          - ./start.sh

Expected behavior
I would expect that when I pass the -i flag, any new windows from my smug config get created in the current session directly after the current window (as if I had created the new window manually)

Output of cat ~/.config/smug/smug.log

tmux has-session -t stream:
exit status 1
tmux new -Pd -s stream -n smug_def -c /home/codegoalie/workspace/music/
tmux neww -Pd -t stream: -c /home/codegoalie/workspace/music -F #{window_id} -n player
tmux send-keys -t @2 cd disney-stream-player Enter
tmux send-keys -t @2 ./start.sh Enter
tmux split-window -Pd -h -t @2 -c /home/codegoalie/workspace/music -F #{pane_id}
tmux send-keys -t @2.%3 cd stream-lister Enter
tmux send-keys -t @2.%3 ./start.sh Enter
tmux select-layout -t @2 main-horizontal

Smug version
v0.2.6

OS you're using
Linux 5.13.0-28-generic #31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

So, it seems -i will re-use a session with the same name, but not use your current session.

Additionally, through testing this it seems that not passing -i with an existing session of the same name fails to create new session/windows/panes.

I briefly looked through the code and it wasn't obvious what the fix for this was, but I'm happy to take a shot at fixing this with a little guidance.

Thanks again!

Hi. Thanks for the feedback. Fixed in v0.2.7

Works perfectly! Thanks!!! 🎉