Greetd: Difference between revisions

From Alpine Linux
m (missed wikitag)
m (moved service activation to its own heading)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:greetd}}
{{DISPLAYTITLE:greetd}}


[https://git.sr.ht/~kennylevinsen/greetd greetd] is a minimal and flexible login manager daemon that makes no assumptions about what you want to launch. It is recommended to read the [https://man.sr.ht/~kennylevinsen/greetd/ greetd wiki] first.
[https://git.sr.ht/~kennylevinsen/greetd greetd] is a minimal and flexible [[Display_manager|login manager]] daemon that makes no assumptions about what you want to launch. Greetd needs to be combined with a greeter. You can find a list of available greeters: {{pkg|greetd-*}}.  


== Installation ==
== Text based greeter ==


greetd needs to be combined with a greeter. You can find a list of available greeters here: {{pkg|greetd-*}}. This page shows the graphical greeter gtkgreet which is packaged as {{pkg|greetd-gtkgreet}}. Install the main package and the greeter:
Text based greeter like {{pkg|greetd-agreety}} can log you into a normal terminal session. Make sure that <code>vt</code> is set in:
{{cmd|# apk add {{pkg|greetd}} {{pkg|greetd-gtkgreet}} }}
{{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
command = "agreety --cmd /bin/sh"
[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number designating the VT.
vt = 7
</nowiki>}}


Install a lightweight wayland compositor to be used with greetd login session.(If using [[Sway]], no need for {{pkg|cage}}).  
Remember to [[#Activate greetd service|activate greetd service]].  
{{cmd|# apk add {{pkg|cage}}}}


== Configuration ==
== Graphical greeter - gtkgreet  ==


Graphical greeters like gtkgreet require either [[seatd]] or [[elogind]].  
The following section details the steps for using the graphical greeter '''gtkgreet''' which is packaged as {{pkg|greetd-gtkgreet}}.  


If using cage, the config file appears as follows:
# Install the main package and the greeter:{{cmd|# apk add {{pkg|greetd}} {{pkg|greetd-gtkgreet}} }}
{{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
# Install a lightweight wayland compositor to be used with greetd login session.(If using [[Sway]], no need for {{pkg|cage}}).{{cmd|# apk add {{pkg|cage}}}}
# Graphical greeters like gtkgreet require either [[seatd]] or [[elogind]]. If using [[seatd]], follow the additional steps for [[#Using seatd with greetd|using seatd with greetd]].
# Gtkgreet reads desktop sessions from the file {{Path|/etc/greetd/environments}}, So create the file with the list of login environments/desktop sessions. Instead of listing <Code>sway</Code> a [[Sway#Starting_sway|wrapper script]] like <Code>sway-run</Code> can be used.{{Cat|/etc/greetd/environments|<nowiki>sway-run</nowiki>}}
# If using cage, do not skip the '''-s''' option and the config file appears as follows:{{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
command = "cage -s -- gtkgreet"
command = "cage -s -- gtkgreet"
# Uncomment below command, if you have only one desktop session.
# command = "cage -s -- gtkgreet --command sway-run"
user = "greetd"</nowiki>}}
# Instead of {{pkg|cage}}, any other wayland compositor like [[sway]] can be used by setting the greetd config file: {{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
command = "sway --config /etc/greetd/sway-config"
user = "greetd"
user = "greetd"
</nowiki>}}
</nowiki>}}
# If [[sway]] is used, create a dedicated sway config file that runs the greeter and terminates when it dies: {{cat|/etc/greetd/sway-config|<nowiki>exec "gtkgreet -l -s /etc/greetd/gtkgreet.css; swaymsg exit"
</nowiki>}}
# Remember to [[#Activate greetd service|activate greetd service]].


Instead of {{pkg|cage}}, [[sway]] or any other wayland compositor can be used by setting the greetd config file: {{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
== Using seatd with greetd ==
command = "sway --config /etc/greetd/sway-config"
user = "greetd"
</nowiki>}}


{{Note|User '''greetd''' also needs [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}
When [[seatd]] is used, following additional configuration is required.
When [[seatd]] is used, following additional configuration is required.
# For graphical greeters like gtkgreet, the user '''greetd''' needs the <code>seatd</code> group:{{cmd|# adduser greetd seat}}   
# For graphical greeters like gtkgreet, the user '''greetd''' needs the <code>seatd</code> group:{{cmd|# adduser greetd seat}}   
Line 31: Line 44:
<nowiki>rc_need=seatd
<nowiki>rc_need=seatd
</nowiki>}}
</nowiki>}}
# User '''greetd''' also needs [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]]. If [[Wayland#Use mkrundir|mkrundir]] is used, a simple wrapper script named <code>sway-greeted</Code> can be created as follows: {{Cat|/usr/local/bin/sway-greetd|#!/bin/sh
export XDG_RUNTIME_DIR{{=}}$(mkrundir)
exec sway $@}}
# Make it executable using {{Codeline|<Code># chmod +x /usr/local/bin/sway-greetd</Code>}} and replace <code>sway</code> by <code>sway-greetd</code> in the greetd config file:{{Cat|/etc/greetd/config.toml|<nowiki>[default_session]
command = "sway-greetd --config /etc/greetd/sway-config"
user = "greetd"
</nowiki>}}


Create a dedicated sway config file that runs the greeter and terminates when it dies: {{cat|/etc/greetd/sway-config|<nowiki>exec "gtkgreet -l -s /etc/greetd/gtkgreet.css; swaymsg exit"
== Activate greetd service ==
</nowiki>}}
 
Once you have completed the above configuration i.e text or graphical greeter, enable and start greetd:{{cmd|<nowiki># rc-update add greetd
# rc-service greetd start</nowiki>}}


Edit/create the list of login environments for gtkgreet, which is by default read from {{Path|/etc/greetd/environments}}. Instead of listing <Code>sway</Code> a [[Sway#Starting_sway|wrapper script]] like <Code>sway-run</Code> can be used.{{Cat|/etc/greetd/environments|<nowiki>sway-run
== Auto-login ==
</nowiki>}}


Once you have completed the above configuration, Enable and start greetd:
Follow [https://man.sr.ht/~kennylevinsen/greetd/#setting-up-auto-login greetd wiki] for auto-login instructions. No alpine Linux specific changes are required.
{{cmd|<nowiki># rc-update add greetd
# rc-service greetd start</nowiki>}}


For text based greeters you want to make sure that <code>vt</code> is set in:
== See also ==
{{Cat|/etc/greetd/config.toml|<nowiki>
[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = 7
</nowiki>}}


== See Also ==
* [https://man.sr.ht/~kennylevinsen/greetd/ greetd wiki]
* [https://man.sr.ht/~kennylevinsen/greetd/ greetd wiki]
* [https://wiki.archlinux.org/title/Greetd Arch wiki]
* [https://wiki.archlinux.org/title/Greetd Arch wiki]

Latest revision as of 05:35, 5 January 2025


greetd is a minimal and flexible login manager daemon that makes no assumptions about what you want to launch. Greetd needs to be combined with a greeter. You can find a list of available greeters: greetd-*.

Text based greeter

Text based greeter like greetd-agreety can log you into a normal terminal session. Make sure that vt is set in:

Contents of /etc/greetd/config.toml

[default_session] command = "agreety --cmd /bin/sh" [terminal] # The VT to run the greeter on. Can be "next", "current" or a number designating the VT. vt = 7

Remember to activate greetd service.

Graphical greeter - gtkgreet

The following section details the steps for using the graphical greeter gtkgreet which is packaged as greetd-gtkgreet.

  1. Install the main package and the greeter:

    # apk add greetd greetd-gtkgreet

  2. Install a lightweight wayland compositor to be used with greetd login session.(If using Sway, no need for cage).

    # apk add cage

  3. Graphical greeters like gtkgreet require either seatd or elogind. If using seatd, follow the additional steps for using seatd with greetd.
  4. Gtkgreet reads desktop sessions from the file /etc/greetd/environments, So create the file with the list of login environments/desktop sessions. Instead of listing sway a wrapper script like sway-run can be used.

    Contents of /etc/greetd/environments

    sway-run
  5. If using cage, do not skip the -s option and the config file appears as follows:

    Contents of /etc/greetd/config.toml

    [default_session] command = "cage -s -- gtkgreet" # Uncomment below command, if you have only one desktop session. # command = "cage -s -- gtkgreet --command sway-run" user = "greetd"
  6. Instead of cage, any other wayland compositor like sway can be used by setting the greetd config file:

    Contents of /etc/greetd/config.toml

    [default_session] command = "sway --config /etc/greetd/sway-config" user = "greetd"
  7. If sway is used, create a dedicated sway config file that runs the greeter and terminates when it dies:

    Contents of /etc/greetd/sway-config

    exec "gtkgreet -l -s /etc/greetd/gtkgreet.css; swaymsg exit"
  8. Remember to activate greetd service.

Using seatd with greetd

Note: User greetd also needs XDG_RUNTIME_DIR.

When seatd is used, following additional configuration is required.

  1. For graphical greeters like gtkgreet, the user greetd needs the seatd group:

    # adduser greetd seat

  2. Append rc_need=seatd in the following file:

    Contents of /etc/conf.d/greetd

    ... rc_need=seatd

Activate greetd service

Once you have completed the above configuration i.e text or graphical greeter, enable and start greetd:

# rc-update add greetd # rc-service greetd start

Auto-login

Follow greetd wiki for auto-login instructions. No alpine Linux specific changes are required.

See also