Greetd

提供: ArchWiki
2021年6月8日 (火) 23:05時点におけるKgx (トーク | 投稿記録)による版 (一部翻訳)
ナビゲーションに移動 検索に移動

関連記事

greetd は、コンソールベースであれグラフィカルであれ、ユーザが何を起動したいのかを仮定しない、軽量で柔軟な login manager デーモンです。コンソールから起動できるスクリプトやプログラムはすべて greetd で起動できるので、 Wayland Compositors に特に適しています。greeter を起動して、他のディスプレイマネージャと同様にユーザセッションを開始することもできます。

Installation

Install the greetdAUR or greetd-gitAUR packages.

Configuration

The default configuration file is /etc/greetd/config.toml. PAM-specific options should be set in /etc/pam.d/greetd.

Greeters

In order to allow user sessions to be started, greetd can launch a greeter. Several greeters are available:

By default, greeters are run as the greeter user. This can be changed by editing the user option in the default_session section of the configuration file and replacing another_user with the chosen user:

 ...
 user = "another_user"
 ...

Make sure the ownership of the /etc/greetd directory is set accordingly.

agreety

In order to launch a normal console session with agreety, edit the configuration file as follows:

 ...
 [default_session]
 command = "agreety --cmd $SHELL"
 ...

agreety can launch any arbitrary command once a user logs in. For example, in order to start Sway, replace $SHELL in the example above with sway.

gtkgreet

In order to run, gtkgreet needs a compositor. It is recommended to use Sway, but cage can also be used. Make sure the compositor you would like to use is installed before starting greetd. If you want to use cage, your [default_session] section should be:

 ...
 [default_session]
 command = "cage gtkgreet"
 ...

If you want to use Sway, the greeter must be terminated once the user logs in. For that purpose, a specific configuration file must be created for Sway, for example in /etc/greetd/sway-config, with the following content:

 # `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
 exec "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'
 
 include /etc/sway/config.d/*

Then, gtkgreeter must be set to start Sway with the configuration file above:

 ...
 [default_session]
 command = "sway --config /etc/greetd/sway-config"
 ...

In order to specify which login environments can be started by gtkgreet, list them in /etc/greetd/environments. For example:

 sway
 bash

Instead, you can also invoke gtkgreet with the -c mycommand parameter, replacing mycommand with the desired program (for example, bash or sway) either in /etc/greetd/config.toml, if you use Cage, or in /etc/greetd/sway-config, if you use Sway.

wlgreet

In order for greetd to start wlgreet, follow the steps required to set up gtkgreet with Sway as described above with the following /etc/greetd/sway-config instead:

 exec "wlgreet --command sway; 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'
  
 include /etc/sway/config.d/*

tuigreet

tuigreet does not require any special setup, just refer to it in /etc/greetd/config.toml:

...
[default_session]
command = "tuigreet --cmd sway"
...

tuigreet --help will display customization options.

Autologin

If you want a user to be logged in automatically, an initial session must be defined in the configuration file:

 [default_session]
 command = "cage gtkgreet"
 
 [initial_session]
 command = "sway"
 user = "myuser"

The command option may contain the name of any executable file. In the example above, Sway will be started by myuser at boot and gtkgreet will be launched after the user logs out.

If you don't want to use greetd and always want autologin to be enabled, see autologin.

Starting greetd at boot

Enable greetd.service for greetd to be started at boot.

See also