You are not logged in.

#1 2022-04-22 15:16:08

difri84
Member
Registered: 2021-12-09
Posts: 78

failing to create a vertical split container json in i3 [SOLVED]

if you append this file on a workspace it works but it's horizontal.

                    {
                        "layout": "splitv",
                        "percent": 0.7,
                        "swallows": [
                           {
                           "title": "70"
                           }
                        ],
                        "type": "con"
                    }
                    {
                        "layout": "splitv",
                        "percent": 0.3,
                        "swallows": [
                           {
                           "title": "30"
                           }
                        ],
                        "type": "con"
                    }

i tried to follow the i3wm user guide ad i apparently keep failing even implementing the change the guide suggest.

i'ts my understanding that i have to wrap this into a partent container with vertical layout, but everything i try i keep getting an append_layout error

could some of you be so nice to show me what needs to be modified to have a vertical layout?
Thank you!

Last edited by difri84 (2022-04-22 22:43:54)

Offline

#2 2022-04-22 20:07:40

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

If Your first container needs to be split you put it on top and create children for it
For the second and following container which could have children too you need to decide a split before any children are created!
So basically every split could be a single container or one with children.
If you would want to make a split in every parent and child than that is on top in every following split, hope that that makes sense...

Offline

#3 2022-04-22 20:15:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,498
Website

Re: failing to create a vertical split container json in i3 [SOLVED]

difri84 wrote:

ii'ts my understanding that i have to wrap this into a partent container with vertical layout, but everything i try i keep getting an append_layout error

Your understanding is correct.  But if you want help solving that error, you should post that code.  The code you posted is doing what is expected (the "splitv" layout elments in that are irrelevant as there are no child nodes for that to apply to).

EDIT: the code you provided *might* work if your default workspace layout was "splitv", though this wouldn't create a splitv-container as your title is asking about, it'd just create two containers, that happen to be in a splitv workspace.

Last edited by Trilby (2022-04-22 20:19:17)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2022-04-22 20:44:37

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

Trilby wrote:

EDIT: the code you provided *might* work if your default workspace layout was "splitv", though this wouldn't create a splitv-container as your title is asking about, it'd just create two containers, that happen to be in a splitv workspace.

Well, it creates one verical split container, the second split is useless and there would be something to swallow it would certainly work
Something like this:

{
                        "layout": "splitv",
                        "percent": 0.7,
                        "type": "con",
                        "swallows": [
                           {
                           "class": "^XTerm$",
                           "instance": "^xterm$",
                           "title": "^"
                           }
                        ],
                        "type": "con"
                    }
                    {
                        "percent": 0.3,
                        "swallows": [
                           {
                           "class": "^XTerm$",
                           "instance": "^xterm$",
                           "title": "^"
                           }
                        ],
                        "type": "con"
                    }

Offline

#5 2022-04-22 21:31:51

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: failing to create a vertical split container json in i3 [SOLVED]

I realized that my question wasn't well explained.

the result i want is to have 2 windows in a vertical container to call with the append_layout command.
the final purpuse is to create a keybind calling a script that creates the layout and fill them with the right programs.
I already did that for my "work" workspace and it works perfectly, now i want just to the same for another purpuse and i need 2 windows in vertical.

i cannot find any source about how to tell the .json layout file to create a parent container with vertical split. i get the idea, tried something but nowthing works.
on the i3 site there is this solution wich doens't work

https://i3wm.org/docs/layout-saving.html last part of the page

// vim:ts=4:sw=4:et
{
    // this is a manually added container to restore the vertical split
    "layout": "splitv",
    "percent": 0.5,
    "type": "con",
    "nodes": [

        // the dumped workspace layout goes here

    ]
}

i tried to fill the "type" with con, root, and i tried "percent" with 1 and null. nothing works, i always get an error.
so my code works but not as expected, if i try to put in a parent container the code give me an error and it doens't work at all.

so my question is about the actual code i should put in to have te result i'm aming for (just the layout, i already figured out about the swallows)

i tested the code in the last post and it produces 2 windows in horizontal

Last edited by difri84 (2022-04-22 21:42:04)

Offline

#6 2022-04-22 22:00:08

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

If that was the wrong split than this should work...

{
    "border": "pixel",
    "floating": "auto_off",
    "layout": "splitv",
    //"percent": 0.7,
    "type": "con",
    "nodes": [
        {
            "border": "pixel",
            "floating": "auto_off",
            "percent": 0.7,
            "swallows": [
               {
               "class": "^XTerm$",
               "instance": "^xterm$",
               "title": "^"
               }
            ],
            "type": "con"
        },
        {
            "border": "pixel",
            "floating": "auto_off",
            "name": "XTerm",
            "percent": 0.3,
            "swallows": [
            {
            "class": "^XTerm$",
            "instance": "^xterm$",
            "title": "^"
            }
       ],
       "type": "con"
       }
    ]
}

edit:I realized the first percentage does nothing it's commented now..

Last edited by qinohe (2022-04-22 22:27:01)

Offline

#7 2022-04-22 22:28:05

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: failing to create a vertical split container json in i3 [SOLVED]

i totaly agree with your solution, but the PC doesnt' sad

ERROR: Could not parse "/home/dario/.config/i3/music/forum.json" as JSON.
[{"success":true},{"success":false,"error":"Could not parse \"/home/dario/.config/i3/music/forum.json\" as JSON."}]

every time i try to create a parent container i get this

the full code i used is this:

{
    "border": "pixel",
    "floating": "auto_off",
    "layout": "splitv",
    "percent": 0.7,
    "type": "con",
    "nodes": [
                    {
                        "layout": "splitv",
                        "percent": 0.7,
                        "type": "con",
                        "swallows": [
                           {
                           "class": "^Alacritty",
                           "instance": "^Alacritty",
                           "title": "terminal1"
                           }
                        ],
                        "type": "con"
                    }
                    {
                        "percent": 0.3,
                        "swallows": [
                           {
                           "class": "^Alacritty$",
                           "instance": "^Alacritty$",
                           "title": "terminal2"
                           }
                        ],
                        "type": "con"
                    }
            ]
}

i tried to tinker a lot with the type and percent of the parent container but always get the error

Last edited by difri84 (2022-04-22 22:32:05)

Offline

#8 2022-04-22 22:32:46

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

I just pasted it again and logged in on i3 and works and swallows perfectly fine smile
Maybe someone with a little more knowledge of JSON can help, I don't know right away what it is and have to google myself...

edit: I tried your last pasted code #7 and swallows fine with Alacritty!

Last edited by qinohe (2022-04-22 22:37:39)

Offline

#9 2022-04-22 22:37:22

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: failing to create a vertical split container json in i3 [SOLVED]

it workssssssssss thanksssssssssss
i missed the comment on percent on parent container
you're the best man!!!!

Last edited by difri84 (2022-04-22 22:40:17)

Offline

#10 2022-04-22 22:37:56

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

Yes!

edit: this was the answer to a previous edit, and thanks;)

Last edited by qinohe (2022-04-22 22:44:45)

Offline

#11 2022-04-22 22:41:40

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: failing to create a vertical split container json in i3 [SOLVED]

i'm very happy because now i have a working base to thinker with and verify step by step when it stop working because modified!
really im so grateful!
thank you so much!

apparently the parent/main contain should not have the "percent" explicited
i tried with 1 and null and they both gave me an error, but you were smart enough to think about commenting it out!

peace brother!

Last edited by difri84 (2022-04-22 22:43:17)

Offline

#12 2022-04-22 23:08:41

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: failing to create a vertical split container json in i3 [SOLVED]

Your welcome, as a simple test copy the code-block and paste it below the existing code and try..

Offline

Board footer

Powered by FluxBB