-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
X.L.MultiToggle: Add function to query toggle state #119
Conversation
You're right that there's currently no good way to query a layout and I've done ugly hacks in my copy of xmonad-contrib to work around it too, e.g.: liskin@3b4ada8 But in this particular case you only need one bit of information and you could possibly get that by using handleMessage directly:
Don't export this function, though, as it throws the modified layout away and is thus only safe if the message did nothing interesting in the X monad. Then, in X.L.MultiToggle handleMessage, return |
Clever, but as you point out, this sort of code is also an abuse of handleMessage, is it not? I'm not necessarily sure that I think its any less hacky. Shouldn't there be a nice way to query layouts in general? |
Yes it's a horrible hack, too. :-) |
@pjones Do you want me to close this? I think that something definitely SHOULD be done about this, but I'm not really sure what the best approach is. |
@IvanMalison closing it is up to you. I haven't read enough about this issue to know what the right way of doing it is. Perhaps open an issue and reference this PR before you close it. That way it doesn't get forgotten. |
I still think something ought to be done about this. I might file an issue, but am wondering if it should go against contrib or against xmonad itself. I think the cleanest solution would involve changes in xmonad. |
I've done something in the general direction of this: xmonad/xmonad#242, #398 |
A month passed and I have some additional progress:
The relevant bits in my config are: Also, I think your ugly trick with ExtensibleState can be made way less ugly by using IORef wrapped in a message: the query function creates an IORef, wraps it in a message, calls |
@liskin What is the status of this? Could we merge Xmonad.Layout.Inspect any time soon? |
@IvanMalison I haven't managed to get to this since December so it's still more of a proof-of-concept than anything. The plan was to get back to it once the 0.17 release is out. It doesn't even have MultiToggle inspection at this point, but that should be like 5 more lines or something, I guess I can try to hack on that bit next week so that you can at least test it. |
I'm happy to work on it myself. Just wondering what the state is/how much work is needed. |
Even better :-) |
(if you want to discuss something quickly, I'm liskin @ irc.libera.chat or @liskin:matrix.org) |
Yeah, actually this seems like a pretty reasonable solution to me. Would you have a problem with merging something like that? |
9abcc94
to
fa86b13
Compare
Seems like a reasonable thing to do. The inspection stuff won't be ready for a while and you only export a function the implementation of which can be swapped any time. I'll take a closer look later today, hopefully. |
Aligned the indent with the rest of MultiToggle and added docs/changelog. Will merge later in case you need to change something else. |
Thanks! |
ff5355f
to
3e83068
Compare
I'm entirely aware that the approach I have taken here is pretty hideous, and as such will probably never be accepted into xmonad-contrib. The thing is that no matter how hard I tried I could not figure out another way to provide this functionality. I'm putting this here in the hopes that someone can come up with a better way, or perhaps to get confirmation that there is no real way around the gross hack that I've added here.