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
nixos/x11: provide selected session to custom session #67260
nixos/x11: provide selected session to custom session #67260
Conversation
Note: this change is most useful with a corresponding change in |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/46 |
The custom session script is always executed (when it exists). This change passes the selected session script and select session name to the custom session script, so that it can defer to the selected session script based on the value of the selected session name.
d85fd01
to
a23798e
Compare
Note: there was a mistake in the commit message ("based on the current value of xterm"), I force-pushed an amended commit. Sorry for the useless bot run, I will be more careful next time. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/opening-i3-from-home-manager-automatically/4849/4 |
@@ -109,7 +109,7 @@ let | |||
|
|||
# Allow the user to setup a custom session type. | |||
if test -x ~/.xsession; then | |||
exec ~/.xsession | |||
eval exec ~/.xsession "$@" |
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.
Why eval
?
The custom session script is always executed (when it exists). This provides the selected session script to the custom session script so that it can defer to it based on the value of xterm.
Motivation for this change
Currently, if the
.Xsession
file exists, it is always used, by calling it without arguments. It is normal behaviour, but it means that any session choice made by the user in the display manager will be ignored. By providing the selected session script and session name to the user's custom session script, we allows this script to make its own choice (for example, based on the session name) and either launch the user-configured (for example, in home-manager) session or the user selected session (for example, in LightDM).Things done
Made the
xsessionWrapper
script forward its argument to the.Xsession
script.I tested this change with other DMs and home-manager.
Notes
I had a quick look at existing custom
.Xsession
scripts to see if any would break when passed arguments, but didn't find anything, since most of these scripts don't expect any arguments (and so they never use them).I've also read existing discussions on this repository about the rationale for
xsessionWrapper
always calling.Xsession
whatever the user choosed in the DM (which is sound, as it allows more control). It was suggested that the script and session name should be available in the environment, but it doesn't seem to be the case (as it is never exported), and so made this change so that the.Xsession
script can decide what to do (using the forwarded arguments).If it's better to handle this with the environment, I can submit another PR that uses the environment instead of arguments.
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
) (no binary file change)nix path-info -S
before and after)Notify maintainers
cc @edolstra