Skip to content

Windows: a click outside the open island folds it - #919

Open
saivaibhavv wants to merge 1 commit into
Louis-CFM:mainfrom
saivaibhavv:feat/windows-click-outside
Open

saivaibhavv wants to merge 1 commit into
Louis-CFM:mainfrom
saivaibhavv:feat/windows-click-outside

Conversation

@saivaibhavv

@saivaibhavv saivaibhavv commented Oct 24, 2026 •

Copy link
Copy Markdown

What

On Windows, a left click anywhere outside the open island folds it to the compact bar, as Esc does. A switch in Settings → General → Fold when I click outside turns it off (on by default).

Related: #31 is a smaller take on the same idea (the cursor thread reads the button). This one adds a setting and the safeguards listed below, so the two overlap in island.rs and island.ts; happy to rebase or fold into whichever you prefer.

Why

The island never takes keyboard focus, so there is no "lost focus" to listen for. Today the only ways to fold it are Esc (only when the island has focus), the ⌃ button, or waiting for the auto close timer.

How

  • island.rs: the cursor thread already reads the left button for drag and drop. A small ClickTracker now turns that into two events, press-outside and click-outside, read on every tick before the still-cursor shortcut (most clicks are made without moving the mouse). It is reset on every wake, so a button held while the island was hidden is never a press.
  • island.ts: dismiss() is what Esc did, and both now call it: a waiting permission or question is folded (not answered, the card is still there when reopened), a pinned island stays open.
  • click-outside.ts: the policy, pure so it is tested without a browser.

Cases covered by tests:

  • A press that begins outside and ends inside (a file dragged from Explorer onto the island) never folds.
  • A press that begins inside never folds, wherever it ends.
  • A click right after a hook opened the island by itself (alert(view, { auto: true })) is ignored for 1 second, so the click meant for the window behind it does not close the alert.
  • A pointer on another monitor, with negative coordinates and a different scale, is outside.
  • Nothing drawn yet means no events.

Windows only: Linux cannot see clicks made in other windows, so the row is hidden there (cursorPoll). No extra CPU while the island is hidden, the thread is still parked then.

The label and hint are translated in every language the app has.

Tested

  • npx tsc --noEmit, npm test (477 pass), cargo test --workspace --locked (527 + 30 pass), on current main.
  • Tried by hand in the Windows app (npm run tauri dev): a click outside folds the island, a click inside does not, and the switch in Settings turns it off. No visual change, so no screenshot.

Not in this PR

Click outside on Linux (X11 and Wayland) is left for a separate change.

🤖 Generated with Claude Code

The island never takes keyboard focus, so there is no "lost focus" signal. The
cursor thread already reads the left button for drag and drop; it now also
tells the page when a press began outside the island and when it ended outside
too, and the island folds as Esc does.

- Folds like Esc: a waiting permission or question is folded, not answered, and
  a pinned island stays open.
- A press that began outside and ended inside (a file dragged onto the island)
  never folds. Clicks made with a still cursor count.
- An island a hook opened by itself ignores a click for one second, so the
  click that was meant for the window behind it does not close the alert.
- Settings → General → "Fold when I click outside", on by default, Windows only
  (Linux cannot see clicks in other windows). Translated in all twelve languages.
- No extra CPU while the island is hidden: the thread is still parked then.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@saivaibhavv

Copy link
Copy Markdown
Author

Hi Louis, thanks for Coucou. I've been using the Windows build, and these two PRs are things I wanted on my own PC: #919 folds the open island when you click outside it, and #920 narrows the compact bar (there's no notch on a PC) and reworks the optional clock from #788 to follow the Windows time format.

Both merge cleanly into main and with each other. tsc, npm test and cargo test pass locally. Since this is my first PR, the Windows CI is waiting for a maintainer to approve the workflow run, so could you approve it when you get a moment?

The Windows and Linux app gets a steady flow of PRs, some overlapping, such as #31 with this one. I'd be glad to help look after that side: reviewing and triaging Windows and Linux PRs, keeping Windows CI green, reproducing bugs on Windows 11, and keeping the README and translations in step. If that would help you, triage or write access would let me do it directly. If you'd rather I keep contributing through PRs, that works for me too.

@afpruivo

Copy link
Copy Markdown
Contributor

Tested on Windows 11 (two monitors: 3840x2160 at 150 % and 1440x2560 portrait at 100 %). I built this branch (937ee27) as a debug build: npm test 477 pass.

Test Result
Click outside the open island (desktop, another window) folds ✅
Click inside (empty space and buttons) stays open ✅
Drag a file from Explorer onto the open island doesn't fold, drop works ✅
Click on the other monitor folds ✅
Pinned with Ctrl+P, click outside stays open ✅
Settings → General → Fold when I click outside off, click outside stays open ✅

Works well, thanks! One small thing, not from this PR: once pinned, it wasn't obvious how to unpin. I found that Ctrl+Alt+N closes it. A hint somewhere (for example in that README row) could help.

This branch has not been deployed

No deployments
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.

2 participants