xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
579 stars 272 forks source link

Export 'Mag' and 'Toggle' from Magnifier #821

Closed Zawaken closed 11 months ago

Zawaken commented 12 months ago

Description

Include a description for your changes, including the motivation behind them.

I've made XMonad.Layout.Magnifier export All constructors under 'Magnifier' and 'Toggle', so that it is possible to make custom magnifiers, with control over size both horizontally and vertically.

Example:

-- maximizeVertical defaulting to On instead of Off
custommaximizeVertical :: l a -> ModifiedLayout Magnifier l a
custommaximizeVertical = ModifiedLayout (Mag 1 (1, 1000) On (AllWins 1))

Checklist

geekosaur commented 12 months ago

Hm, strictly this breaks PVP so should have a major version bump. But I think we're headed that way anyway, whenever we get around to the next release. (0.17.2 didn't contain any of these changes, just what was needed for GHC 9.6 and its bundled libraries.)

slotThe commented 12 months ago

Duplicate of https://github.com/xmonad/xmonad-contrib/pull/583

Further, the custommaximizeVertical can already be done with the magnify combinator, as far as I can tell. Is there really anything that actually requires us to expose these internals?

geekosaur commented 12 months ago

magnify's documentation (and implementation; I checked) specifically expands the selected window in both dimensions, unlike maximizeVertically.

slotThe commented 12 months ago

Ah, right, we use the same number twice… Well, looks like we just need a more general combinator then?

Zawaken commented 11 months ago

I didn't realize this was a duplicate, but I see now that it is.

I have tested doing some changes in a branch in my fork that might be better, where I have changed magnify to allow for custom horizontal and vertical values. (the magnifiercxy name is kind of a placeholder, and to show how this would work)

Is this more in line with what you were thinking @slotThe, if so I can create a Pull request for the new branch, or merge it into this pull request.

slotThe commented 11 months ago

I have tested doing some changes in a branch in my fork that might be better, where I have changed magnify to allow for custom horizontal and vertical values. (the magnifiercxy name is kind of a placeholder, and to show how this would work)

Is this more in line with what you were thinking @slotThe, if so I can create a Pull request for the new branch, or merge it into this pull request.

Mh, I was more thinking of creating another (yet another, I know…) general combinator; I'm not sure a breaking change is warranted here

Zawaken commented 11 months ago

So in essence another 'magnify' then? I updated the changes to what I think you mean now. I do feel this is a bit dirty though, but it works just as well as the previous one.

geekosaur commented 11 months ago

What's "a bit dirty" about it? If anything, I'd say the one that requires users to use ModifiedLayout directly is the dirty one; it's intended to be internal.

Zawaken commented 11 months ago

I mean compared to my previous proposed solution, changing magnify to accept two Rationals worked like a charm, and didn't seem to break anything, so the new one in the magnifiercxy branch feels a bit dirtier, or not needed if that makes sense.

But both of them work well.

It is like you say, way less dirty than using ModifiedLayout.

geekosaur commented 11 months ago

Right, but changing magnify is non-backward-compatible. That's why @slotThe wants a new combinator instead.

Zawaken commented 11 months ago

Aha, that makes more sense then, thanks.

I will see if I can figure out some better names for the combinators and create a PR for these changes.

slotThe commented 11 months ago

Closed by #822