-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
"home" | ||
"pointerCursor" | ||
"size" | ||
]) | ||
(mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [ | ||
(mkRenamedOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [ | ||
"home" | ||
"pointerCursor" | ||
"x11" |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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 wheneverconfig.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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c3f8250
to
a3fef2a
Compare
I guess we can abandon this now that markdown descriptions are rendered fine. |
This hides the obsolete options from the manual, at the cost of displaying two warnings: the one from
mkRenamedOptionModule
and the generic migration instructions forxsession.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
See CONTRIBUTING for more information and recent commit messages for examples.