1

I usually start my second terminal from tmux by a cumbersome steps

1) Start a terminal ( I used alacritty)
2) initiate a tmux session tmux new -s 'main'
3) start a second terminal alacritty

The I closed the first terminal and work on the second one.

The steps is clumsy, since the first terminal invoked only as an intermediate.

How could start the first terminal(alacritty) directly from tmux?

Wizard
  • 2,891

2 Answers2

4

alacritty is a terminal emulator. It's the drawing on your GUI that lets you do thing as if you were on the console.

tmux is a terminal multiplexer like screen that lets you run multiple terminal sessions within a single terminal but that can remain active even if you end your terminal application or connection.

You can connect to tmux from within alacritty or any other terminal emulator or ssh, etc connection. You can even connect to the same session from multiple terminals.

  1. Start alacritty however you start it.

  2. Type tmux attach || tmux new to attach to an existing session or start a new one.

  3. Use tmux attach -t target-name || tmux new -s target-name to attach or create to a specific session.

Alternatively a script file:

~/bin/tmuxed:

#!/bin/bash
tmux attach -t MyFavSession || tmux new -s MyFavSession

Create a shortcut or edit the Alacritty menu entry to...

alacritty -e $HOME/bin/tmuxed

...to start alacritty with the tmux attach/new command automatically.

SHawarden
  • 865
2

Here's how I did it.

I went into my ~/.alacritty.yml file and set my default shell to run with the argument tmux:

shell:

program: /bin/fish

args:

- --login

- -c tmux

screenshot of my .alacritty.yml

Nmath
  • 12,333