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

KDE Plasma5 + xdg-user-dir: plasma5 xorg session does not autostart xdg-user-dirs.desktop #222925

Closed
cx405 opened this issue Mar 24, 2023 · 3 comments
Labels
0.kind: bug Something is broken

Comments

@cx405
Copy link

cx405 commented Mar 24, 2023

Describe the bug

This is what I observe for NEW user with clean home directory.
configuration.nix has only plasma5 enabled.

> find ~ -name *dirs.dirs
> ls -1 ~
Desktop
> xdg-
xdg-desktop-icon      xdg-icon-resource     xdg-screensaver       xdg-user-dirs-update
xdg-desktop-menu      xdg-mime              xdg-settings          
xdg-email             xdg-open              xdg-user-dir          


> xdg-user-dirs-update
> find ~ -name *dirs.dirs
/home/testuser/.config/user-dirs.dirs
> ls -1 ~
Desktop
Documents
Downloads
Music
Pictures
Public
Templates
Videos
> ls -1 /run/current-system/sw/etc/xdg/autostart/
baloo_file.desktop
gmenudbusmenuproxy.desktop
kaccess.desktop
klipper.desktop
kwrited-autostart.desktop
org.kde.kdeconnect.daemon.desktop
org.kde.plasmashell.desktop
pam_kwallet_init.desktop
polkit-kde-authentication-agent-1.desktop
powerdevil.desktop
xdg-user-dirs.desktop
xembedsniproxy.desktop
> cat /run/current-system/sw/etc/xdg/autostart/xdg-user-dirs.desktop
[Desktop Entry]
Type=Application
Name=User folders update
TryExec=xdg-user-dirs-update
Exec=xdg-user-dirs-update
StartupNotify=false
NoDisplay=true

X-GNOME-Autostart-Phase=Initialization
X-KDE-autostart-phase=1

Plasma ignores the requirement to autostart /run/current-system/sw/etc/xdg/autostart/xdg-user-dirs.desktop

Linked discussion:
#222904 comment 1483124476
#221604 #222904

Expected behavior

The desktop file xdg-user-dirs.desktop is installed together with xdg-user-dirs-update script by package xdg-user-dirs sourced by all DEs, including Plasma. This desktop file is expected to be executed by DE so that xdg-user-dirs-update can building the home directories.

Behavior can be disabled by linking directories to $HOME.

Notify maintainers

@ttuegel
@nyanloutre
(from https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/desktops/plasma-5/default.nix#L38)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.0.10-lqx1, NixOS, 22.11 (Raccoon), 22.11.3253.eac7da7b519`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/error-installing-kde-spin-i-think/27375/4

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/error-installing-kde-spin-i-think/27375/6

@cx405
Copy link
Author

cx405 commented Apr 19, 2023

As per discourse discussion and thanks to jtojnar, this is due a confirmed bug: systemd/systemd#18791 Patch is already out. Bug affects only KDE and impacts all distributions. Until it lands, use either:

  1. in ~/.config/autostart create a file “userdirs.desktop” with this content:
[Desktop Entry]
Exec=xdg-user-dirs-update
TryExec=xdg-user-dirs-update
NoDisplay=true
StartupNotify=false
Type=Application
X-KDE-AutostartScript=true
X-KDE-autostart-phase=1

or
2) add this to configuration.nix to create systemd user service, which does the same:

systemd.user.services.xdg-user-dirs_workaround={
 description="(Workaround to 2a63d3f0) User folders update";
 documentation=["man:xdg-user-dirs-update(1)"];
 path=[pkgs.xdg-user-dirs];
 wantedBy=["graphical-session-pre.target"];
 unitConfig.RequiresMountsFor="/home";
 serviceConfig.Type="oneshot";
 script="${pkgs.bash}/bin/xdg-user-dirs-update";
};

there is no need to enable anything, its managed by NixOS, reboot and relogin should be enough.

Directories can be controlled from within configuration.nix like this (example):

environment.etc."xdg/user-dirs.defaults".text=''
 DESKTOP=Desktop
 DOWNLOAD=Downloads
 TEMPLATES=Documents/Templates
 PUBLICSHARE=Documents/Public
 DOCUMENTS=Documents
 MUSIC=Documents/Music
 PICTURES=Documents/Photos
 VIDEOS=Documents/Movies
'';

Beware that directory localization is extremely primitive, only few words allowed. Custom directory names are possible by editing the ~/.config/user-dirs.dirs after relogin, or write them as-is globally for every user into configuration.nix.

@cx405 cx405 closed this as completed Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants