-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kitty tmux like daemon #391
Comments
Good, one of my goals with kitty is to obviate the need for tmux like hacks (they waste CPU cycles and causes lots of rendering bugs). However for resuming sessions, I'm not sure what you mean exactly. kitty can define sessions to run startup programs and set windows/tabs etc. For resuming running programs, there are lots of questions:
|
Lets consider:
The ideal feature would have the following: 1. Attach locally or to remote serverI can connect to a remote server and have a kitty session already started there, to which I can attach;
I'm not sure what this means or if it's even possible, but I hope you see where I'm going with this. The idea I have in mind looks something like:
2. Killing (closing) kitty should not kill kittydSo, the running programs should not be suspended when UI is killed. The output should be kept limited to the same limit current kitty implementation uses and should be sent to the UI when it attaches to the session again. 3. Multiple sessions can be defined in one kittydWhen kitty attaches to kittyd, it can specify which available session should be rendered. 4. kittyd should have a one-to-many relationship with kittyOne kittyd should be able to provide stream of data to multiple attached kitty(s). 5. kitty should have a one-to-one relationship with kittydOne kitty can only attached to one kittyd. |
There are issues with that.
|
Regarding point 2,
One of the main reasons tmux is useful for local connections is the ability to recover from accidentally closing the terminal window instead of minimizing or hiding it (the MacOS kind of hiding). That ends up saving me from losing work on a frequent basis. |
Another reason tmux is useful for local connections is the easy ability to switch between working locally and remotely. If I've been working in a tmux session at my work machine, it's very easy to go home and resume the same session from my laptop. It is harder to add a session you started outside of tmux to a tmux session after the fact (though there do exist tools, e.g. https://github.com/nelhage/reptyr, to do so). Also, not all window managers support easy minimization (in particular, I use i3, which does not have minimization as far as I know. There's the scratchpad, but this is not quite the same imho). |
@sheriferson A simple confirm on close would take care of that. @wbthomason I use i3 as well, and I simply move a terminal to an unused desktop when I want it out of the way, that is exactly the same as minimizing. |
@kovidgoyal Yep - my continued use of tmux is much more due to the first reason I mentioned than that. |
Well, yeah, like I said, I can see the use for remote connections, local not so much. Of course if I were ever to implement support for remote connections, you could always use the daemon locally as well. I'll leave it open as an enhancement, but as this is a fairly large job and I have no use for it personally, unless someone steps up, its not likely to get implemented any time soon. |
Thanks for keeping the idea open. For now, I'll keep using tmux with it's statusbar hidden :) . |
tmux is also useful for sharing windows between terminal instances, through Another thing is that, unlike kitty sessions (as far as I can tell), a tmux multi-session setup doesn't commit the user to actually opening all of the possible terminals. You can open and close them at will. With kitty right now, it seems that there has to be an open terminal window for any set of tabs you configure. |
@neverfox Wouldn't the right way to have a particular window available on all desktops be to make it sticky in your window manager? Why use tmux for that? In any case, a daemon can easily allow read-only access to a particular window by multiple clients. |
@kovidgoyal It's not a particular OS window that I want to share across desktops, but a particular tmux window (the equivalent to a kitty tab). For example, I have a terminal open on each of three desktops. Each might have a custom set of tabs on it. I like one of those tabs to be, say, weechat (the same weechat, as weechat doesn't by default like multiple instances running):
A window manager can do nothing for me here, because it's state internal to an OS window. Tmux lets me do this, though its session restore capabilities are lacking in preserving that state, which is annoying. The way states are serialized doesn't record that the window was linked and so they get restored as separate windows. |
@kovidgoyal To combat the "the daemon is a TE" thing, you could add an option to kitty which would prevent it from rendering and invoke daemon-specific logic. |
Another scenario I use tmux locally for is to be able to close kitty and reopen it with a new configuration, without losing my open windows. E.g., when I want to change the current font, and I have something like 5-6 panes open, I edit the kitty config file, detach my running tmux instance, restart kitty and reattach back to my tmux session. I know I can change the font size, but I still haven't found a way to change the font face. |
I may be misunderstanding this, but as far as I am concerned, an URXVT daemon for example, has a major use case for local usage, since It effectively becomes the main terminal and the children/clients become very minimal as a result. It also reduces ram usage, for the primary system, which is quite significant if you're running half a dozen terminals. |
Have you tried For me:
|
I'm not sure how I managed to overlook that, this is exactly what I've been looking for. This is the exact functionality I wanted from a daemon, so consider my use-case fulfilled. |
@VGrol Just FYI, a 1.3s startup time is not normal. On my four year old laptop kitty starts up in 0.2 secs and on my dev machine in 0.1 secs. There have been a few reports of slow startups on some linux systems, but no one has ever bothered to investigate, and since I cannot replicate, I cannot investigate. |
I kind of figured that much, but I don't really know what to tell you. I noticed that my super old, modded laptop doesn't have those startup issues, yet it runs a nearly identical environment, so I'd almost think It'd be related to hardware boogaloo. |
Yeah feel free to open a separate issue -- note that you have to be willing to run kitty from source and make some simple code modifications to investigate. |
@kovidgoyal: Taking reference to your message from Mar 16: Personally I would love to have something that could completely replace tmux, while being actually fast to render:
I could imagine a iterm style tmux integration, but I probably wouldn't mind installing a headless kitty server on my servers :) |
The main advantage of tmux and screen besides remote sessions was for me always the independence of the window system. I can kill everything related to Xorg or Wayland and come back reattach to the session as if nothing happened. |
Wow! I have been using multiplexers for over 20 years (physical ones before that) and would never suffer the hubris to insult them like that. |
On Tue, Feb 09, 2021 at 10:41:45PM -0800, Darkermatter wrote:
> I have explained before why multiplexers are a horrible hack.
Wow! I have been using multiplexers for over 20 years (physical ones before that) and would never suffer the hubris to insult them like that.
So, you using something for 20 years means it is not a horrible hack??
What brand of logic is this?
Instead of making content free posts and spamming people's inboxes, if
you have something substantive to say, try responding to my actual
criticisms of terminal multiplexers, posted above, in
#391 (comment)
|
They might be a "horrible hack", but right now they are the only way to have persistent sessions inside terminals, yours included. Criticism is ok, as far as there is a viable alternative that answers the same user needs. If I need to close kitty for any reason (e.g. change font), or I need to connect from another device on the same network and keep working, right now I need to use those "horrible hacks", otherwise I have to kill all my running processes and start them over. These two scenarios are fairly common in my daily work and that's why I'm using tmux inside kitty. |
On Tue, Feb 09, 2021 at 11:00:56PM -0800, Andrea Schiavini wrote:
They might be a "horrible hack", but right now they are the only way to have persistent sessions inside terminals, yours included. Criticism is ok, as far as there is a viable alternative that answers the same user needs. If I need to close kitty for any reason (e.g. change font), or I need to connect from another device on the same network and keep working, right now I need to use those "horrible hacks", otherwise I have to kill all my running processes and start them over. These two scenarios are fairly common in my daily work and that's why I'm using tmux inside kitty.
So use the horrible hacks, no one is stopping you. Doesn't change the
fact that they are horrible hacks, and should be called horrible hacks.
|
Sharing my current solution to the problem: This will at least make navigation between tmux and Kitty seamless. Until the ideas in this thread is implemented, I think this is the best option for us. |
Why are we defending tmux here? Don't distract from Kovid with this apologia. He's 30 mg of adderall and a midnight hack session away from changing the way you do everything again. It'll come. Be the wind in the sail, not the anchor. He says
|
A persistent connection can be done by having two kitty terminals running local and remote and mirroring those two kitty terminals over network, no? The mirroring part is the missing piece and I'm not sure if the author is interested in or not, though.
|
This is my ssh (to be precise,
I'm very interested, what other software combinations do this? |
You have your tools that meet your needs. Others, like myself, would prefer to avoid tmux so that all the modern features in Kitty are actually usable by shell programs, such as synchronous screen updates, clipboard access, and working keyboard modifiers other than alt. Everyone can win here, there is no need to argue about which tool is better. |
Please have a look at: You could then integrate this with kitty's native window, tab and pane preset configuration. The useful state of a session, for me basically e.g. windows, tabs and panes, scrollback buffers and command history, should be diverted elsewhere as declarative configuration and event logs, if we want to keep our systems composable and following a functional/unixoid stdin > process > stdout pattern. Such a "stateless" approach to our recurring connections helps us not to worry about losing history, while still profiting from the versatility of adaptive views on and into our infrastructures. The more we move into direction of infrastructure-as-code cloud environments, direct root access to individual machines and their state becomes less and less important - think the cat-and-cattle discussion - because these side effects are handled by the cluster abstraction. Meaning multiplexing shell sessions becomes also less and less important, when we primarily talk to our infrastructure via declarative configuration in git and APIs. |
Terminals are stateful output devices. There is no way around that, although in extremely simple use cases this fact can sometimes be ignored. For the use case that this issue is intended to solve, namely a persistent session on a remote development machine, ignoring state would be extremely counter-productive. I use a Mac laptop as a "thin client" of sorts to a personal Linux server where I do all my real work (editing files, interacting with git, running simulations). Persistent, resume-able, stateful terminal sessions are necessary for this model. |
I might not understand this like the other two things but there is OSC 52, you can use it with tmux+kitty already. |
In order for everybody to win, some client needs to support all of the features. |
Most of us probably use tiling window managers. Have you considered it? What advantage does your tmux provide other than the ability to connect remotely to the multiplexer? Locally I can't see any advantage if you have tiling wm. So for me, and probably many others it's rather useless. We get this functionality, and it works with browsers and other gui apps. Check out Yubai if you're on OSX. i3 or sway if you're on Linux. All the terminals in this video are Kitty. |
That is an unsubstantiated assumption. Even if you are right that most are, what does it matter, because certainly not all are? The kitty developer may decide in the end that implementing tmux-like functionality for kitty is not worth it from their point of view. But that still doesn't mean that the need of such functionality multiple people are expressing throughout this issue is misguided.
For me, see the original message in this issue report: Persistence, i.e., resuming after a WM crash, for example. That, in combination with multiplexing. |
I guess this must have been said somewhere above, but for those who want persistent session and multiplexer without tmux:
Currently I use |
This issue is about implementing a daemon for persistence of sessions in kitty. It is not about the merits or otherwise of tmux. If for some absurd reason you are wedded to tmux, then good luck to you. kitty is never going to integrate tmux specific features, as tmux and terminal multiplexers in general are an anti pattern. Someday, I will get around to implementing a daemon for persistence of tty sessions in kitty. That will be more robust, feature-rich and efficient than any terminal multiplexer. Kindly restrict discussion on this issue to the design and features of such a daemon. In particular, if you are willing to work on such a daemon, or you have ideas about how it should work, I am happy to hear from you, otherwise, please stop spamming my inbox. |
a brighter day is coming, my friend =] if you have any suggestions to give regarding general/detailed notcurses design, i would continue to appreciate your learned commentary. i'm really hoping it resolves a lot of the pain points and annoyances of ncurses. |
You keep repeating this ad nauseam despite offering no evidence for your outlandish assertion, while repeatedly demonstrating no comprehension of what whey do nor what they're for, along with an absolute pig-headed unwilingness to learn. I'm literally shaking with anger at your reprehensible behaviour in this thread. Just delete this issue entirely; it's poison. |
I suggest you first learn to read. The learn to reason. The go soak your head. |
This is how wezterm solved this feature: https://wezfurlong.org/wezterm/multiplexing.html It also works with remote hosts/serial connections and unix sockets. |
I do agree it is an anti-pattern for local terminals. But the one place I find multiplexing very useful is in shared remote sessions. I'm often using remote shared terminal sessions for tech support and trouble shooting so that all parties connected can observe what is going on. (Usually use tmate for this) Often I need more than one shell instance, and it is handy to be able to be able to do that directly within the shared session. Without the multiplexing, all connected parties would have to manually add a new connection for each new shell instance. Not overly complex, but tedious. The tabs feature within kitty would be sufficient for this purpose, but for that to work it would (if I understand correctly) need to be something managed by the persistence daemon. Bonus points if the persistence daemon could integrate with xterm.js or something similar for remote web browser based connections similar to tmate. My employer uses ms-teams quite a bit, and being able to add a website tab (web based tmate session) to a channel is perfect for managers who may know nothing about terminals but still want to observe what is going on. Probably beyond the scope of what the kitty project is willing to take on, but I dare to dream. |
As it wasn't already mentioned here before, and wezterm already made its notable appearance in this thread, and because of kitty decidedly never being a terminal multiplexer, I am mentioning https://github.com/zellij-org/zellij Zellij allows you to implement a terminal multiplexer that is not tmux or screen independent of the terminal emulator that you are using. |
I think this would be a great feature and selling point if it could result in lower start up times and memory consumption per "os window". Not that I think that Kitty is problematic in this regard (especially startup, while noticeably slower than urxvt, is still instantaneous as far as I 'm concerned), but IMO it would be a solid technical improvement anyway. Kitty's splits and tabs eat up much less memory than new windows already, but people that use tiling window managers might prefer to manage these through their wm, especially if it also supports tabs, like i3 or sway. |
kitty already has a solution for that, the |
This thread is now an unmitigated waste of my time. |
I've being using kitty for quite some time and slowly questioning the need of a terminal multiplexor (tmux). One thing that I could not find in kitty, though, is the ability to run it as a daemon (server) just like tmux.
So, for example, I can create a kitty session and close the UI without destroying the current session. Which means that, later, I can resume that session.
Do you have any plans on implementing this behavior?
Thanks!
The text was updated successfully, but these errors were encountered: