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

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

Closed
wants to merge 3 commits into from

Conversation

Zawaken
Copy link
Contributor

@Zawaken Zawaken commented Jul 28, 2023

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

  • I've read CONTRIBUTING.md

  • I've considered how to best test these changes (property, unit,
    manually, ...) and concluded: This works exactly how I want it to work

  • I updated the CHANGES.md file

Copy link
Contributor

@geekosaur geekosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@geekosaur
Copy link
Contributor

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
Copy link
Member

slotThe commented Jul 29, 2023

Duplicate of #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
Copy link
Contributor

geekosaur commented Jul 29, 2023

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

@slotThe
Copy link
Member

slotThe commented Jul 29, 2023

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

@Zawaken
Copy link
Contributor Author

Zawaken commented Aug 1, 2023

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
Copy link
Member

slotThe commented Aug 1, 2023

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
Copy link
Contributor Author

Zawaken commented Aug 1, 2023

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
Copy link
Contributor

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
Copy link
Contributor Author

Zawaken commented Aug 1, 2023

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
Copy link
Contributor

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

@Zawaken
Copy link
Contributor Author

Zawaken commented Aug 1, 2023

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
Copy link
Member

slotThe commented Aug 6, 2023

Closed by #822

@slotThe slotThe closed this Aug 6, 2023
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

Successfully merging this pull request may close these issues.

3 participants