i3-layout-manager
i3-layout-manager copied to clipboard
A challenge perhaps: make it work together with i3-wm-multi-disp-scripts?
Sorry for the edits, caught the enter-key by mistake.
A while ago I found the i3-wm-multi-disp-scripts, and have found it quite useful for better organising my work on a triple-monitor setup.
But I've also been looking for a way to start a bunch of windows at once on a specific workspace with a predefined layout, and your project seemed like a very promising fit for this use-case. And in fact, some early testing I've done indicates that it should be workable, in principle. I can use something along the lines of
exec --no-startup-id "python3 ~/.config/i3/i3-wm-multi-disp-scripts/create_new_project.py social; dex ~/.local/share/applications/chromium-scholar.social.desktop ~/.local/share/applications/chromium-qoto.org.desktop ~/.local/share/applications/chromium-twitter.com.desktop"
to start a new workspace spanning all monitors, and populate it with the Chromium windows defined by the .desktop
files. I was hoping to use i3-layout-manager
to define and save the layout, and then perhaps combine all of it into one command. You get the point.
I've tried saving layouts a few times (while selecting the different options: default
, specific
, match any
) but in all cases, an empty JSON file is created.
$ ll .layouts/
-rw-r--r-- 1 chepec chepec 0 Oct 9 22:01 layout-GRID.json
-rw-r--r-- 1 chepec chepec 0 Oct 9 22:05 layout-NEWONE.json
-rw-r--r-- 1 chepec chepec 0 Oct 9 22:00 layout-SOCIAL.json
I think the use of i3-save-tree --workspace
only catches the windows on the highlighted monitor of the workspace, missing the other two. I've played around a little with i3-save-tree
myself, and found no way to print out a tree including the windows on all monitors. But I'm admittedly a total noob.
Is there perhaps some way to make this layout manager work together with i3-wm-multi-disp-scripts, or something similar?
Hey, I will check i3-wm-multi-disp-scripts and let you know. In the meantime, what do you get by running i3-save-tree`` in a terminal? Is it empty? That might be a problem. Ultimately, does
i3-save-tree --output XX, where XX is the name of any of your monitors (
arandr```), give you something?
I really appreciate you taking the time. And thanks for the clear instructions.
I have three physical monitors, named DisplayPort-0
, DVI-1
, and DisplayPort-1
according to arandr
. Running i3-save-tree
without any flags gives an output detailing the windows on that workspace (which encompasses only that specific monitor, in contrast to multi-disp-scripts
notion of all three physical monitors forming one logical workspace):
chepec@localhost:~
$ i3-save-tree
// vim:ts=4:sw=4:et
{
"border": "normal",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 736,
"x": 0,
"y": 0
},
"name": "chepec@localhost: ~",
"percent": 0.360411737345548,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^chepec\\@localhost\\:\\ \\~$",
// "transient_for": "^$"
}
],
"type": "con"
}
{
"border": "normal",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1881,
"width": 1196,
"x": 1202,
"y": 18
},
"name": "chepec (16) - Remember The Milk",
"percent": 0.639588262654452,
"swallows": [
{
// "class": "^Google\\-chrome$",
// "instance": "^rememberthemilk\\.com$",
// "title": "^chepec\\ \\(16\\)\\ \\-\\ Remember\\ The\\ Milk$",
// "transient_for": "^$",
// "window_role": "^pop\\-up$"
}
],
"type": "con"
}
{
// floating_con with 1 children
"border": "normal",
"floating": "auto_off",
"layout": "splith",
"percent": null,
"rect": {
"height": 893,
"width": 796,
"x": 305,
"y": 884
},
"type": "floating_con",
"nodes": [
{
"border": "normal",
"current_border_width": 2,
"floating": "user_on",
"geometry": {
"height": 873,
"width": 792,
"x": 0,
"y": 0
},
"name": "Screen Layout Editor",
"percent": 1,
"swallows": [
{
// "class": "^Arandr$",
// "instance": "^arandr$",
// "title": "^Screen\\ Layout\\ Editor$",
// "transient_for": "^$"
}
],
"type": "con"
}
]
}
Note that i3-save-tree
appears to have no idea what my two other monitors are displaying.
And i3-save-tree --output XX
for any of the monitor names above includes not only the currently visible workspace but all workspaces on that particular physical monitor. Seems reasonable, albeit in conflict with the notion of workspaces as introduced by the multi-disp-scripts
project (where all three monitors form one single workspace).
So it seems to me that i3-save-tree
collects info on all workspaces per physical monitor. More troubling, I found nothing in the i3-save-tree
output indicating that it was aware of the workspace names defined by i3-wm-multi-disp-scripts
. But perhaps workspace names are accessible via a different command?
My own, likely naive, idea was if there were some way to have i3-save-tree
output only the visible workspaces for all monitors (so output corresponding to the current workspace, i.e., all windows I'm currently looking at on all monitors)? I found no such flag in its man-pages, and if there really isn't, I thought perhaps one could somehow loop over each physical monitor, collect the i3-save-tree
output, and then concatenate it into something usable? But I've no idea if that would work, and no means to implement it myself.
I'm not very familiar with i3 or window managers in general, so what do I know ;-) Again, thanks for taking the time.
Hey, thanks for the answers. Sorry, I haven't got to trying multi-disp-scripts
myself yet, I will get to it probably during the weekend. Yes, you are correct, i3-save-tree
only collects either stuff about the current (or other desired) workspace, or about all the workspaces on the desired monitor.
I as well think that we would need to iterate over all displays and all visible workspaces on those displays and extract the layouts iteratively. That would be probably possible. On the other hand, loading the layouts might be a problem, since the append-layout
seems to affect only the focused monitor.
I think that rather than implementing those features, I might look into the i3's code instead. I think that even the functionality my layout manager brings, or rather the workarounds it uses, should be part of i3wm directly. If they are, it might be much simpler to get stuff working with multi-disp-scripts
.
I will let you know what are my findings, thanks for reaching out,