miracle-wm-org / miracle-wm

Miracle is a Wayland tiling window manager built on Mir
https://miracle-wm.org
GNU General Public License v3.0
417 stars 14 forks source link

Setting environment variables when starting miracle-wm #232

Closed mecattaf closed 2 months ago

mecattaf commented 2 months ago

Currently when starting sway I have to resort the following method to set environment variables. Found this information on (Lorenzo Bettini's blog)[https://www.lorenzobettini.it/2024/06/environment-variables-in-sway/]:

1) Place the following file in ~/.config/environment.d/wayland.conf:

#GDK_BACKEND=wayland
#XDG_SESSION_TYPE=wayland
#XDG_CURRENT_DESKTOP=sway
#SDL_VIDEO_DRIVER=wayland

QT_QPA_PLATFORMTHEME=qt5ct
#QT_AUTO_SCREEN_SCALE_FACTOR=1
#QT_QPA_PLATFORM=wayland
#QT_WAYLAND_DISABLE_WINDOWDECORATION=1

2) Place the following file in /usr/etc/swayfx/swayrun

#!/usr/bin/env bash
set -euo pipefail

# Export all variables
set -a
# Call the systemd generator that reads all files in environment.d
source /dev/fd/0 <<EOF
$(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
EOF
set +a

exec sway

3) Place the following file in /usr/share/wayland-sessions/swayfx.desktop

[Desktop Entry]
Name=Custom Sway
Comment=An i3-compatible Wayland compositor with custom environment
Exec=/usr/etc/swayfx/swayrun
Type=Application
DesktopNames=CustomSway

Only then can my display manager (SDDM) start swayfx with the desired environment variables properly set. I hope that miracle-wm will have a simpler way to do this! Regardless please make sure to explain it thoroughly in the docs :)

Maybe related to #228

mecattaf commented 2 months ago

Already answered in wiki