Switching layouts with cycle command

Issue #38 resolved
Viktor created an issue

I want only the following layout: dwindle, tile, grid, none.

I try the following code for switch layout, and “cycle” them:

# change active workspace layout or cycle between them
super + ctrl {1,2,3,4,5}
    dkcmd set layout {dwindle,tile,grid,none,cycle} && notify-send -t 500 $(dkcmd status num=1 | grep L | cut -c 2-)

The switch layout with super + ctrl + number works perfectly, but super + ctrl + 5 make layout tile, and not cycling between them.
What is wrong?

Comments (5)

  1. Nate Maia repo owner

    cycle will go through all layouts built in to dk, not the ones you list in the bind. If you want that behaviour then you can remove the other layouts from your config.h and recompile

    Layout layouts[] = {
        /* command,   function,  implements_resize,  invert_split_direction */
        {"dwindle", dwindle, 1, 0}, /* first is default */
        {"tile",    ltile,   1, 0},
        {"grid",    grid,    0, 0},
        {"none",    NULL,    1, 0}, /* NULL layout function is floating */
    
        /* don't add below the terminating null */
        {NULL,      NULL,    0, 0}
    };
    

    Note that I also changed the order to match your bind, to keep the original behaviour of tile being the default layout, make sure to move it back to the top of the list.

  2. Nate Maia repo owner

    Never mind, there is indeed an issue with cycle, I’ll get it fixed.

    My above point will still be relevant if you only want to cycle a certain set of layouts.

  3. Log in to comment