Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Allow toggling the layout before selecting a different one #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guidocella
Copy link
Contributor

No description provided.

@djpohly
Copy link
Owner

djpohly commented Jul 28, 2020

I don't think I'm feeling this one for mainline dwl. If you haven't changed the layout yet, I think it makes sense that there's not a previous layout. Plus it adds a non-obvious line of code for a case that will happen at most once per monitor, and it's easy enough to switch the layout explicitly the first time.

@guidocella
Copy link
Contributor Author

When it creates a monitor dwm explicitly sets the previous layout to the second one to allow this

m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];

I personally find this convenient and only switch layouts by toggling between tile and monocle (which I made 2nd in layouts array), without having to remember if I already switched, and never use the key bindings to select a specific layout.

The line can be made clearer by making it longer, for example

m->lt[1] = LENGTH(layouts) > 1 && r->lt != &layouts[1] ? &layouts[1] : &layouts[0];

or just assume the common case that the monitor's first layout is &layouts[0] and do like dwm

m->lt[1] = &layouts[1 % LENGTH(layouts)];

Anyway, your call.

@alex-courtis
Copy link
Contributor

This is a valid use case for me: I expect dwm to toggle between the first two layouts (monocle, tile) when it first starts up.

Further to that, I'm using the pertag patch, and don't want to have to manually setup the toggle state for every tag.

@djpohly
Copy link
Owner

djpohly commented Aug 3, 2020

Hm. It's not the job of the core codebase to support an external patch like pertag - that responsibility belongs to the patch. On the other hand, parity with dwm is a legitimate point. dwm doesn't support setting the initial layout like dwl, and I'm trying to discern what is the least surprising behavior given that difference.

I'll leave the issue open for now since I don't feel it's 100% resolved, but I went ahead and linked this patch on the new user-contributed patches page. If you don't want it there, you can feel free to take it down.

Base automatically changed from master to main February 16, 2021 19:18
@MadcowOG
Copy link

MadcowOG commented Apr 4, 2023

I think this is a valid pull request, dwm does this. If the goal is for dwl to have feature parity with dwm, then this should be merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants