Greetd: Difference between revisions
imported>Gdamjan info by nat543207 |
mNo edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
swayConfig = pkgs.writeText "greetd-sway-config" '' | swayConfig = pkgs.writeText "greetd-sway-config" '' | ||
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet. | # `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet. | ||
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l | exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit" | ||
bindsym Mod4+shift+e exec swaynag \ | bindsym Mod4+shift+e exec swaynag \ | ||
-t warning \ | -t warning \ | ||
Line 54: | Line 54: | ||
{{note|1=<nowiki/> | {{note|1=<nowiki/> | ||
If you're hosting gtkgreet in a Wayland compositor, | If you're hosting gtkgreet in a Wayland compositor, there is a known issue, between GTK portals and dbus, of a delay before the greeter appears,. There are a couple known workarounds depending on the compositor you're using: | ||
* Cage: https://github.com/Hjdskes/cage/issues/169#issuecomment-691659377 | * Cage: https://github.com/Hjdskes/cage/issues/169#issuecomment-691659377 | ||
* Sway: https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start | * Sway: https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start | ||
}} | }} | ||
[[Category:Desktop environment]] |
Latest revision as of 20:27, 24 April 2024
greetd is a minimal login manager.
Usage
Using this configuration, greetd will use the greeter gtkgreet
, asking for user, password and which session to start as defined in the /etc/greetd/environments
file:
/etc/nixos/configuration.nix
{ config, lib, pkgs, ... }:
let
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
'';
in
{
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
environment.etc."greetd/environments".text = ''
sway
fish
bash
startxfce4
'';
}
In this minimal example, the Wayland compositor Sway automatically gets executed by the user myuser
after successfull boot, no password required:
/etc/nixos/configuration.nix
services.greetd = {
enable = true;
settings = rec {
initial_session = {
command = "${pkgs.sway}/bin/sway";
user = "myuser";
};
default_session = initial_session;
};
};
initial_session
is executed automatically. If you just define default_session
, greetd will ask for a password and execute command
with user myuser
.