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

nixos/x11: provide selected session to custom session #67260

Merged
merged 1 commit into from Aug 28, 2019

Conversation

pstch
Copy link
Contributor

@pstch pstch commented Aug 22, 2019

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.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS (not applicable)
    • other Linux distributions (not sure if applicable)
  • Tested via one or more NixOS test(s) (didn't find any applicable test)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/) (no binary file change)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date (did not found any relevant documentation)
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @edolstra

@pstch pstch marked this pull request as ready for review August 22, 2019 14:30
@pstch
Copy link
Contributor Author

pstch commented Aug 22, 2019

Note: this change is most useful with a corresponding change in home-manager (actually using the forwarded arguments), that I will submit if this PR is accepted. It is also useful for those who use custom .Xsession scripts.

@nixos-discourse
Copy link

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.
@pstch pstch force-pushed the fix/xsession-allow-session-choice branch from d85fd01 to a23798e Compare August 28, 2019 15:00
@pstch
Copy link
Contributor Author

pstch commented Aug 28, 2019

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.

@matthewbauer matthewbauer merged commit b8f9e09 into NixOS:master Aug 28, 2019
@nixos-discourse
Copy link

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 "$@"
Copy link
Member

Choose a reason for hiding this comment

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

Why eval?

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