-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
split panes #205
Comments
Do you know of a terminal emulator on Linux that has this same functionality? I'd like to play around with it to get a feel for how it works. Of course, the easiest way to do what you want to do would be to just use a terminal multiplexer (like Currently Termonad just has a single gi-vte The code for creating a new Lines 442 to 459 in d817fe4
If you wanted to add functionality for having multiple I imagine GTK provides some sort of widget to allow you to arbitrarily split a layout in half, but I'm not sure what would be the best widget to use. Maybe try taking a look at the following:
There are probably also a few places in the code that make an assumption that there is a one-to-one mapping between There are a few other small things you'll have to decide while working on this. The first thing that comes to mind is what to put in the Notebook tab label when you have multiple panes. With a single terminal in a Notebook tab, you can just have either the name of the process running in the terminal (or let the terminal set the title), but with multiple tabs you'll have to decide what makes the most sense here. You'll likely also need to add a new key command for opening a new pane instead of a new tab. Here's where the
|
I found one, Konsole.
Yes, that's my fallback plan if adding this feature to Termonad turns out to be too complicated. Thanks for the code pointers, I'll give it a shot! |
Nah, all three of those are for programmatically laying out components next to each other, e.g. a Cancel button next to an Ok button. What I had in mind is Paned, which gives the user a draggable divider for resizing. |
Hello. Also, terminator and kitty have this features. |
@gelisam Oh nice, Paned looks like it might work well. @Minda1975 thanks for the pointers! |
My attempts so far have been caught by |
Any particular reason why |
No good reason. Feel free to refactor that function (or, really, any of the Termonad code) if it makes the implementation easier for you! |
All right, I finally have something to show! On my always-split branch, I have a version of Termonad in which every tab is split into two panes. I currently have a bug where exiting the shell of either pane will cause the tab to close, but won't cause the other pane's shell to exit, leaving orphan processes. But that seems minor compared to the bigger issue which follows. While always having two panes is actually what I want, that's probably not what most users want, nor is it the feature I had in mind when I opened this issue. A more typical split-pane feature would start each tab with a single shell, and allow the user to recursively subdivide the area into more and more (and smaller and smaller) shells, and to close each pane independently. I don't have those features yet, but I do have a good idea of how to implement them. Before I do, however, I think it's worth having a discussion about the split-paned API. Termonad boasts about being "extremely customizable", so after implementing proper split panes, it would be nice if I was then able to customize Termonad so that each tab starts with two panes rather than one. But (1) I am not very familiar with the way in which Termonad makes itself customizable, and (2) I worry about accidentally making a customization API which is too focused on my own use case. Any guidance? |
That all sounds really good. Definitely feel free to open a PR with what you currently have (or a draft PR if that makes more sense).
The customization features of Termonad aren't currently super well thought-out. Here's the config module: https://hackage.haskell.org/package/termonad-4.2.0.0/docs/Termonad-Config.html You can see most things are just dumb, toggleable options. However, there is also a "hooks" feature that lets end users hook into different points in the execution of Termonad and do arbitrary actions. This is mostly based on the same ideas from XMonad: https://hackage.haskell.org/package/termonad-4.2.0.0/docs/Termonad-Config.html#t:ConfigHooks You can see that there is currently only one hook. There really haven't been many users asking for additional hooks, so I haven't added any others yet. Although it is something I'd like to do at some point. So I think you basically have the following two choices for how to go about customizing the split pane stuff:
It sounds like you're thinking something like (2) makes more sense. I agree that seems reasonable. |
Ah, I forgot about draft PRs! Good idea, better start to discuss the changes early. Here is a draft PR. |
Loving following this feature request. When it was opened it did not hold much interest for me as I was working with I'll be testing this pretty hard soon. Thanks for making this happen! 😃 |
@craigem I haven't been able to take a look at this (hopefully I can get to it in the next week or so), but any help testing would be really great! |
i would like to be a tester too, but I don't quite know how to; do I simply clone his branch, install and test split panes? |
Nice, users! Any customizations related to split panes you would like to see supported? Any suggestion for which keybindings should be used to split horizontally, split vertically, and to move between panes? |
personally I think ctrl-h and ctrl-v are good keybinding to split panels horizontally and vertically; maybe a ctrl-shift modifier? so it does not conflict with anything else. about customization.. maybe a way to resize the two panes? both via mouse and keybinding, though they both sound tricky to put into actual code. |
ctrl-v conflicts with vim's "don't interpret the next character, insert it literally", and ctrl-shift-v conflicts with termonad's existing Paste keybinding. Any other suggestion?
the Paned widget is resizable by mouse already. I don't know if gtk already has some keybindings for resizing it via keyboard; I wasn't planning to put in any, but I guess I could. any suggestion for which keybinding?
are you saying you want to be able to customize whether the panes can be resized, or that you want a hook which allows you to compute a custom size when the pane is created, or that you want to be able to resize an existing pane from inside an existing hook? Speaking of resizing, I have a UX question. Suppose you have the following split-panes arrangement:
Your focus is on the A) split that pane's area in two:
B) redistribute the column's area equally:
C) something else |
To adjust pane's dimension, use the above four key combo, but use
A. Split that pane's area in two. Reason: others could mess up my "manually" created (vertical) layout. |
right, sorry haha, did not think about those
no no, I just meant resizing them via either mouse dragging or keybinding, sorry if I explained myself wrong about the last question, I expect B, redestribute the column area equally. sorry for the misunderstanding. |
How configurable should this be?
Btw, I don't expect you to do everything yourself. I am hoping that you'll keep these in mind when implementing split panes to make it easier to add these in the future. :-) |
I've seen @MuhammedZakir suggestions and they appear sound. My off-the-cuff suggestion is a vague "let's look at what's commonly used elsewhere in TMUX, Byobu and other tools". So I'll do some leg work on that and come back with a more meaning response than this. |
I'll keep updating this comment with other examples but for starters, here's Tmux default key bindings for panes:
Tmux has a concept of windows and panes whereas apps like Terminator only appear to have panes. The windows concept maps to tabs in Termonad nicely. Looking at those keybindings, I'm glad I don't use terminator 🤣 I do use Tmux and find the modal vim-like usage comfortable and sane. |
Modal keybinding is more comfortable and easier to remember. If possible to do that, +1 for that. I think we shouldn't touch arrow keys as it will interfere with navigation in command-line apps. For example, |
If modal is chosen as the way forward, what should be the key?
Perhaps:
There are no doubt better ones that do not clash with common usage but that's a start. |
Two more:
|
ctrl+t's very tabby muscle memory already. |
One feature I really like from iTerm2 is split panes. In particular, I always split my tabs vertically, with my text editor in the left pane, and ghcid in the right pane. I can currently achieve this with two termonad windows side-by-side, but this breaks down when I have multiple tabs, as I would like switching to a different tab to switch both to the source code of the new tab and to the ghcid of the new tab.
How would I go about implementing this?
The text was updated successfully, but these errors were encountered: