Skip to content

Features

Stephen Millard edited this page Mar 18, 2023 · 3 revisions

Functionality

Ste-Mux was created as a way to provide easy access to start, end, and switch to tmux sessions. Since tmux sessions were really just commands on the command line, the plugin also includes ways to trigger SSH connections and any terminal instructions you might wish to give it.

The sections below highlight the core features and functionality of the plugin.

TMUX Management

As noted previously, the plugin was created to help manage tmux sessions. As well as being able to start new sessions, the plugin allows you to reconnect to sessions, terminate sessions, and provide information about the running sessions.

Start New TMUX Session

When you select the Ste-Mux icon (a castle) in the menu bar, it will reveal a set of menus and menu items. The actual display will vary based on what you have configured. A "TMUX" sub menu should always be available, and include an option to "Start New TMUX session".

Triggering this menu item will simply open a new tmux session in the terminal application. When the plugin refreshes (10 second refresh rate is the default), then you will see a number one appear next to the Ste-Mux icon. This indicates the number of tmux sessions running on the local machine.

This will increment up to nine sessions. If a tenth session is created, a "+" will be displayed from that point forward, until such time as the number of tmux sessions drops below ten. There is a Script Settings option to change this to actual numbers if you prefer.

If you have made configuration changes as per Adding Custom TMUX Entries, you may also have additional tmux session options that appear below the "Start New TMUX session" entry. These once again generate new sessions.

List Attached TMUX Sessions

Once at least one tmux session has been created, additional options will appear in the TMUX sub menu.

At the top of the menu, a list of attached sessions is provided. The entry provides a count, and lists the sessions as information only sub menu items.

In the screenshot below, we can see that there are three tmux sessions (from the menu bar), and of these two sessions are attached, meaning one session is running detached in the background. We can also see that the two attached sessions are called "0" (sessions initiated with "Start New TMUX session" will be assigned successive integers as names), and a named session called "Jekyll-PWS" (this is the session name for the Personal Web Site session entry in the listing below).

Attach to a TMUX Session

To attach to an existing tmux session, you can issue the attach command from a terminal command prompt, or you can select an entry from the "Attach to..." sub menu.

Note that it is possible to attach to a session that is already attached to. This could be useful in a teaching environment for example where you use a screen for yourself with notes and a terminal session, and project a separate screen with a terminal session to the class - and both terminals are displaying the same tmux session.

Terminate a TMUX Session

Terminating a tmux session is straight forward, but if a session is detached, then it generally means connecting to the session and then going through all the steps to close it down. If you really do just need to end a session, then Ste-Mux provides a list of running sessions under the "Terminate..." sub menu. Selecting one of these will issue a kill command for the tmux session, and it will close.

This will kill sessions that are attached to, and there is no confirmation, so please do use caution when using this feature.

Shell Script Trigger

As well as tmux interactions, you can also create other command line entries. By default the example commands that are deployed with Ste-Mux can be found in the "Custom Commands sub menu". Selecting a menu item will trigger the associated command.

You can find out more about custom shell commands and these example custom commands in Adding Custom Command Entries.