Skip to content

fix(linux): frameless window resize + scrollbar edge detection#5493

Open
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:agent/engineer-linux/65b2bc1a
Open

fix(linux): frameless window resize + scrollbar edge detection#5493
taliesin-ai wants to merge 1 commit into
wailsapp:masterfrom
taliesin-ai:agent/engineer-linux/65b2bc1a

Conversation

@taliesin-ai
Copy link
Copy Markdown
Collaborator

@taliesin-ai taliesin-ai commented May 22, 2026

Problem

On Linux frameless windows, the JS runtime never received the frameless or resizable flags, so the resize-edge cursor logic in drag.ts never activated. Additionally, the existing border detection used window.outerWidth/outerHeight which does not account for a scrollbar occupying the rightmost/bottommost strip — making it impossible to hit the resize zone when a scrollbar was present.

Changes

drag.ts

  • Import IsLinux from system.js
  • Gate resize-edge logic on !IsWindows() && !(IsLinux() && frameless) → frameless Linux windows now enter the resize path
  • Replace outerWidth/outerHeight border math with innerWidth - scrollbarWidth / innerHeight - scrollbarHeight (scrollbar width derived from window.innerWidth - document.documentElement.clientWidth)

linux_cgo.go (GTK3) / linux_cgo_gtk4.go (GTK4)

  • setResizable: call window._wails.setResizable(bool) after the GTK call so runtime state stays in sync when resizability is toggled at runtime
  • setFrameless: call window._wails.flags.frameless = bool after gtk_window_set_decorated

webview_window_linux.go

  • In the WindowLoadFinished hook, inject flags.frameless and setResizable(bool) alongside the existing enableFileDrop flag so every fresh page load gets correct state

Notes

Closes #5368

CC @leaanthony

Summary by CodeRabbit

  • Bug Fixes
    • Improved window resize-edge detection to account for scrollbar presence on desktop windows.
    • Extended window resizing support to Linux platforms (previously Windows-only).
    • Fixed frameless and resizable window state synchronization between frontend and backend on Linux.

Review Change Stack

- Enable JS-side resize handling for Linux frameless windows by syncing
  the frameless and resizable flags into the runtime on page load and
  whenever setFrameless/setResizable are called at runtime.
- Fix border detection in drag.ts to use innerWidth/innerHeight minus
  the scrollbar width (from documentElement.clientWidth diff) rather
  than outerWidth/outerHeight, so the resize hit zone doesn't overlap
  the scrollbar strip.
- Import IsLinux in drag.ts; gate the resize-edge logic on
  IsLinux() && frameless (mirrors the existing Windows-only gate).

Rebuilding the compiled runtime bundles (runtime.js / runtime.debug.js)
requires running `task runtime:build` in v3/internal/runtime/desktop/@wailsio/runtime.

Supersedes PR wailsapp#5368 (rebased, typo-fixed, addressed CodeRabbit review).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6706b7c5-8172-4281-babc-deed052a3708

📥 Commits

Reviewing files that changed from the base of the PR and between 6825d76 and b4f611a.

📒 Files selected for processing (4)
  • v3/internal/runtime/desktop/@wailsio/runtime/src/drag.ts
  • v3/pkg/application/linux_cgo.go
  • v3/pkg/application/linux_cgo_gtk4.go
  • v3/pkg/application/webview_window_linux.go

Walkthrough

This PR fixes frameless window resizing on Linux and scrollbar-related resize edge detection on all platforms. Frontend resize logic now enables Linux frameless windows and compensates for scrollbar width in edge detection. Native bindings synchronize resizable and frameless state changes to the frontend via JavaScript, and startup initialization ensures correct initial state.

Changes

Linux frameless window resize and scrollbar edge detection

Layer / File(s) Summary
Frontend resize logic: platform support and scrollbar-aware edge detection
v3/internal/runtime/desktop/@wailsio/runtime/src/drag.ts
Resize enablement now includes IsLinux() && GetFlag("frameless") to allow Linux frameless windows to enter resize detection. Edge detection subtracts scrollbar width/height (from innerWidth - clientWidth / innerHeight - clientHeight) so the 5 px resize zone sits before the scrollbar strip, preventing overlap with native scrollbar capture and cursor override.
Native-to-frontend synchronization: GTK3 and GTK4 bindings
v3/pkg/application/linux_cgo.go, v3/pkg/application/linux_cgo_gtk4.go
Both GTK3 and GTK4 setResizable methods now call window._wails.setResizable(resizable) when available, and setFrameless methods update window._wails.flags.frameless, keeping frontend state synchronized with native window property changes.
Runtime initialization: bootstrap frameless and resizable state
v3/pkg/application/webview_window_linux.go
The WindowLoadFinished hook initializes the frontend by injecting JavaScript to set window._wails.flags.frameless and invoke window._wails.setResizable based on DisableResize, ensuring correct state on first load.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • wailsapp/wails#5159: Enables native edge resize handling via linuxWebviewWindow.startResize to receive the wails:resize:<edge> events now dispatched from the updated drag.ts on Linux frameless windows.
  • wailsapp/wails#5340: Also modifies the WindowLoadFinished hook in webview_window_linux.go for startup initialization, overlapping at the same injection point.

Suggested labels

Bug, Linux, runtime, v3, size:M

Suggested reviewers

  • leaanthony

Poem

🐰 A rabbit's tale of windows wide,
Where scrollbars dared resize to hide,
Now frameless panes on Linux freely grow,
With edges sharp and frameless flow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main changes: fixing frameless window resize on Linux and addressing scrollbar edge detection issues.
Description check ✅ Passed The PR description comprehensively covers the problem statement, detailed changes across all affected files, implementation notes, and testing context, exceeding template requirements.
Linked Issues check ✅ Passed All coding objectives from issue #5368 are met: frameless Linux resize enabled via guard logic adjustment, scrollbar edge detection fixed using innerWidth/clientWidth arithmetic, runtime state synchronization implemented via JS calls, and frontend initialization added on page load.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue objectives: drag.ts guard/border logic, platform-specific setResizable/setFrameless JS calls, and page-load initialization. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch agent/engineer-linux/65b2bc1a

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@taliesin-ai
Copy link
Copy Markdown
Collaborator Author

Status update on the recurring FOSSA errors:

A separate PR is being opened to fix the root cause — v3/examples npm targets are being scanned by FOSSA even though they are demo tooling, not distributed artifacts. Adding them to .fossa.yml's exclude list (same treatment as website/) will stop the recurring "License Compliance: ERROR / 3 issues found" status on all PRs.

This PR (#5493) itself has no new dependencies and no FOSSA-flagged packages in its changes.

This PR is ready for review. It is rebased and applies cleanly against current master (dc3f12046). If GitHub shows "out of date with base branch", clicking Update branch is safe — the only new master commit is feat(wake): Phase 4 which touches v3/internal/wake/, with no overlap with this PR's files.

CC @leaanthony


Taliesin is an AI agent. CC @leaanthony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant