Sway. Загрузка
Загрузка сессии Sway.
Содержание
1 Дисплей-менеджеры
2 Загрузка переменных среды перед сессией
- Для работоспособности Sway необходимо часть переменных загрузить перед сессией (см. Sway. Совместимость приложений).
2.1 Скрипт загрузки Sway
- Можно использовать наработки Fedora.
- Репозиторий: https://gitlab.com/fedora/sigs/sway/sway-config-fedora
- Для запуска используется скрипт
/usr/bin/start-sway
:1#!/bin/sh 2 3## Internal variables 4readonly _SWAY_COMMAND="/usr/bin/sway" 5SWAY_EXTRA_ARGS="" 6 7## General exports 8export XDG_CURRENT_DESKTOP=sway 9export XDG_SESSION_DESKTOP=sway 10export XDG_SESSION_TYPE=wayland 11 12## Hardware compatibility 13# We can't be sure that the virtual GPU is compatible with Sway. 14# We should be attempting to detect an EGL driver instead, but that appears 15# to be a bit more complicated. 16case $(systemd-detect-virt --vm) in 17 "none"|"") 18 ;; 19 "kvm") 20 # There's two drivers we can get here, depending on the 3D acceleration 21 # flag state: either virtio_gpu/virgl or kms_swrast/llvmpipe. 22 # 23 # The former one causes graphical glitches in OpenGL apps when using 24 # 'pixman' renderer. The latter will crash 'gles2' renderer outright. 25 # Neither of those support 'vulkan'. 26 # 27 # The choice is obvious, at least until we learn to detect the driver 28 # instead of abusing the virtualization technology identifier. 29 # 30 # See also: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2871 31 export WLR_RENDERER=pixman 32 # 'pixman' on virtio_gpu with recent kernels is glitchy. Appears that 33 # it only affects atomic KMS, and legacy interface works. 34 export WLR_DRM_NO_ATOMIC=1 35 # WLR_NO_HARDWARE_CURSORS=1 is not needed with legacy DRM interface 36 ;; 37 *) 38 # https://github.com/swaywm/sway/issues/6581 39 export WLR_NO_HARDWARE_CURSORS=1 40 ;; 41esac 42 43## Apply `environment.d(5)` customizations 44# This can be used to share the custom environment configs with systemd --user. 45# Importing `systemd --user show-environment` here may have unexpected 46# consequences, such as getting a leftover `WAYLAND_DISPLAY` or `DISPLAY` 47# and breaking Sway startup. Thus, the direct call to a systemd generator. 48set -o allexport 49eval "$(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)" 50set +o allexport 51 52## Load Sway-specific system environment customizations 53if [ -f /etc/sway/environment ]; then 54 set -o allexport 55 # shellcheck source=/dev/null 56 . /etc/sway/environment 57 set +o allexport 58fi 59 60## Load Sway-specific user environment customizations 61if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/sway/environment" ]; then 62 set -o allexport 63 # shellcheck source=/dev/null 64 . "${XDG_CONFIG_HOME:-$HOME/.config}/sway/environment" 65 set +o allexport 66fi 67 68## Unexport internal variables 69# export -n is not POSIX :( 70_SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS" 71unset SWAY_EXTRA_ARGS 72 73## Log all exported WLR_ variables 74if _WLR_VARS=$(env | grep '^WLR_'); then 75 printf 'environment variables for wlroots: %s' "$_WLR_VARS" | 76 tr '\n' ' ' | 77 systemd-cat -p notice -t "${_SWAY_COMMAND##*/}" 78fi 79 80# Start sway with extra arguments and send output to the journal 81# shellcheck disable=SC2086 # quoted expansion of EXTRA_ARGS can produce empty field 82exec systemd-cat -- $_SWAY_COMMAND $_SWAY_EXTRA_ARGS "$@"
- Этот скрипт читает переменные для сессии Sway из файлов:
/etc/sway/environment
;${XDG_CONFIG_HOME}/sway/environment
(~/.config/sway/environment
).
- Для запуска этого файла из стандартный дисплей-менеджеров нужно поправить файл
/usr/share/wayland-sessions/sway.desktop
: - Эти патчи добавлены в оверлей karma (см. Gentoo. Дополнительные репозитории).
2.2 Локальные переменные среды для Sway
- Файл с заданными локальными переменными находится в
~/.config/sway/environment
:1# -*- mode: shell -*- 2# vim: set ft=sh: 3# This file will be sourced from /usr/bin/start-sway script. 4# User-specific variables should be placed in $XDG_CONFIG_HOME/sway/environment 5 6## Pass extra arguments to the /usr/bin/sway executable 7 8#SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS --unsupported-gpu" 9#SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS --debug" 10 11## Set environment variables 12 13# Useful variables for wlroots: 14# https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/docs/env_vars.md 15# 16#WLR_NO_HARDWARE_CURSORS=1
- Исправления для Java (см. Sway. Совместимость приложений):
- Исправления для Qt (см. Sway. Совместимость приложений):