Live data from Hacker News

Show HN: Terminal Multiplexer Inspired by I3

github.com

41–45 of 45 posts

Re: Show HN: Terminal Multiplexer Inspired by I3

#41

This https://github.com/jabirali/tmux-tilish is a different solution with a similar goal - to make tmux work more like a tiling WM.

Hey, thanks for linking to my project! :)

For other people that might be reading: the main difference between these projects is that 3mux is a tmux replacement, while tilish is a tmux plugin. Thus, 3mux is a much larger and more complex undertaking, but you can more easily get tilish up and running anywhere (just copy over a tmux.conf).

But I believe both have the same motivation: "porting" the i3wm user experience and keybindings to terminals. 3mux is also very cool, and I'll be keeping an eye on it myself :).

If you try out tilish, I'd be happy to receive any feedback!

Re: Show HN: Terminal Multiplexer Inspired by I3

#42
post #3

This looks awesome! The modifier key seems to be Alt, which is also default on desktop i3 windows manager. I wonder if it's going to interfere - eg. pressing Alt+Enter will simultaneously open new window both in multiplexer and on my desktop?

> This looks awesome! Thank you!! > I wonder if it's going to interfere My understanding is that i3 would intercept the keypress, not passing it onto the terminal. While I want 3mux to work with i3, I decided to choose defaults that appeal to the audience that would need 3mux most (i.e. non-i3 users). I plan to soon make the key bindings configurable.

Hi again :).

I agree that non-i3 users need it the most, but have one use case in mind where you might want to combine i3wm + 3mux: remote work. If you ssh into a remote computer, you can not easily spawn new remote terminals. Having one terminal that runs ssh + 3mux lets you use i3wm-like keybindings inside the terminal to open remote splits and tabs with similar keybindings as you would locally. In particular, setting the i3wm $mod to super would make super+enter, super+hjkl, etc. act on local windows, while alt+enter, alt+hjkl, etc. act on remote windows. In a sense, ssh + 3mux would act as a "i3wm-style remote desktop".

If I understand correctly, 3mux does not have session management, but combining 3mux with abduco or dtach should solve that. (And arguably be a more Unix-philosphy solution.)

I think the best way to combine i3wm and 3mux would however be to change the i3wm $mod to win/super, instead of trying to use different modifiers in 3mux. As far as I know, no common terminals support other modifiers than ctrl and alt, and ctrl would collide with most terminal programs. (In tilish, I ended up offering a prefix key as an alternative to alt for people using Kakoune or Emacs.)

Re: Show HN: Terminal Multiplexer Inspired by I3

#43
post #22

The quality of a terminal multiplexor is is in part determined by the quality of the terminal emulation. Unfortunately, this one leaves a lot out. * The ECMA-35/ECMA-48 escape sequence and control sequence processing is wrong. It is a common error made by people who have read escape sequence lists, but the actual way to process output to a terminal involves a proper state machine, which handles all sequences, even un…

Thank you so much for this very helpful list. I'll integrate its suggestions into 3mux.

https://unix.stackexchange.com/a/289871/5132 might help too.

Re: Show HN: Terminal Multiplexer Inspired by I3

#44

Hey HN, I'm a long-time user of i3 (now sway). I wrote this tool to provide the elegance of i3 to terminal users everywhere, especially for people like myself who sometimes use a non-i3 wm or no window manager at all (e.g. when testing code on a bare-bones raspberry pi). Cheers!

Looks awesome, thanks for sharing! I've been using Byoyu[0] which has a similar goal, but I'm keen on trying out. Even though I've been a long-time tmux user, as a developer I don't even know where I would start if I wanted to build my own terminal multiplexer. Can you share some resources etc on what could a good starting point if I want to explore this as a side-project? [0] https://www.byobu.org/

See https://unix.stackexchange.com/a/579359/5132 for the most common architecture. It's roughly the architecture of tmux and screen. It's roughly the architecture of http://jdebp.uk./FGA/bernstein-on-ttys/sess.html , too.

I have a somewhat different, layered, architecture with finer grained components. The terminal emulators, multiplexor, input method handler, and realizers are all separate processes, and the communication among them is via (memory-mapped) regular files and FIFOs.

* http://jdebp.uk./Softwares/nosh/guide/user-virtual-terminals...

It's more rigid in the multiplexing layer, with little notion of creating and destroying inner terminals on the fly and no notion of windows or panes, because it was initially created to be a user-space workalike for the kernel virtual terminals in Linux and FreeBSD, that are derived from SCO Multiscreen. So there's just the notion of a fixed set of virtual terminals, presented one at a time, with the Alt+function-key switching and a replacement chvt command.

It's more flexible in other ways, though. The components of the system are replaceable, and don't have to be put together in this particular way. There's no reason that one couldn't write another type of emulator, handling a completely different suite of escape and control sequences, and just plug it in alongside the existing one. And there's similar flexibility in the other layers: one can (and I do) simultaneously realize the same set of multiplexed terminals onto a remote terminal over an SSH connection as well as directly onto the local machine's framebuffer and keyboard(s). It could be realized onto X11, or (if someone finally documents the undocumented Mosh protocol) a Mosh client.

Indeed, there's no reason that a more complex multiplexing layer couldn't be substituted, providing something more like the screen/tmux paradigm, with the multiplexor starting up subordinate shell and terminal-emulator processes on the fly and compositing the lower screen buffers. But I didn't set out to reinvent screen/tmux. I set out to do virtual terminals in user-space instead of the kernel, with application mode code almost none of which (apart from the stuff that grants access to the framebuffer and keyboard devices) needs or runs with superuser privileges, and where the components are isolated even from one another.

See the StackExchange answer that I hyperlinked to for more on the actual terminal emulation part.

Post reply on HN