diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2021-02-28 13:08:34 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 13:08:34 -0300 |
commit | e753d4c2267c0319f89f03dfdaf953635bf8b3ab (patch) | |
tree | 5ed6b8b7fb246c95825e404e815ed6cdfbff04cb /nixos | |
parent | 2d0b606980b956fea440c548ec240fff0a0659ca (diff) | |
parent | 580cf02c1967c6338058862fbe3724b57a559a39 (diff) |
Merge pull request #95019 from SFrijters/xsession-env-vars
nixos/x11: Respect XCOMPOSECACHE/XDG_DATA_HOME if set in xsession-wrapper
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 9fdbe753dad50..e04fcdaf4145d 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -37,6 +37,11 @@ let . /etc/profile cd "$HOME" + # Allow the user to execute commands at the beginning of the X session. + if test -f ~/.xprofile; then + source ~/.xprofile + fi + ${optionalString cfg.displayManager.job.logToJournal '' if [ -z "$_DID_SYSTEMD_CAT" ]; then export _DID_SYSTEMD_CAT=1 @@ -64,22 +69,23 @@ let # Speed up application start by 50-150ms according to # http://kdemonkey.blogspot.nl/2008/04/magic-trick.html - rm -rf "$HOME/.compose-cache" - mkdir "$HOME/.compose-cache" + compose_cache="''${XCOMPOSECACHE:-$HOME/.compose-cache}" + mkdir -p "$compose_cache" + # To avoid accidentally deleting a wrongly set up XCOMPOSECACHE directory, + # defensively try to delete cache *files* only, following the file format specified in + # https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/modules/im/ximcp/imLcIm.c#L353-358 + # sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); + ${pkgs.findutils}/bin/find "$compose_cache" -maxdepth 1 -regextype posix-extended -regex '.*/[Bl][0-9]+_[0-9a-f]{3}_[0-9a-f]{8}_[0-9a-f]{8}' -delete + unset compose_cache # Work around KDE errors when a user first logs in and # .local/share doesn't exist yet. - mkdir -p "$HOME/.local/share" + mkdir -p "''${XDG_DATA_HOME:-$HOME/.local/share}" unset _DID_SYSTEMD_CAT ${cfg.displayManager.sessionCommands} - # Allow the user to execute commands at the beginning of the X session. - if test -f ~/.xprofile; then - source ~/.xprofile - fi - # Start systemd user services for graphical sessions /run/current-system/systemd/bin/systemctl --user start graphical-session.target |