A simple tmux wrapper that tries to be Object Oriented. Read more about the idea of OOP and tmux in this blog post.
curl https://raw.githubusercontent.com/patreeceeo/wootmux/main/wootmux.sh > wootmux.sh
See an example in another project or this project's own dev.sh.
You can't really do OOP in POSIX Shell. Instead, we use functions in the form of "wm_<object>_new" or "wm_<object>_new_" that creates an and returns its UUID. We can then use this UUID to perform further actions with this object.
my_session_id=$(wm_session_new "my_session") # Creates a session named my_session and assigns its UUID to my_session_id
[ wm_session_exists "$my_session_name_or_id" ] && echo "this session exists"
wm_session_attach "$my_session_name_or_id" # attaches client to given session
my_session_id=$(wm_session_current) # get UUID of current session
wm_session_kill "$my_session_name_or_id" # it's gone
wm_pane_new_left "$my_pane_id" # Split window containing $my_pane_id such that the new pane is to the left