gnunn1 / tilix

A tiling terminal emulator for Linux using GTK+ 3
https://gnunn1.github.io/tilix-web
Mozilla Public License 2.0
5.4k stars 294 forks source link

Start terminix with multiple sessions #99

Closed nachevn closed 8 years ago

nachevn commented 8 years ago

Hi all,

it is possible to start terminix with a saved json session file? E.g.: $terminix -s ${PATH_TO_TERMINIX_SESSION_JSON}

It would be also great if terminix can save/open more that one opened/created sessions in the same json config something like "profile to start with..."

phw commented 8 years ago

it is possible to start terminix with a saved json session file? E.g.: $terminix -s ${PATH_TO_TERMINIX_SESSION_JSON}

It is, and exactly how you suspected it should work ;)

See terminix --help for a list of all command line options.

nachevn commented 8 years ago

I have try it but it doesn't work for me. Here my json: terminix.json.txt

And ... terminix -a session-load # this opens a file chooser or terminix -s ${PATH_TO_TERMINIX_SESSION_JSON} # loads only the last child from the json

Even if I load this json from terminix it doesn't work...Wrong json syntax? What am I doing wrong?

phw commented 8 years ago

The json file is broken, how did you generate it? There are multiple child entries at the top level, that doesn't make sense and is not even valid json.

At the top level there is only one child, which can contain child1 and child2. Each of those can either be a configured terminal or again have child1 and child2.

If you generated this manually I suggest you configure your session layout inside terminix instead and save it as json.

nachevn commented 8 years ago

I think my question was not properly framed, sorry. My goal would be to start terminix with multiple sessions (and each sessions has multiple childs). Is that possible?

gnunn1 commented 8 years ago

At the moment Terminix only supports opening one session at a time. That session can contain multiple terminals though in whatever layout you want.

Supporting opening multiple sessions is a good idea, I'll mark this as an enhancement request. On 22 Feb 2016 06:57, "Niko" notifications@github.com wrote:

I think my question was not properly framed, sorry. My goal would be to start terminix with multiple sessions (and each sessions has multiple childs). Is that possible?

— Reply to this email directly or view it on GitHub https://github.com/gnunn1/terminix/issues/99#issuecomment-187185871.

nachevn commented 8 years ago

@gnunn1: Thanks for your answer. It would be great if Terminix could also define a command to be executed per terminal e.g.: "child1": { "directory": "\/home\/user\/dev\/src\/project_two_dir", "height": 1153, "profile": "...", "type": "Terminal", "execute": "pacman -Syy", "width": 960 }

phw commented 8 years ago

It would be great if Terminix could also define a command to be executed per terminal [...]

I second this. Basically a command overriding the profile default. Terminator works this way, and I use it to define different "workspaces" for the different development environments I'm working with. I still use profiles to configure the general appearance of the single terminal (e.g. I use a smaller font in terminals for log output), but reuse the profile and just override the command.

gnunn1 commented 8 years ago

The command override is a good idea and would be easy to support if I just added the appropriate element to the JSON file and had the user edit it manually.

While I'll start with this, handling it somehow from a UI perspective would be nice. I know Terminator let's you create the layout manually and I was really hoping to avoid this. Any thoughts on how to manage it? On 22 Feb 2016 08:18, "Philipp Wolfer" notifications@github.com wrote:

It would be great if Terminix could also define a command to be executed per terminal [...]

I second this. Basically a command overriding the profile default. Terminator works this way, and I use it to define different "workspaces" for the different development environments I'm working with. I still use profiles to configure the general appearance of the single terminal (e.g. I use a smaller font in terminals for log output), but reuse the profile and just override the command.

— Reply to this email directly or view it on GitHub https://github.com/gnunn1/terminix/issues/99#issuecomment-187226324.

phw commented 8 years ago

Maybe extend the current dialog where you can change the title for a terminal to be a more generic terminal settings dialog. Not sure how to properly name it. By the way, if you override the title here does this already get saved to the JSON?

I agree on avoiding a separate configure session UI.

gnunn1 commented 8 years ago

Overriding the title does not get saved to the JSON file, I like your idea of a dialog. How about if I move the Rename Title option into a more generic "Layout Options..." dialog that includes the title and overriding the command? The dialog can include a little note at the bottom to provide info about what it is used for.

phw commented 8 years ago

I like that idea and the naming.

gnunn1 commented 8 years ago

One question for you guys, if you override the command and it executes successfully is the expectation that the shell should stay open after the command executes assuming it doesn't prompt for user input? I have this working locally, but if I set the command to something like "ls" in the JSON file terminix exists as soon as the command finishes.

gnunn1 commented 8 years ago

Answering my own question, I don't think it is that's feasible to leave the shell open after the command executes. I think the assumption here is you are either executing a command that requires user input or you have the profile option enabled to keep the terminal open. If you have a different opinion feel free to reply and we can discuss.

I've completed this feature so it will be the next release, thanks for the request and input.

mannol commented 8 years ago

So, how would one go and load a multiple sessions from a session file?

gnunn1 commented 8 years ago

@mannol Sorry for the delay in repy, I missed this. Basically you just repeat the session command:

terminix --session session1.json --session session2.json
mannol commented 8 years ago

Thanks.

radutomy commented 7 years ago

I've completed this feature so it will be the next release, thanks for the request and input.

So how does this feature work? Do we have a wiki for it? :D Thx!

gnunn1 commented 7 years ago

@radutomy No wiki but it's easy, just repeat the session parameter:

tilix -s session1.json -s session2.json
radutomy commented 7 years ago

Thanks a lot, that works!

I've modified Unity's dash launcher so that it launches tilix with the arguments tilix -a session-add-right

So now when I'm clicking tilix icon in dash I'm expecting to see tilix with two panels popping up, however all I'm getting is a default session. Writing the same command in the terminal produces the expected results.

Any ideas?

martin-g commented 7 years ago

As a long time roxterm user I also missed this functionality! Here I how I accomplished it:

#!/bin/bash

TILIX_SESSIONS_FOLDER=/home/martin/tilix-sessions

TILIX_OPTS=""

for session in $TILIX_SESSIONS_FOLDER/*; do
  TILIX_OPTS="$TILIX_OPTS -s $session"
done

tilix $TILIX_OPTS

Open Tilix and execute tilix-all.sh. Voila!

bflorat commented 5 years ago

Great ! thanks for the script, works like a charm. I didn't know tilix can parse several -s options