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

Ewmh support for workspace names #122

Conversation

colonelpanic8
Copy link
Contributor

This PR also fixes the issue that #105 fixed in a cleaner way.

@mention-bot
Copy link

@IvanMalison, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rupa, @nlewo and @nomeata to be potential reviewers.

, handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook
, logHook = logHook c +++ ewmhWorkspaceNamesLogHook
}
where x +++ y = mappend y x
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why there is EWMH code in WorkspaceNames.hs. Anything with ewmh in the name should be moved out of this file and into EwmhDesktops.hs.

Also, your ewmhWorkspaceNames function is almost an exact copy of the ewmh in EwmhDesktops.hs.

Please fix these issues then update the CHANGES.md file.

Copy link
Contributor

Choose a reason for hiding this comment

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

The right way to do this is probably to provide an appropriate function for use with ewmhDesktopsLogHookCustom.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The right way to do this is probably to provide an appropriate function for use with ewmhDesktopsLogHookCustom.

This behavior can't be accomplished with a pure function because access to X is needed.

I don't understand why there is EWMH code in WorkspaceNames.hs. Anything with ewmh in the name should be moved out of this file and into EwmhDesktops.hs.

The behavior of these functions is specific to WorkspaceNames which is functionality that I imagine most people don't use. It seemed more appropriate to me to group this with WorkspaceNames than with ewmh.

I could write something of type

X ([WindowSpace] -> [WindowSpace])

Which you could then combine with ewmhDesktopsLogHookCustom like

ewmhWorkspaceNamesLogHook >>= ewmhDesktopsLogHookCustom

Also, your ewmhWorkspaceNames function is almost an exact copy of the ewmh in EwmhDesktops.hs.

Except that it uses the workspace names log hook instead of the one that just uses workspace tags. If I don't add this function, then users would have to manually set the startup, handleEvent and log hooks.

Is your argument that you can do something like

(ewmh def) {
   logHook = (logHook def) +++ ewmhWorkspaceNamesLogHook
}

to acheive the same effect?

This just ends up seeming a bit more complicated for the end user. Would it be okay if I wrote ewmhWorkspaceNames in terms of ewmh like:

ewmhWorkspaceNames :: XConfig a -> XConfig a
ewmhWorkspaceNames c = (ewmh c) { logHook = logHook c +++ ewmhWorkspaceNamesLogHook }
  where x +++ y = mappend y x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pjones @geekosaur
Any thoughts on what I've written above? I'm happy to proceed in whatever way you think is best.

Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be better to turn the WindowSet -> WindowSet in EwmhDesktops into X (WindowSet -> WindowSet) so that WorkspaceNames can just provide such a function and users would then be able to plug that into their ewmhWhateverHookCustom. This should simplify the code significantly.

See also #399. I'll be happy to make that change there. That is, if @IvanMalison still wants to pursue this pull request, or if there are other users who'd like to see it merged. I'm not using any pager that shows desktop names, personally, but I'd be very happy to see this supported in WorkspaceNames and EwmhDesktops.

Also, I'd like to remark that I'm mentioned as a maintainer of WorkspaceNames and that I would have reacted a few years earlier had I been pinged by either one of you. :-))

Copy link
Member

Choose a reason for hiding this comment

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

I drafted this at liskin#1. Got to admit it's significantly simpler :-)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I just realized that you already had the simple implementation in the cover letter of #105, but it wasn't possible back then. And two years later in #238 you fixed ewmhDesktopsLogHookCustom so that the simple implementation is possible, and this PR (#122) was never updated accordingly. Anyway, now that the simple implementation is possible, I'll just include it in #399.

Copy link
Member

Choose a reason for hiding this comment

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

And a few months later I realized it's not as simple as I thought it was. With two separate hooks, it is, as one can pass the renaming function to the log hook only, but in #399 I deprecated the individual hooks and now I need two different remaps as in #105 again. 🤦
2e982f1
Not really a big deal I guess, but I do feel like an idiot. :-)

@pjones pjones added this to the v0.13 milestone Dec 8, 2016
@pjones
Copy link
Contributor

pjones commented Dec 14, 2016

I apologize for being a bit dense, but I don't understand the background for this change. I've read the comments on the referenced PR and yet I still don't understand the motivation behind this.

Please help me understand a use case where these changes are useful. Thank you.

@geekosaur
Copy link
Contributor

geekosaur commented Dec 14, 2016 via email

@colonelpanic8 colonelpanic8 force-pushed the ewmh_support_for_workspace_names branch 3 times, most recently from 738cb91 to 9bc0822 Compare December 26, 2016 01:46
@colonelpanic8
Copy link
Contributor Author

I moved the functions supporting ewmh to the ewmh module (frankly, I still think it would be more appropriate to have them in WorkspaceNames, but I don't feel very strongly about it).

@pjones
Copy link
Contributor

pjones commented Jan 3, 2017

@IvanMalison Sorry for the delay. After reading @geekosaur's comment and thinking about this some more I'm wondering if it makes sense to move everything from this PR into its own module. Like you said, it doesn't really belong in EWMH, but WorkspaceNames might not be the right place either. Really, this is a way to glue those two together (if I understand correctly).

How does that sound?

@colonelpanic8
Copy link
Contributor Author

@pjones Yeah, sure that works!

@pjones
Copy link
Contributor

pjones commented Feb 7, 2017

@IvanMalison Are you still going to move this code into its own module?

@colonelpanic8
Copy link
Contributor Author

yep I can do that!

@colonelpanic8 colonelpanic8 force-pushed the ewmh_support_for_workspace_names branch from 9ce1bb1 to 70a6ead Compare March 28, 2018 22:19
@liskin liskin self-assigned this Nov 5, 2020
liskin added a commit that referenced this pull request Nov 16, 2020
Together with ewmhDesktopsLogHookCustom this exposes workspace names to
external pagers.

Fixes: #105
Fixes: #122
Co-authored-by: Ivan Malison <IvanMalison@gmail.com>
@liskin
Copy link
Member

liskin commented Nov 16, 2020

Sorry for the noise and treating you all as rubber ducks, so here's a last status on this: I figured we don't need to wait for #399 so I just pushed f271d59 to master.

liskin added a commit to liskin/xmonad-contrib that referenced this pull request Nov 16, 2020
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Jan 25, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Jan 30, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Feb 2, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Feb 7, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Feb 7, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Mar 23, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Mar 23, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request Apr 7, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request Apr 7, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request Apr 13, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request Apr 13, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request May 21, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
TheMC47 pushed a commit to TheMC47/xmonad-contrib that referenced this pull request May 21, 2021
Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Jun 4, 2021
This makes it easier to use transforms that need some state, e.g.
XMonad.Actions.WorkspaceNames could provide this.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Jun 4, 2021
…ctrl -s)

Turns out that renaming workspaces in the transform is a bad idea in the
`ewmhDesktopsEventHook'` as W.view is then unable to find the workspace.
This was somewhat usable before we introduced the unified `ewmh'` config
combinator as one would only rename in the transform passed to
`ewmhDesktopsLogHookCustom`, but with the unified config, we actually
need to separate renames from sorting/reordering, otherwise switching
workspaces by pagers or wmctrl doesn't work.

Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 18, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 18, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 19, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 19, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 19, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 19, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
…tering and renaming

Now that we have `XMonad.Util.ExtensibleConf`, users can comfortably use
the `ewmh` combinator and still customize workspace ordering, filter out
scratchpads and expose altered workspace names.

To make this all work nicely, we introduce not one, but two
configuration options: a sort/filter function and a rename function.
This is because renaming and sorting in one go makes it hard (perhaps
even impossible) to decide which workspace to switch to upon receipt of
a _NET_CURRENT_DESKTOP request from a pager or wmctrl/xdotool. (The only
reason this wasn't a problem before is because one could pass the
renaming function to `ewmhDesktopsLogHookCustom` only, not
`ewmhDesktopsEventHookCustom`, which is a confusing hack as can be seen
in the related closed pull requests.)

Related: xmonad#238
Related: xmonad#105
Related: xmonad#122
liskin added a commit to liskin/xmonad-contrib that referenced this pull request Oct 20, 2021
Related: xmonad#105
Related: xmonad#122
Related: f271d59 ("X.A.WorkspaceNames: Provide workspaceListTransform for EwmhDesktops")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants