summarylogtreecommitdiffstats
path: root/disable-xterm-webgl.patch
blob: 996adf3b8a6d6df701ac80386972e895c8724ff1 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
diff -ruN termul-0.3.4.orig/src/renderer/components/terminal/ConnectedTerminal.tsx termul-0.3.4/src/renderer/components/terminal/ConnectedTerminal.tsx
--- termul-0.3.4.orig/src/renderer/components/terminal/ConnectedTerminal.tsx	2026-05-02 15:49:57.750116475 +0700
+++ termul-0.3.4/src/renderer/components/terminal/ConnectedTerminal.tsx	2026-05-02 15:50:11.844459082 +0700
@@ -50,6 +50,7 @@
 const VISIBILITY_RECOVERY_DELAY_MS = 150; // DOM reflow after tab becomes visible
 const POWER_RESUME_RECOVERY_DELAY_MS = 300; // System stabilize after wake
 const ACTIVITY_DEBOUNCE_MS = 1000; // Debounce activity updates to max 1 per second
+const XTERM_WEBGL_DISABLED = true; // Avoid intermittent WebKitGTK/NVIDIA Wayland input stalls
 const CLIPBOARD_RATE_LIMIT_MS = 100; // Minimum ms between clipboard operations
 
 export interface TerminalSearchHandle {
@@ -457,6 +458,11 @@
 			term: Terminal,
 			isRecovery: boolean = false,
 		): void => {
+			if (XTERM_WEBGL_DISABLED) {
+				webglAddonRef.current = null;
+				return;
+			}
+
 			if (webglRecoveryAttemptsRef.current >= MAX_WEBGL_RECOVERY_ATTEMPTS) {
 				console.warn(
 					"WebGL recovery attempts exhausted, falling back to canvas renderer",
diff -ruN termul-0.3.4.orig/src/renderer/components/terminal/TauriTerminal.tsx termul-0.3.4/src/renderer/components/terminal/TauriTerminal.tsx
--- termul-0.3.4.orig/src/renderer/components/terminal/TauriTerminal.tsx	2026-05-02 15:49:57.750116475 +0700
+++ termul-0.3.4/src/renderer/components/terminal/TauriTerminal.tsx	2026-05-02 15:50:17.339369259 +0700
@@ -13,6 +13,7 @@
 import "@xterm/xterm/css/xterm.css";
 
 const MAX_WEBGL_RETRIES = 3;
+const XTERM_WEBGL_DISABLED = true; // Avoid intermittent WebKitGTK/NVIDIA Wayland input stalls
 
 type TerminalStatus = "loading" | "ready" | "exited" | "error";
 
@@ -56,6 +57,10 @@
 			// WebGL addon with fallback
 			let webglAttempts = 0;
 			const loadWebgl = (): void => {
+				if (XTERM_WEBGL_DISABLED) {
+					webglAddonRef.current = null;
+					return;
+				}
 				if (disposedRef.current || webglAttempts >= MAX_WEBGL_RETRIES) {
 					if (webglAttempts >= MAX_WEBGL_RETRIES) {
 						console.warn(
diff -ruN termul-0.3.4.orig/src/renderer/components/terminal/XTerminal.tsx termul-0.3.4/src/renderer/components/terminal/XTerminal.tsx
--- termul-0.3.4.orig/src/renderer/components/terminal/XTerminal.tsx	2026-05-02 15:49:57.750116475 +0700
+++ termul-0.3.4/src/renderer/components/terminal/XTerminal.tsx	2026-05-02 15:50:27.977195334 +0700
@@ -19,6 +19,8 @@
 	convertEol: true,
 };
 
+const XTERM_WEBGL_DISABLED = true; // Avoid intermittent WebKitGTK/NVIDIA Wayland input stalls
+
 function XTerminalComponent({
 	onData,
 	onResize,
@@ -45,16 +47,18 @@
 
 		terminal.open(containerRef.current);
 
-		try {
-			const webglAddon = new WebglAddon();
-			webglAddon.onContextLoss(() => {
-				webglAddon.dispose();
-			});
-			terminal.loadAddon(webglAddon);
-		} catch {
-			console.warn(
-				"WebGL addon failed to load, falling back to canvas renderer",
-			);
+		if (!XTERM_WEBGL_DISABLED) {
+			try {
+				const webglAddon = new WebglAddon();
+				webglAddon.onContextLoss(() => {
+					webglAddon.dispose();
+				});
+				terminal.loadAddon(webglAddon);
+			} catch {
+				console.warn(
+					"WebGL addon failed to load, falling back to canvas renderer",
+				);
+			}
 		}
 
 		fitAddon.fit();
diff -ruN termul-0.3.4.orig/src/renderer/hooks/use-xterm.ts termul-0.3.4/src/renderer/hooks/use-xterm.ts
--- termul-0.3.4.orig/src/renderer/hooks/use-xterm.ts	2026-05-02 15:49:57.756689327 +0700
+++ termul-0.3.4/src/renderer/hooks/use-xterm.ts	2026-05-02 15:50:40.957983060 +0700
@@ -5,6 +5,8 @@
 import { WebLinksAddon } from '@xterm/addon-web-links'
 import { TERMINAL_THEME } from '../components/terminal/terminal-config'
 
+const XTERM_WEBGL_DISABLED = true // Avoid intermittent WebKitGTK/NVIDIA Wayland input stalls
+
 export interface UseXtermOptions {
   onData?: (data: string) => void
   onResize?: (cols: number, rows: number) => void
@@ -109,14 +111,16 @@
 
     terminal.open(containerRef.current)
 
-    try {
-      const webglAddon = new WebglAddon()
-      webglAddon.onContextLoss(() => {
-        webglAddon.dispose()
-      })
-      terminal.loadAddon(webglAddon)
-    } catch {
-      console.warn('WebGL addon failed to load, falling back to canvas renderer')
+    if (!XTERM_WEBGL_DISABLED) {
+      try {
+        const webglAddon = new WebglAddon()
+        webglAddon.onContextLoss(() => {
+          webglAddon.dispose()
+        })
+        terminal.loadAddon(webglAddon)
+      } catch {
+        console.warn('WebGL addon failed to load, falling back to canvas renderer')
+      }
     }
 
     fitAddon.fit()