Seatd: Difference between revisions

From Alpine Linux
m (removed sway as a category)
(added reference wrapper script, rephrased headings and sentence)
 
Line 3: Line 3:
When using [[elogind]], seatd is not required and viceversa. Don't add both to auto-start.
When using [[elogind]], seatd is not required and viceversa. Don't add both to auto-start.


= Installation =
== Installation ==


{{Cmd|apk add {{Pkg|seatd}}      # install seatd
{{Cmd|apk add {{Pkg|seatd}}      # install seatd
Line 13: Line 13:
If you are already logged in as a <code>$USER</code>, you will need to relogin.
If you are already logged in as a <code>$USER</code>, you will need to relogin.


= Seatd and Sway =
== Configuration ==


seatd is the light weight solution for [[sway]] compared to [[elogind]]. To manually start [[sway]]  with seatd following three steps are mandatory:
Seatd is the light weight solution for [[sway]] and other [[Wayland]] compositors compared to [[elogind]]. When using seatd, few mandatory steps are to be performed.


== Configuring XDG_RUNTIME_DIR ==
=== Configure XDG_RUNTIME_DIR ===
Set the variable [[XDG_RUNTIME_DIR]]. This step is required for all [[Wayland]] compositors.


Set the variable [[XDG_RUNTIME_DIR]].
=== Environment variables ===
Additional environment variables needs to be set for all [[Wayland]] compositors to work properly with seatd:
* <code>XDG_SESSION_TYPE=wayland</code>
* <code>LIBSEAT_BACKEND=seatd</code>
* <code>XDG_CURRENT_DESKTOP=sway</code>


== Environement variables ==
The variable <code>XDG_CURRENT_DESKTOP</code> must be suitably adjusted for other [[:Category:Compositor|Compositors]].
Additional environement variables that needs to be set for [[sway]] to work properly with seatd.
 
=== Seatd and Sway ===
 
When using seatd, [[sway]] must be started with above [[#Environment variables|Environment variables]] and [[D-Bus]] as shown below:


{{Cat|~/.profile|<nowiki>
{{Cat|~/.profile|<nowiki>
#Environment variables required for sway to work with seatd
# Environment variables required for seatd
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_TYPE=wayland
export LIBSEAT_BACKEND=seatd
export XDG_CURRENT_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
export LIBSEAT_BACKEND=seatd
export XDG_VTNR=$(basename "$(tty)" | sed 's/tty//')
</nowiki>}}
#Start sway with DBUS (only in TTY1)  
 
if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then
If you are planning to use [[Greetd]], a light weight login manager instead of {{Pkg|gdm}} or [[SDDM]] the below section does not apply. However the above two sections are still needed.
     exec dbus-run-session sway  
 
== start sway+seatd manually with D-Bus ==
 
When using seatd, [[sway]] must be started with [[D-Bus]] so that [[PipeWire]] and other such [[D-Bus]] dependenant services can work without issues.
 
{{Cat|~/.profile|<nowiki>
#Start sway with DBUS (Manual method)  
if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
     exec dbus-run-session sway -d 2> ~/sway_error.log
fi
fi
</nowiki>}}
</nowiki>}}
Ensure that your shell reads and executes the '''if''' condition in {{Path|.profile}}. Sway can also be launched with a [[Sway#Starting_sway|wrapper script]] with seatd. If using [[elogind]], then none of the above code snippets are required.


Ensure that your shell reads and executes the above if condition in .profile. {{Pkg|bash}} works with the above code. For other shells, make necessary changes.
== See Also ==
 
 
If you are using [[elogind]] then the above code snippets are not required.
* [https://man.sr.ht/~kennylevinsen/seatd/ seatd documentation]
* [https://man.sr.ht/~kennylevinsen/seatd/ seatd documentation]
* [https://github.com/swaywm/sway/wiki/Setting-environmental-variables sway wiki]
* [https://github.com/swaywm/sway/wiki/Setting-environmental-variables sway wiki]

Latest revision as of 09:30, 11 December 2024

Seatd is a seat management daemon, that does everything it needs to do. Nothing more, nothing less. Depends only on libc. Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root.

When using elogind, seatd is not required and viceversa. Don't add both to auto-start.

Installation

apk add seatd # install seatd rc-update add seatd # configure it to auto-start service seatd start # start it now adduser $USER seat # allow current user to access seatd

If you are already logged in as a $USER, you will need to relogin.

Configuration

Seatd is the light weight solution for sway and other Wayland compositors compared to elogind. When using seatd, few mandatory steps are to be performed.

Configure XDG_RUNTIME_DIR

Set the variable XDG_RUNTIME_DIR. This step is required for all Wayland compositors.

Environment variables

Additional environment variables needs to be set for all Wayland compositors to work properly with seatd:

  • XDG_SESSION_TYPE=wayland
  • LIBSEAT_BACKEND=seatd
  • XDG_CURRENT_DESKTOP=sway

The variable XDG_CURRENT_DESKTOP must be suitably adjusted for other Compositors.

Seatd and Sway

When using seatd, sway must be started with above Environment variables and D-Bus as shown below:

Contents of ~/.profile

# Environment variables required for seatd export XDG_SESSION_TYPE=wayland export LIBSEAT_BACKEND=seatd export XDG_CURRENT_DESKTOP=sway export XDG_VTNR=$(basename "$(tty)" | sed 's/tty//') #Start sway with DBUS (only in TTY1) if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then exec dbus-run-session sway fi

Ensure that your shell reads and executes the if condition in .profile. Sway can also be launched with a wrapper script with seatd. If using elogind, then none of the above code snippets are required.

See Also