Readit News logoReadit News
spudlyo · a year ago
In case you're like me, and you wouldn't think of using a terminal without Tmux, the experimental sixel branch was finally merged[0] as of about 10 months ago. This means you can finally build mainstream Tmux with --enable-sixel and use tools like lsix in Tmux!

If you're curious if your favorite terminal or multiplexer supports sixel, you can check out the "Are We Sixel Yet"[1] site.

[0]: https://github.com/tmux/tmux/commit/dfbc6b1888c110cf0ade66f2...

[1]: https://www.arewesixelyet.com

cosmojg · a year ago
I switched to Zellij[1] a few years back, and I've been enjoying Sixel support since sometime in 2022. If you're looking to shake up your workflow, I find it's a vastly superior experience to tmux out of the box. It ships with all the features I would otherwise add through external plugins and convoluted configuration scripts by default while remaining significantly more stable and more performant.

[1] https://zellij.dev/

Vegenoid · a year ago
My favorite feature about Zellij is the ability to have as many floating panes in arbitrary locations as desired. The way it works is that there are 2 "layers" of panes: the normal tiled panes, and a layer of floating panes that exists in front of the tiled panes. The floating layer can be toggled on and off, and the floating panes can be overlapping with each other. I have my ordered tiled panes that I work on normally, and then I can bring up my messy desktop of panes that I have lots of freedom in how I organize, more akin to an actual desk.

It's a bit silly, and certainly not necessary, but I like it a lot.

mehdix · a year ago
I can only second this comment. I discovered it a while back and it has been a pleasant experience ever since. I still use both though, depending on availibility.
emptysongglass · a year ago
I'm not sure I understand the use of tmux. Can someone explain why it's essential to their workflow and why it might end up being essential to mine?
chrisamiller · a year ago
At any given time, I'm working on like 10 different projects. tmux lets me set up sessions for each of these projects, so that when I leave one and come back in a week, all the context is there (multiple windows, bash history, working directories I was in, etc)

Since I work with big biological data, most of my work takes place on our university cluster, which means my laptop is just a dumb terminal and all of the action takes place on the server. IME, tmux is especially powerful with coupled with mosh, which gives a persistent SSH connection. That means I can be in the middle of a project, close my laptop lid, go home, then later that evening, open my lid and everything is reconnected and just right there. Same if I reboot my laptop - one command to reconnect my terminal with mosh, and I'm back in the middle of my complicated multi-window project.

spudlyo · a year ago
Tmux provides a means multiplexing a single terminal window into multiple terminals, either full screen, or like a tiling window manager. It lets you organize and label these terminals and provides a very flexible keyboard interface to terminal management, including history scrollback, search, etc. I started using GNU Screen in the early 90s, and over the years I have developed a keyboard muscle memory for managing multiple terminals in this fashion that is completely independent from whatever terminal program I'm using. This allows me to utilize this keyboard muscle memory if I'm using iTerm2 on macOS, Windows Terminal, or Alacrity on Linux.

Many fancy terminal programs offer some subset of these multiplexing features (like tabs) and such, but in my experience none of them are as configurable or as feature rich as Tmux.

michaelmior · a year ago
Personally I find the small shell function below really helps my tmux workflow. Run it with no arguments and you'll get a list of available sessions. Run it with a session name and it will start the session if it doesn't exist or reattach if it does. If you're already in one tmux session, it will just switch over your client to that session.

The function below will also automatically detach other clients, but for me it's what I want since other clients are always just me on another machine, often with a different screen size.

    tm () {
        if [ -z $1 ]
        then
            tmux list-sessions
            return
        fi
        tmux detach -s $1 2> /dev/null
        if [ -n "${TMUX+1}" ]
        then
            tmux switch-client -t $1 2> /dev/null || tmux new-session -s $1
        else
            tmux attach-session -t $1 2> /dev/null || tmux new-session -s $1
        fi
    }

kabr · a year ago
Saved terminal state. Multiple tabs. Can log off and come back and everything’s there. tmux and mosh are game changers, especially while tethering/roaming and switching networks.
aloer · a year ago
Anyone here who can answer this as well in the context of local work on a Mac? I manually use tmux when sshing into servers but usually that’s one session split in two and that’s it.

Locally I use iterm2 with a single hotkey window but multiple tabs with one per project and then up to 8 panes per tab. These stay open for many months until the inevitable restart for system updates. I feel like I have pretty good persistent terminals this way.

But would there be any benefit for me using tmux locally? I know that iterm2 has some kind of integration with it but I‘ve not tried that

mostlysimilar · a year ago
I like tmux for keeping a remote session open but I don't use it for my local machine. On my local machine the only thing it would really buy me are tabs/split panes, and iTerm does those things natively and far better than tmux does.
PhilipRoman · a year ago
Aside from tabs/panes/persistence already mentioned, it serves as a portable, programmable layer that will work anywhere, whether on the client or server side. I set up my key bindings once and now they work over SSH from Windows, local terminal emulator, on a Linux framebuffer console or even through a serial port. While I do use a tiling/tabbing window manager, tmux is just really good at what it does so I still keep using it for my terminals.
bee_rider · a year ago
It provides all of the useful functionality of a window manager (hosting multiple terminals) but you can run it in a terminal.
jeppester · a year ago
A use case I haven't seen mentioned - from skimming the comments, is that multiple users can connect to the same tmux session.

It does a good job at scaling the session to fit the size of each client's terminal window and has multiple scaling options available.

In my experience it works way better than for instance terminal sharing in VS Code.

arlort · a year ago
Plenty of great use cases have already been pointed out, but what I also love is that sometimes I get carried away and use the close window keybind on the wrong terminal, with tmux set to create a new session when the terminal is launched (which isn't closed unless all shells in the sessions have excited) I just use a keybind to spawn a terminal attached to any unattached sessions and never again have to recreate 10 different panes in different working directories on different windows

Also let's my colleagues monitor my builds on our shared server pretty easily and it's better than screen sharing

Deleted Comment

TheAdamist · a year ago
I find the split screen capability very useful for terminal use, but i'm only a more basic user
mason_mpls · a year ago
tmux + vim with some plugins is a really good developer experience, it makes it really easy to leverage command line tools
digitalsushi · a year ago
why would you want browser tabs?
freedomben · a year ago
lots of good answers already. my tldr: it's a terminal-agnostic tool to split a window vertically or horizontally so you have multiple shell sessions on the same screen (and can move between them). Lots of other great reasons too but that's the major one IMHO.
kaba0 · a year ago
But.. why? Why would I want to force pixel graphics into a text-based, low-resolution matrix, when.. I could just do pixel graphics?
vmfunction · a year ago
There are many terminal users, check their email in terminal, and use browser like Links, Links2, and would like to be able to see pictures sometimes.

Also graphics response in terminal are blazing fast, and compared to whatever is happening in the Apple, MS and Gnome GUI environment that are just getting sluggish by the version upgrade. More and more I just want to do everything in terminal, and not have to deal with all this GPU acceleration BS that is happening. Give me the UI in pixels likes it is 1980's. Most of times just want to do my work, We don't care if there is some anti-aliasing or shadows under the text.

jph00 · a year ago
Console-based analysis over SSH is much easier when your console tools can just output charts etc directly to the terminal. Also image processing scripts are easier to write when you can directly view the images created at each stage of the process.
freedomben · a year ago
I'm a long time tmux user (and screen before that), but I don't understand why sixel makes a difference.

Is this as big as bring a stacking window manager to tmux (compared to the current which is tiling)? Or is just better graphics in the terminal? or am I way off here?

If it's just the better graphics, then I'm not sure I understand why tmux needs to support it. I would think the terminal emulator (such as Gnome terminal) is what would matter. I suppose maybe both but I would think tmux would just pass through.

aidenn0 · a year ago
You can't just pass through things; what happens when you resize, (re)attach, switch tabs &c.

Tmux needs to know that there are graphics on the screen and redraw in any of those situations.

rkangel · a year ago
Terminals and shells aren't like window managers where you can just subdivide your drawing space and pass a block pixels to something else to draw on.

What the terminal processes processing is a stream of bytes from the shell and needs to be able to interpret them in order to lay things out correctly.

adregan · a year ago
Do you happen to know if sixel is enabled when tmux is installed with brew?
fragmede · a year ago
It doesn't. If you run brew edit tmux and add args << "--enable-sixel" after line 76 and then run brew uninstall tmux and brew install --build-from-source tmux, you'll get one where it is.
thecosmicfrog · a year ago
I think my favourite feature of this repo is the `README.md.d` directory. That's actually a nice idea. Could maybe drop the `.md` I guess.
enriquto · a year ago
> I think my favourite feature of this repo is the `README.md.d` directory.

The real power move here would be to embed the images as verbatim sixel inside the README file. Thus you could cat README and see them in all their glory.

omoikane · a year ago
Uses "\e[c" to automatically detect sixel support:

https://github.com/hackerb9/lsix/blob/3a431793a747df3f934051...

"\e[c" is "send device attributes":

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-F...

metadat · a year ago
Awesome idea, but doesn't work under PuTTY/KiTTY:

  $ lsix
  Error: Your terminal does not report having sixel graphics support.
  
  Please use a sixel capable terminal, such as xterm -ti vt340, or
  ask your terminal manufacturer to add sixel support.
  
  You may test your terminal by viewing a single image, like so:
  
  convert  foo.jpg  -geometry 800x480  sixel:-
  
  If your terminal actually does support sixel, please file a bug
  report at http://github.com/hackerb9/lsix/issues
  
  Please mention device attribute codes: ^[[?6c
Too bad! That would be pretty spiffy.

Is there an open-source windows terminal which supports Sixel? Mostly seems only Cygwin or WSL stuff out there, nothing pure?

krs_ · a year ago
I started using wezterm recently and really like it. It's cross platform and supports sixel graphics.

https://github.com/wez/wezterm

krs_ · a year ago
I can no longer edit my post. I just saw that apparently it doesn't work with wezterm on Windows. Sorry about that.

https://github.com/hackerb9/lsix/issues/69

shrx · a year ago
I don't really like that they're including so much non-core functionality. Why should a terminal emulator provide its own multiplexer, ssh client and serial connection libraries, instead of using those already available on the operating system?
jph00 · a year ago
Mintty is an excellent windows terminal with sixel support fyi.
smcameron · a year ago
Along similar lines, timg : https://github.com/hzeller/timg
8xeh · a year ago
Another that I've used: https://github.com/posva/catimg
oxygen_crisis · a year ago
iTerm2 for MacOS has similar functionality baked in, but less demanding on the server side.

Rather than using a ton of server-side image libraries to render the picture into sixels on the server, it just sends a base64-encoded copy of the whole image to the client where it can determine the image type and render it into the terminal locally.

https://iterm2.com/documentation-images.html

qiqitori · a year ago
konsole implemented the same protocol; I use their unmodified imgcat script on Linux. It's of course much faster than converting using imagemagick, still added lsix to my bin directory for now. :)
aftbit · a year ago
Be careful running this on an untrusted directory, especially with e.g. pdfs, just like anything else that parses images, especially using ImageMagick.
aniviacat · a year ago
Is parsing untrusted images inherently problematic?

If I open my (untrusted) downloads folder using Gnome Files and it displays (and therefore parses) the contained images, is that a security issue I should be concerned about?

(I would have assumed that (e.g.) Javascript in PDFs could be problematic, but not a simple preview.)

tedunangst · a year ago
Random example that doesn't even require opening the directory.

https://github.blog/2023-10-09-coordinated-disclosure-1-clic...

J_tt · a year ago
Unfortunately, it can be a vector[0], especially on less security focused software that has less sandboxing.

0: https://www.cvedetails.com/vulnerability-list/vendor_id-7294...

forgotpwd16 · a year ago
As long as terminal used supports sixel graphics.
dheera · a year ago
I wrote a graphics library for non-sixel terminals

https://github.com/dheera/python-termgraphics

Might be interesting to mod this library to support this as a fallback.

wonger_ · a year ago
Looks good! I've seen a few such libraries. My favorite is chafa: https://hpjansson.org/chafa/
tambourine_man · a year ago
A labor of love, congratulations.
kps · a year ago
xterm supports sixel, so surely anything that sets TERM=xterm256-color or similar will be compatible… right? ∗cough∗ gnome-terminal ∗cough∗
spudlyo · a year ago
xterm supports sixel, so surely if your TERM is xterm-kitty, it's supported right?
alexvitkov · a year ago
Why do we now have User-Agent in the terminal ;-;
ok123456 · a year ago
mlterm works