Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Apr 2021 15:29:40 GMT
From:      Adriaan de Groot <adridg@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 7dbd17a38d01 - main - x11/plasma5-plasma-workspace: add helper script for Plasma Wayland
Message-ID:  <202104301529.13UFTeL3019996@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7dbd17a38d01f5f027e16ec8a77565d6822320db

commit 7dbd17a38d01f5f027e16ec8a77565d6822320db
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-04-30 15:06:08 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-04-30 15:29:36 +0000

    x11/plasma5-plasma-workspace: add helper script for Plasma Wayland
    
    There are a handful of environment variables that need to be
    set for a KDE Plasma Wayland session. In addition, it needs a
    ConsoleKit session and its own session DBus. Add a suitable
    shell script that can live alongside the regular executable.
    
    Note that the .desktop file for Plasma does **not** use this
    script -- but then again, SDDM doesn't hand off to Wayland nicely
    either, so you need to start Plasma Wayland from a text console
    anyway. That's simple enough now: `startplasma-wayland.sh`
---
 x11/plasma5-plasma-workspace/Makefile              |  5 +-
 .../files/startplasma-wayland.sh                   | 61 ++++++++++++++++++++++
 x11/plasma5-plasma-workspace/pkg-plist             |  1 +
 3 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/x11/plasma5-plasma-workspace/Makefile b/x11/plasma5-plasma-workspace/Makefile
index 5e1f510cf9c3..fbaacd9b9af0 100644
--- a/x11/plasma5-plasma-workspace/Makefile
+++ b/x11/plasma5-plasma-workspace/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	plasma-workspace
 DISTVERSION=	${KDE_PLASMA_VERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	x11 kde kde-plasma
 
 MAINTAINER=	kde@FreeBSD.org
@@ -51,4 +51,7 @@ CMAKE_OFF=	BUILD_TESTING
 # In 5.15 a file was moved from x11/plasma5-plasma-desktop to x11/plasma5-plasma-workspace:
 CONFLICTS_INSTALL=	plasma5-plasma-desktop-5.14.*
 
+post-stage:
+	${INSTALL_SCRIPT} ${FILESDIR}/startplasma-wayland.sh ${STAGEDIR}/${LOCALBASE}/bin/
+
 .include <bsd.port.mk>
diff --git a/x11/plasma5-plasma-workspace/files/startplasma-wayland.sh b/x11/plasma5-plasma-workspace/files/startplasma-wayland.sh
new file mode 100755
index 000000000000..cfd30dacc18a
--- /dev/null
+++ b/x11/plasma5-plasma-workspace/files/startplasma-wayland.sh
@@ -0,0 +1,61 @@
+#! /bin/sh
+#
+# Try to run a Plasma Wayland session; to be invoked from a text console
+
+### TOOLKIT SETTINGS
+#
+# Tell toolkits to use wayland
+export MOZ_ENABLE_WAYLAND=1
+export GDK_BACKEND=wayland
+export QT_QPA_PLATFORM=wayland-egl
+export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
+
+# Possible settings for drivers
+#
+# Some (older) Intel HD iGPU need this:
+#	export LIBVA_DRIVER_NAME=i965
+
+### XDG SETTINGS
+#
+#
+if test -z "$XDG_RUNTIME_DIR"; then
+	export XDG_RUNTIME_DIR=/tmp/`id -u`-runtime-dir
+	if ! test -d "$XDG_RUNTIME_DIR"; then
+		mkdir "$XDG_RUNTIME_DIR"
+		chmod 0700 "$XDG_RUNTIME_DIR"
+	fi
+fi
+export XDG_SESSION_TYPE=wayland
+
+### KDE / Plasma / Qt settings
+#
+#
+# To switch on software rendering:
+#	export KWIN_COMPOSE=Q
+# To log debug things:
+#	export QT_LOGGING_RULES="kwin_core.debug=true;kwin_libinput.debug=true"
+# To log to a specific file (recommended if you're using the logging rules
+# and want to debug startup problems):
+#	LOGFILE=/tmp/plasma-wayland.log
+
+# TODO: check if ck-launch-session is needed
+scaffolding="ck-launch-session"
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] ; then
+    scaffolding="$scaffolding dbus-run-session"
+fi
+
+startup_dir=`/usr/bin/dirname "$0"`
+startup_exe=`/usr/bin/basename "$0" .sh`
+
+if [ -z "$LOGFILE" ] ; then
+	{
+		echo "Starting KDE Plasma Wayland from PID $$"
+		echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
+		echo "scaffolding=$scaffolding"
+		echo "startup=$startup_dir/$startup_exe"
+	} > $LOGFILE
+
+	exec $scaffolding $startup_dir/$startup_exe 2>&1 | tee -a $LOG
+else
+	exec $scaffolding $startup_dir/$startup_exe
+fi
diff --git a/x11/plasma5-plasma-workspace/pkg-plist b/x11/plasma5-plasma-workspace/pkg-plist
index 176f7123e8de..cffdc489c379 100644
--- a/x11/plasma5-plasma-workspace/pkg-plist
+++ b/x11/plasma5-plasma-workspace/pkg-plist
@@ -16,6 +16,7 @@ bin/plasma_waitforname
 bin/plasmashell
 bin/plasmawindowed
 bin/startplasma-wayland
+bin/startplasma-wayland.sh
 bin/startplasma-x11
 bin/systemmonitor
 bin/xembedsniproxy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104301529.13UFTeL3019996>