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

home-cursor: use mkRenamedOptionModule for xsession.pointerCursor #3545

Closed

Conversation

ncfavier
Copy link
Member

This hides the obsolete options from the manual, at the cost of displaying two warnings: the one from mkRenamedOptionModule and the generic migration instructions for xsession.pointerCursor.

Fixes (superficially) #3543, though it does not address the underlying issue with mkAliasOptionModule.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

@ncfavier ncfavier requested a review from league as a code owner December 31, 2022 00:00
"home"
"pointerCursor"
"size"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
(mkRenamedOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
"home"
"pointerCursor"
"x11"
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, in this case mkAliasOptionModule was used for a reason. If you look at the list entry below the fold in GitHub (click the ⬇) you'll notice that there is actually already a more helpful warning printed. The main difference is that it includes a reference to home.pointerCursor.x11.enable, which would be missing if we use mkRenamedOptionModule.

That said, I think we could get away by changing the warning text below slightly. Something simple like

To enable X11 specific cursor configurations, please enable 'home.pointerCursor.x11.enable'.

may be sufficient. The other options will get their own warnings through mkRenamedOptionModule.

Copy link
Member

Choose a reason for hiding this comment

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

That said², I'm not certain why the home.pointerCursor.x11.enable option is there at all. Presumably the user would like to use the cursor settings whenever config.xsession.enable is set? @polykernel Can you recall why that is?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did see that, that's why I said "at the cost of getting two warnings". I don't think it's too bad, although it might need a change in wording.

Probably a better solution would be to make mkRenamedOptionModule accept a "replacement instructions" message, just like mkRemovedOptionModule does.

But if we can just remove home.pointerCursor.x11.enable that's even simpler.

Copy link
Member Author

@ncfavier ncfavier Dec 31, 2022

Choose a reason for hiding this comment

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

Or (assuming we do need home.pointerCursor.x11.enable) maybe we should indeed use mkRemovedOptionModule and fail instead of accepting a configuration that suddenly does not have X cursors anymore (although it's probably a bit late to be revisiting the migration path for this option).

Copy link
Contributor

@polykernel polykernel Jan 1, 2023

Choose a reason for hiding this comment

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

That said², I'm not certain why the home.pointerCursor.x11.enable option is there at all. Presumably the user would like to use the cursor settings whenever config.xsession.enable is set? @polykernel Can you recall why that is?

IIRC, the enable option was introduced as a toggle for each backend in case more options are added for the backend in the future.

After some thought, I think each home.pointerCursor.<backend> can also be a nullable submodule which achieves the same functionality as the enable option (e.g setting home.pointerCursor.x11 = {} would enable the x11 backend).

Copy link
Member Author

Choose a reason for hiding this comment

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

If you can submit a PR for that, that would be great! Similarly, I think the GTK backend can simply be enabled if gtk.enable is true. Then both enable options should get a mkRemovedOptionModule explaining why they've been removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

When drafting the PR, I noticed that it is not possible to maintain compatibility with the old xsession.pointerCursor module after the removal of x11.enable. Since the xsession.initExtra and xresources.properties settings become dependent on xsession.enable, this means it is not possible to enable the full X cursor configuration in isolation anymore which was supported by xsession.pointerCursor. With the gtk.enable option, the same type of issue arise because of coupled dependencies. For example, if a user wants to enable X cursor configurations via home.pointerCursor and has gtk.enable set to true only for gtk theme configuration, then the gtk cursor configuration also gets set by the home.pointerCursor unbeknownst to the user.

Is the incompatibility introduced acceptable for the module? In any case, I have submitted a draft PR as a work in progress.

Copy link
Member Author

@ncfavier ncfavier Jan 3, 2023

Choose a reason for hiding this comment

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

Maybe it would be much simpler to keep the options, but make x11.enable default to config.xsession.enable and gtk.enable default to config.gtk.enable. That way we don't lose backwards compatibility (although those use cases seem questionable to me) and we don't have to bother with the whole "mkRemovedOptionModule in submodules" situation, and we don't have to tell the user to set anything else.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Would you be able to append the default value changes to this PR or should I make another PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

This hides the obsolete options from the manual and sets reasonable
defaults for `x11.enable` and `gtk.enable` so that we don't have to tell
the user to enable them.
@ncfavier ncfavier force-pushed the pointercursor-renamed branch from c3f8250 to a3fef2a Compare January 4, 2023 09:11
@ncfavier
Copy link
Member Author

I guess we can abandon this now that markdown descriptions are rendered fine.

@ncfavier ncfavier closed this Jan 17, 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