如何让 lightdm 启动 xmonad?

如何让 lightdm 启动 xmonad?

我一直在使用 xmonad 运行 nixos 并用于startx启动 xserver。但我决定要有一个迎宾员。

我首先通过禁用startx和启用来尝试 sddmsddm

services.xserver {
  displayManager {
    startx.enable = false;
    sddm.enable = true;
  };
};

我重建了 nixos ( nixos-rebuild switch) 并且 sddm 似乎工作正常,但是当我正确输入密码时什么也没有发生。因此,由于懒惰并且不致力于 sddm,我决定而不是尝试解决问题,而是切换到另一个显示管理器,所以我切换到 lightdm

services.xserver {
  displayManager {
    startx.enable = false;
    lightdm.enable = true;
  };
};

当我重建时,发生了类似的事情,lightdm 启动正常,但当我尝试登录时,它通知我“登录失败”。所以我检查了日志/var/log/lightdm/lightdm.log

日志相当长,所以这是我登录后的选择

[+15.51s] DEBUG: Authenticate result for user ww: Success
[+15.51s] DEBUG: User ww authorized
[+15.51s] DEBUG: Greeter requests default session
[+15.56s] DEBUG: Seat seat0: Failed to find session configuration default
[+15.56s] DEBUG: Seat seat0: Can't find session 'default'
[+31.69s] DEBUG: Seat seat0 changes active session to 
[+68.26s] DEBUG: Seat seat0 changes active session to 2
[+701.81s] DEBUG: Got signal 15 from process 1
[+701.81s] DEBUG: Caught Terminated signal, shutting down
[+701.81s] DEBUG: Stopping display manager
[+701.81s] DEBUG: Seat seat0: Stopping
[+701.81s] DEBUG: Seat seat0: Stopping display server
[+701.81s] DEBUG: Sending signal 15 to process 997
[+701.81s] DEBUG: Seat seat0: Stopping session
[+701.81s] DEBUG: Terminating login1 session c1
[+701.87s] DEBUG: Session pid=1043: Sending SIGTERM
[+701.87s] DEBUG: Seat seat0: Stopping session
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe
[+701.87s] WARNING: Session pid=1061: Error writing to session: Broken pipe

所以看起来它找不到“默认会话”。环顾四周后,我/usr/share/sessions/xmonad.desktop用内容创建了:

[Desktop Entry]
Encoding=UTF-8
Name=xmonad
Comment=This session starts xmonad
Exec=/home/ww/.local/bin/xmonad
Type=Application

基于xmonad 常见问题解答。为了引用该文件,我还创建了/usr/share/lightdm/lightdm.conf.d以下内容:

[SeatDefaults]
user-session=xmonad

基于Ubuntu wiki 中的 lightdm 页面

但是,重新启动后,这并不能解决问题或有意义地更改错误日志。

我怎样才能弥补这个差距,以便 lightdm 能够正确启动 xmonad?我觉得我在理解当前正在发生的事情以及应该发生的事情方面存在概念上的失败。

答案1

我将 XMonad 与 LightDM 结合使用。这是我的configuration.nix的相关部分:

  services.xserver = {
    enable = true;
    windowManager = {
      default = "xmonad";
      xmonad = {
        enable = true;
        enableContribAndExtras = true;
      };
    };
    # On nixos-unstable I needed to add this deprecated setting (not sure if still needed)
    desktopManager.default = "none";
  };

我还.xsession对我进行了符号链接.xinitrc,以便通过 {X,Light,G}DM 启动的会话将启动相同的程序。

ln -s .xinitrc .xsession

相关内容