You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New feature: A Separate Json file for dynamic Layouts #213
The Json file may provide an easy way to configure a collection of tabs and terminals using common pre-defined layouts, and also may support basic theming like background and text color.
This would allow to:
Edit Layouts using a Text Editor instead of the "Preferences > Layouts" dialog.
Share layouts easily between machines and people.
A way to keep layouts under source control (git).
For years I used terminator and this feature was missing. so I wrote my own script that takes a list JSON files, representing layouts and profiles, and build a unified INI file for the terminator. Those files are also in the source control so my colleagues can use them easily.
Now that I see terminator is under active development again, I think of adding this feature to the code base. Would like to get your feedback and suggestions.
This sounds interesting. I think it might be better to have profiles defined in JSON rather than layouts. Profiles have the functionality that you need (judging from your description), and can contain layouts as well.
Personally, I'd be very comfortable working on this with you as well, just because it would be a nice change from all the GUI programming I've been doing lately with trying to get background image support back, and definitely an area in which I'm more comfortable :)
Thanks for your response @mattrose, would be glad to work with you, I already started something and will have it ready for push soon, will share the PR.
Regarding layout vs profiles, I might miss something, currently a .config file looks like:
[profiles]
[[Monitor]]
allow_bold = False
icon_bell = False
background_color = "#100000"
background_darkness = 0.93
background_type = transparent
font = Monospace 16
foreground_color = "#DCDfff"
show_titlebar = False
scrollbar_position = hidden
scrollback_lines = 3000
scrollback_infinite = True
use_system_font = False
[layouts]
[[Monitor]]
[[[root]]]
fullscreen = False
last_active_window = True
maximised = True
order = 0
parent = ""
position = 1920:0
size = 1920, 1080
title = Monitor
type = Window
[[[tabs]]]
active_page = 0
labels = htop, cmus
order = 0
parent = root
type = Notebook
[[[htop]]]
command = htop ; bash
order = A
parent = tabs
type = Terminal
[[[cmus]]]
command = cmus ; bash
order = B
parent = tabs
type = Terminal
Seems like tabs+terminals are part of the layouts section, while profile holds things like colors and fonts. isn't it?
You know what, you're right. Profiles and Layouts are separate. For some reason I thought that Layouts were a subset of Profiles. Looking forward to your PR
The --layout argument may be either a name of a layout from the global config file, or a path to a layout.json file.
It first look for the layout name, like the regular behaviour of terminator, and only if it is missing it tries to look for a file.
If the argument passed is indeed a file, the new LayoutFile.get_layout_file method will build a dict with the same format like in the ini file.
This way it is both backward compatible with current logic, and pretty safe as no actual touching in the existing logic.
That looks very clean on first glance, and thanks for the PR. Hopefully I'll be able to pull it down and play with it tomorrow, but more likely Monday.
The --config-json parameter is a layer above the regular config file, it may contain a single layout and a single profile. both used by default if no other option is specified.
It is possible for the user to create custom a layout, with custom colors and fonts in a single Json file. Then use it when opening terminator without touching the global config, using the new --config-json parameter.
The Json file is pretty straightforward, its depth is unlimited and may contain very complex layouts with combination of tabs, horizental and vertical terminals.
Activity
mattrose commentedon Sep 19, 2020
This sounds interesting. I think it might be better to have profiles defined in JSON rather than layouts. Profiles have the functionality that you need (judging from your description), and can contain layouts as well.
Personally, I'd be very comfortable working on this with you as well, just because it would be a nice change from all the GUI programming I've been doing lately with trying to get background image support back, and definitely an area in which I'm more comfortable :)
dvdlevanon commentedon Sep 19, 2020
Hi,
Thanks for your response @mattrose, would be glad to work with you, I already started something and will have it ready for push soon, will share the PR.
Regarding layout vs profiles, I might miss something, currently a
.configfile looks like:Seems like tabs+terminals are part of the layouts section, while profile holds things like colors and fonts. isn't it?
mattrose commentedon Sep 19, 2020
You know what, you're right. Profiles and Layouts are separate. For some reason I thought that Layouts were a subset of Profiles. Looking forward to your PR
dvdlevanon commentedon Sep 19, 2020
Just pushed the initial PR, work is still in progress.
#214
I put some json files in here: https://github.com/dvdlevanon/terminator/tree/layout-json-file/layout-files-examples
Example run:
The
--layoutargument may be either a name of a layout from the globalconfigfile, or a path to a layout.json file.It first look for the layout name, like the regular behaviour of terminator, and only if it is missing it tries to look for a file.
If the argument passed is indeed a file, the new
LayoutFile.get_layout_filemethod will build a dict with the same format like in theinifile.This way it is both backward compatible with current logic, and pretty safe as no actual touching in the existing logic.
Would like to hear your opinion and suggestions.
dvdlevanon commentedon Sep 19, 2020
Here is a screenshot with this example:
https://ibb.co/zFVBM55
mattrose commentedon Sep 20, 2020
That looks very clean on first glance, and thanks for the PR. Hopefully I'll be able to pull it down and play with it tomorrow, but more likely Monday.
dvdlevanon commentedon Sep 20, 2020
@mattrose Noticed I just pushed my latest changes, and I slightly changed the interface due to the
profilesupport that was added.Example run:
The
--config-jsonparameter is a layer above the regular config file, it may contain a single layout and a single profile. both used by default if no other option is specified.It is possible for the user to create custom a layout, with custom colors and fonts in a single Json file. Then use it when opening terminator without touching the global config, using the new
--config-jsonparameter.The Json file is pretty straightforward, its depth is unlimited and may contain very complex layouts with combination of tabs, horizental and vertical terminals.
py-terminator: Upgrade to 2.1.0
bitinerant commentedon Sep 27, 2022
I am excited about this feature but so far cannot find documentation and link above to some examples is broken. It would be great if a brief explanation and several examples could be added to https://gnome-terminator.readthedocs.io/en/latest/advancedusage.html
bitinerant commentedon Sep 27, 2022
Update: I found one example
.jsonfile (source):FernandoBasso commentedon Oct 24, 2022
That branch doesn't exist anymore, it seems. Here's a link to @dvdlevanon's master branch which currently also contains the examples.
Thanks a lot for this work, @dvdlevanon. Much appreciated!
mattrose commentedon Oct 25, 2022
These are in the repo. https://github.com/gnome-terminator/terminator/tree/master/data/layout-files-examples
py-terminator: Upgrade to 2.1.0
py-terminator: Upgrade to 2.1.0
py-terminator: Upgrade to 2.1.0