Skip to content

Commit 984b4e5

Browse files
mswiszczclaude
andauthored
fix: Mouse Back/Forward support in webviews + few bugfixes (#3141)
- Add Mouse-3/Mouse-4 (back/forward) navigation support in webviews - Add COLORTERM=truecolor env variable for terminal sessions - Fix AI button width calculation when button is hidden - Fix setSizeAndPosition animation on tab layout updates - Increase DevInitTimeout for slower startup scenarios - Update .gitignore and package-lock.json --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c99bd48 commit 984b4e5

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ test-results.xml
3939
docsite/
4040

4141
.kilo-format-temp-*
42+
.superpowers
43+
docs/superpowers
44+
.claude

emain/emain-ipc.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ export function initIpcHandlers() {
236236
menu.popup();
237237
});
238238

239+
electron.ipcMain.on("webview-mouse-navigate", (event: electron.IpcMainEvent, direction: string) => {
240+
if (direction === "back") {
241+
event.sender.navigationHistory.goBack();
242+
} else if (direction === "forward") {
243+
event.sender.navigationHistory.goForward();
244+
}
245+
});
246+
239247
electron.ipcMain.on("download", (event, payload) => {
240248
const baseName = encodeURIComponent(path.basename(payload.filePath));
241249
const streamingUrl =

emain/preload-webview.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,15 @@ document.addEventListener("contextmenu", (event) => {
2525
// do nothing
2626
});
2727

28+
document.addEventListener("mouseup", (event) => {
29+
// Mouse button 3 = back, button 4 = forward
30+
if (!event.isTrusted) {
31+
return;
32+
}
33+
if (event.button === 3 || event.button === 4) {
34+
event.preventDefault();
35+
ipcRenderer.send("webview-mouse-navigate", event.button === 3 ? "back" : "forward");
36+
}
37+
});
38+
2839
console.log("loaded wave preload-webview.ts");

frontend/app/tab/tabbar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ const TabBar = memo(({ workspace, noTabs }: TabBarProps) => {
189189
const addBtnWidth = getOuterWidth(addBtnRef.current);
190190
const appMenuButtonWidth = appMenuButtonRef.current?.getBoundingClientRect().width ?? 0;
191191
const workspaceSwitcherWidth = workspaceSwitcherRef.current?.getBoundingClientRect().width ?? 0;
192-
const waveAIButtonWidth = waveAIButtonRef.current != null ? getOuterWidth(waveAIButtonRef.current) : 0;
192+
const waveAIButtonWidth =
193+
!hideAiButton && waveAIButtonRef.current != null ? getOuterWidth(waveAIButtonRef.current) : 0;
193194

194195
const nonTabElementsWidth =
195196
windowDragLeftWidth +
@@ -276,7 +277,7 @@ const TabBar = memo(({ workspace, noTabs }: TabBarProps) => {
276277
// Check if all tabs are loaded
277278
const allLoaded = tabIds.length > 0 && tabIds.every((id) => tabsLoaded[id]);
278279
if (allLoaded) {
279-
setSizeAndPosition(newTabId === null && prevAllLoadedRef.current);
280+
setSizeAndPosition(false);
280281
saveTabsPosition();
281282
if (!prevAllLoadedRef.current) {
282283
prevAllLoadedRef.current = true;

pkg/util/shellutil/shellutil.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ func WaveshellLocalEnvVars(termType string) map[string]string {
222222
}
223223
// these are not necessary since they should be set with the swap token, but no harm in setting them here
224224
rtn["TERM_PROGRAM"] = "waveterm"
225+
if os.Getenv("COLORTERM") == "" {
226+
rtn["COLORTERM"] = "truecolor"
227+
}
225228
rtn["WAVETERM"], _ = os.Executable()
226229
rtn["WAVETERM_VERSION"] = wavebase.WaveVersion
227230
rtn["WAVETERM_WSHBINDIR"] = filepath.Join(wavebase.GetWaveDataDir(), WaveHomeBinDir)

0 commit comments

Comments
 (0)