Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layouts not working #97

Closed
AlephaNull opened this issue Feb 20, 2021 · 2 comments
Closed

Layouts not working #97

AlephaNull opened this issue Feb 20, 2021 · 2 comments

Comments

@AlephaNull
Copy link

Hi. Newbie here. I added GRIDMODE_LAYOUT and both fibonacci layouts. Yet when I press the keyboard shortcuts mentioned on the suckless page it does not reflect. Any help will be appreciated.

@bakkeby
Copy link
Owner

bakkeby commented Feb 20, 2021

Yes there are two parts to this, the first is that this build is combining many different patches and many of them have conflicting keybindings (many patches want to use MOD+r for example).

Because of this keybindings for the different patches are set to avoid conflicts as far as possible, so you would need to refer to the bindings in config.h rather than what is stated on the suckless page.

The other part is that keybindings for layouts are based on indices, e.g.

dwm-flexipatch/config.def.h

Lines 903 to 905 in 27185a7

{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },

and given that each layout is optional one can't know up front which index e.g. the gridmode layout will end up as.

dwm-flexipatch/config.def.h

Lines 591 to 639 in 27185a7

static const Layout layouts[] = {
/* symbol arrange function */
#if TILE_LAYOUT
{ "[]=", tile }, /* first entry is default */
#endif
{ "><>", NULL }, /* no layout function means floating behavior */
#if MONOCLE_LAYOUT
{ "[M]", monocle },
#endif
#if BSTACK_LAYOUT
{ "TTT", bstack },
#endif
#if BSTACKHORIZ_LAYOUT
{ "===", bstackhoriz },
#endif
#if CENTEREDMASTER_LAYOUT
{ "|M|", centeredmaster },
#endif
#if CENTEREDFLOATINGMASTER_LAYOUT
{ ">M>", centeredfloatingmaster },
#endif
#if COLUMNS_LAYOUT
{ "|||", col },
#endif
#if DECK_LAYOUT
{ "[D]", deck },
#endif
#if FIBONACCI_SPIRAL_LAYOUT
{ "(@)", spiral },
#endif
#if FIBONACCI_DWINDLE_LAYOUT
{ "[\\]", dwindle },
#endif
#if GRIDMODE_LAYOUT
{ "HHH", grid },
#endif
#if HORIZGRID_LAYOUT
{ "---", horizgrid },
#endif
#if GAPPLESSGRID_LAYOUT
{ ":::", gaplessgrid },
#endif
#if NROWGRID_LAYOUT
{ "###", nrowgrid },
#endif
#if CYCLELAYOUTS_PATCH
{ NULL, NULL },
#endif
};

Because of this predefined keyboard shortcuts can't be set.

You can add your own keybindings for as many layouts that you have ({.v = &layouts[3]} }, onward), but just be aware that if you have a keybinding that refers to an index that doesn't exist then dwm will crash when you use it - that's just the nature of referring to data that does not exist in memory.

@AlephaNull
Copy link
Author

Thank you very much for the quick reply! I can confirm that it is working now :)

@bakkeby bakkeby closed this as completed Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants