-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Allow pattern-matching on 'XMonad.Layout.Choose' by exporting constructors #219
Conversation
…te.Layout when xmonad/xmonad#219 gets accepted
Here in my dotfiles you can see an example of what can be done with this change: I use everything that This way I can set the spacing for all sub-layouts on my workspaces with just using toggleGaps. |
I have no opinion about whether exposing these constructors should be done or not, but I think there is an easier way to implement this. If I understand your setup correctly, you have a global toggle for gaps that broadcasts a message to all workspaces and all sublayouts and this message toggles the inner state of all those layouts (or layout modifiers). So what you really want is a single global boolean toggle instead of a hundred local ones that you toggle, hoping they'll never come out of sync. How about this: Store this global toggle in ExtensibleState and whenever the layout is switched, sync this state into it using something like setGaps enabled :: X ()
setGaps enabled = do traverse_ broadcastMessage messages
 refresh
 where messages = [ ModifyWindowBorderEnabled (const enabled)
 , ModifyScreenBorderEnabled (const enabled)
 ] It's not the cleanest solution, I guess, but it's simpler than adding a LayoutClass that delivers messages to both active and inactive layouts (which is probably dangerous in general). |
I am now in favor of merging this. In #242 and xmonad/xmonad-contrib#398 I started working on being able to query the current layout state. The next step is to add a Can you please rebase and fix the conflicts? |
@jumper149 Thanks for for the MR! @liskin Done. |
This ended up breaking compilation of xmonad-contrib as modules that define their own L/R data constructors (X.U.Types, X.L.GridVariants, X.L.ResizeScreen, X.L.TallMastersCombo, X.C.Types) cause ambiguity now. And then maybe also reduce the duplication in xmonad-contrib: use the renamed/exported LR in TallMastersCombo. Reported here: https://old.reddit.com/r/xmonad/comments/ka1qxg/fixing_fullscreen/ |
Export the constructor
Choose
to be able to construct and pattern-matchChoose l r a
. To do that it is also necessary to exportLR
with constructors.Description
I just added the constructor
Choose
andLR
with constructors to the exports of the moduleXMonad.Layout
Checklist
I've read CONTRIBUTING.md
I've confirmed these changes don't belong in xmonad-contrib instead
I tested my changes with xmonad-testing (that seems to be a dead repository)
I updated the
CHANGES.md
file