44 lines
1.8 KiB
Bash
Executable File
44 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# greetd's default_session command. Installed to /usr/local/bin/kiosk-session.
|
|
#
|
|
# Exists so that MQTT_BROKER_HOST / HA_URL / GPU_VENDOR are in Sway's environment:
|
|
# sway's config file has no way to read an env file itself, but every `exec` line it
|
|
# runs inherits this process's environment, so sourcing here is what lets the session
|
|
# scripts read configuration without the sway config being templated.
|
|
set -eu
|
|
|
|
# An `if` rather than `[ -r … ] && . …`: under `set -e` the && form exits the whole
|
|
# script when the file is absent, which would leave greetd with a session that dies
|
|
# instantly and a black screen.
|
|
if [ -r /etc/steamtv-agent/config.env ]; then
|
|
. /etc/steamtv-agent/config.env
|
|
fi
|
|
export MQTT_BROKER_HOST HA_URL GPU_VENDOR
|
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
export XDG_SESSION_TYPE=wayland
|
|
export XDG_SESSION_DESKTOP=sway
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
: "${XDG_RUNTIME_DIR:=/run/user/$(id -u)}"
|
|
export XDG_RUNTIME_DIR
|
|
|
|
# Steam's client, Proton, Prism's Minecraft windows and most native titles are X11
|
|
# applications. Telling them the display is 96dpi-normal and letting Xwayland scale is
|
|
# the sane default for a TV at 1-2m viewing distance; a 4K set that looks
|
|
# postage-stamp-sized wants this raised, not the compositor's scale changed (which
|
|
# would blur Big Picture).
|
|
export GDK_BACKEND=wayland,x11
|
|
export QT_QPA_PLATFORM="wayland;xcb"
|
|
export SDL_VIDEODRIVER=wayland,x11
|
|
|
|
# NVIDIA's driver still mishandles hardware cursor planes under wlroots on a number of
|
|
# releases; the symptom is an invisible or corrupt pointer, which on a box you drive
|
|
# with a gamepad is easy to miss until someone picks up a mouse. Harmless when set on
|
|
# hardware that doesn't need it, so it is scoped to the vendor rather than always on.
|
|
if [ "${GPU_VENDOR:-}" = "nvidia" ]; then
|
|
export WLR_NO_HARDWARE_CURSORS=1
|
|
fi
|
|
|
|
exec sway
|