Sway: Difference between revisions
imported>Rasmus-kirk No edit summary |
imported>Onny Alternatives to autostart Sway |
||
Line 104: | Line 104: | ||
=== Autostart Sway === | === Autostart Sway === | ||
It is possible to use greetd, a minimal login manager, to autostart Sway: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
environment.loginShellInit = '' | services.greetd = { | ||
enable = true; | |||
settings = rec { | |||
initial_session = { | |||
command = "${pkgs.sway}/bin/sway"; | |||
user = "myuser"; | |||
}; | |||
default_session = initial_session; | |||
}; | |||
}; | |||
</nowiki>}} | |||
Where <code>myuser</code> needs to be replaced with the username which should execute Sway. | |||
Alternatively, you could use <code>getty</code> to auto login into <code>tty1</code> with <code>myuser</code>. Using <code>loginShellInit</code> Sway will automatically get started after user login: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
services.getty.autologinUser = "myuser"; | |||
environment.loginShellInit = '' | |||
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then | |||
exec sway | |||
fi | |||
''; | |||
</nowiki>}} | </nowiki>}} | ||