Skip to content

Commit b2da444

Browse files
committed
#413 link xwayland socket properly for X11 apps ubuntu
1 parent 9079135 commit b2da444

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

root/defaults/startwm_wayland.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@ export QT_QPA_PLATFORM=wayland
8888
export XDG_CURRENT_DESKTOP=KDE
8989
export XDG_SESSION_TYPE=wayland
9090
export KDE_SESSION_VERSION=6
91-
unset DISPLAY
91+
export DISPLAY=:1
92+
sudo mkdir -p /tmp/.X11-unix
93+
sudo chmod 1777 /tmp/.X11-unix
9294
dbus-run-session bash -c '
93-
WAYLAND_DISPLAY=wayland-1 kwin_wayland --no-lockscreen &
95+
WAYLAND_DISPLAY=wayland-1 python3 /kwin-xwayland.py &
9496
KWIN_PID=$!
9597
sleep 2
9698
if [ -f /usr/lib/libexec/polkit-kde-authentication-agent-1 ]; then
9799
/usr/lib/libexec/polkit-kde-authentication-agent-1 &
98100
elif [ -f /usr/libexec/polkit-kde-authentication-agent-1 ]; then
99-
/usr/libexec/polkit-kde-authentication-agent-1
101+
/usr/libexec/polkit-kde-authentication-agent-1 &
100102
fi
101103
WAYLAND_DISPLAY=wayland-0 plasmashell
102104
kill $KWIN_PID

root/kwin-xwayland.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python3
2+
import socket
3+
import os
4+
5+
display_env = os.environ.get("DISPLAY", ":1")
6+
display_num = display_env.lstrip(":")
7+
path = f"/tmp/.X11-unix/X{display_num}"
8+
9+
if os.path.exists(path):
10+
os.remove(path)
11+
12+
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
13+
s.bind(path)
14+
s.listen(128)
15+
16+
fd = s.fileno()
17+
os.set_inheritable(fd, True)
18+
19+
os.execlp(
20+
"kwin_wayland",
21+
"kwin_wayland",
22+
"--no-lockscreen",
23+
"--xwayland",
24+
f"--xwayland-display=:{display_num}",
25+
f"--xwayland-fd={fd}"
26+
)

0 commit comments

Comments
 (0)