1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
From 37b9d2ec9ec9edde5249d46b58fbf6fcc611525f Mon Sep 17 00:00:00 2001
From: luongthanhlam <ltlam93@gmail.com>
Date: Sun, 3 Mar 2024 14:42:40 +0530
Subject: [PATCH 77/77] ibus/common.go: Use WAYLAND_DISPLAY for Ibus socket
path on Wayland
IBus on Wayland doesn't use the $DISPLAY environment variable, rather
uses the $WAYLAND_DISPLAY environment variable to create the socket
file.
Signed-off-by: Aseem Athale <athaleaseem@gmail.com>
---
ibus/common.go | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/ibus/common.go b/ibus/common.go
index b507f00..ac408a5 100644
--- a/ibus/common.go
+++ b/ibus/common.go
@@ -79,20 +79,31 @@ func GetSocketPath() string {
if path != "" {
return path
}
- display := os.Getenv("DISPLAY")
+ display := os.Getenv("WAYLAND_DISPLAY")
+ isWayland := true
+ if display == "" {
+ isWayland = false
+ display = os.Getenv("DISPLAY")
+ }
if display == "" {
fmt.Fprintf(os.Stderr, "DISPLAY is empty! We use default DISPLAY (:0.0)")
display = ":0.0"
}
- // format is {hostname}:{displaynumber}.{screennumber}
hostname := "unix"
- HDS := strings.SplitN(display, ":", 2)
- DS := strings.SplitN(HDS[1], ".", 2)
-
- if HDS[0] != "" {
- hostname = HDS[0]
+ displayNumber := ""
+ if isWayland {
+ displayNumber = display
+ } else {
+ // format is {hostname}:{displaynumber}.{screennumber}
+ HDS := strings.SplitN(display, ":", 2)
+ DS := strings.SplitN(HDS[1], ".", 2)
+
+ if HDS[0] != "" {
+ hostname = HDS[0]
+ }
+ displayNumber = DS[0]
}
- p := fmt.Sprintf("%s-%s-%s", GetLocalMachineId(), hostname, DS[0])
+ p := fmt.Sprintf("%s-%s-%s", GetLocalMachineId(), hostname, displayNumber)
path = GetUserConfigDir() + "/ibus/bus/" + p
return path
--
2.44.0
|