Github messages for voidlinux
 help / color / mirror / Atom feed
From: gspe <gspe@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: sway: add wrapper scripts
Date: Sun, 31 Jan 2021 17:21:23 +0100	[thread overview]
Message-ID: <20210131162123.w1aflh2jQhBCRQhlGzU2-I30SNOuBwZEKQgYYZiIw2s@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-28036@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 2174 bytes --]

New comment by gspe on void-packages repository

https://github.com/void-linux/void-packages/issues/28036#issuecomment-770407450

Comment:
I'll post an update here so if someone have problems with D-Bus configuration can find some help.
I've taken inspiration from how kde plasma wayland is started, https://github.com/KDE/plasma-workspace/blob/master/startkde/plasma-dbus-run-session-if-needed

I have modified the wrap script to run sway `/usr/bin/sway-run.sh` as follow:

```
#!/bin/sh

# Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway

# D-Bus
# If the session bus is not available it is spawned and wrapper round our program
# Otherwise we spawn our program directly
drs=
if [ -z "${DBUS_SESSION_BUS_ADDRESS}" ]
then
   drs=dbus-run-session
fi

# Environment
# Source environmental variable from all files in PATH_ENVIRONMENT
# file should be named *.conf and have KEY=value format use # for comment
PATH_ENVIRONMENT=$HOME/.config/environment.d
if [ -d "$PATH_ENVIRONMENT" ]; then
  for i in "$PATH_ENVIRONMENT"/*.conf ; do
  if [ -f "$i" ]; then
    set -a; . "$i"; set +a
  fi
  done
fi

exec ${drs} sway "$@"
```

So if there is already a running dbus user session sway is started normally but if there isn't any the script start one dbus user session and sway inside it.

With this script Environmental variable are read from `~/.config/environment.d` directory, like how systemd user does.
User can put any file ending in `*.conf` inside this directory and they are sourced before sway start importing any `KEY=value` defined into environment.
In my case i have ` ~/.config/environment.d/wayland.conf` like this: 

```
# recomended enviroment variables for sway based desktop
MOZ_ENABLE_WAYLAND=1
QT_QPA_PLATFORM=wayland-egl
CLUTTER_BACKEND=wayland
ECORE_EVAS_ENGINE=wayland-egl
ELM_ENGINE=wayland_egl
SDL_VIDEODRIVER=wayland
_JAVA_AWT_WM_NONREPARENTING=1
NO_AT_BRIDGE=1

# QT theme
QT_QPA_PLATFORMTHEME=qt5ct
```

With this modification I don't have `/etc/sway/env` anymore but an user defined  configuration `~/.config/environment.d/wayland.conf`

  parent reply	other threads:[~2021-01-31 16:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 15:31 [ISSUE] " gspe
2021-01-19 15:42 ` ericonr
2021-01-19 16:26 ` gspe
2021-01-19 20:00 ` ericonr
2021-01-19 20:00 ` ericonr
2021-01-19 20:08 ` olafmersmann
2021-01-19 22:15 ` gspe
2021-01-21 18:21 ` kkga
2021-01-21 18:22 ` kkga
2021-01-22 10:33 ` travankor
2021-01-22 10:38 ` travankor
2021-01-31 16:21 ` gspe [this message]
2021-01-31 20:30 ` ericonr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210131162123.w1aflh2jQhBCRQhlGzU2-I30SNOuBwZEKQgYYZiIw2s@z \
    --to=gspe@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).