Skip to content

Fix widget jumping between monitors (#43) + monitor chooser - #48

Closed
androosio wants to merge 3 commits into
CodeZeno:mainfrom
androosio:multimonitor-fixes
Closed

Fix widget jumping between monitors (#43) + monitor chooser#48
androosio wants to merge 3 commits into
CodeZeno:mainfrom
androosio:multimonitor-fixes

Conversation

@androosio

Copy link
Copy Markdown

Summary

Fixes the widget randomly jumping to the wrong monitor on multi-monitor setups (#43), and adds a way to pick the monitor explicitly.

Fix widget jumping between monitors (#43)

The widget remembered its taskbar by a positional index into a geometry-sorted list. That order is unstable across explorer restarts and display changes, so the index would resolve to the wrong monitor (often a vertical secondary screen) and then get re-saved.

Now the target taskbar is identified by the monitor's stable device name:

  • native_interop exposes each taskbar's monitor device name and primary-monitor flag (MonitorFromWindow / GetMonitorInfoW).
  • resolve_taskbar_index prefers the remembered monitor, then the primary monitor's taskbar, and only then a positional index — so it no longer defaults to whichever taskbar happens to sort first.
  • attach_to_taskbar briefly waits for the remembered monitor's taskbar to come up after an explorer restart instead of falling back immediately.
  • Drag-to-another-taskbar records the dropped monitor; Reset position clears the remembered monitor and re-attaches to the primary as an escape hatch.
  • taskbar_monitor is persisted in settings.json; old settings without it stay backward compatible.

Monitor chooser

On multi-monitor setups, Settings → Monitor lists each detected taskbar (the primary one is marked) so you can pick which monitor the widget lives on. New menu strings are localized across all 10 languages.

Also adds CLAUDE.md.

Testing

  • cargo check / clippy pass for the Windows target.
  • Manually verified on a dual-monitor (ultrawide + vertical) setup: the widget stays on the chosen monitor across explorer restarts, and the Monitor / Reset position controls behave as expected.

🤖 Generated with Claude Code

androosio and others added 3 commits June 27, 2026 01:08
On multi-monitor setups the widget remembered its taskbar by a positional
index into a geometry-sorted list. That order is unstable across explorer
restarts and display changes, so the index would resolve to the wrong
monitor (often a vertical secondary screen) and get re-saved.

Identify the target taskbar by the monitor's stable device name instead:
- native_interop exposes each taskbar's monitor device name and primary flag.
- resolve_taskbar_index prefers the remembered monitor, then the primary
  monitor's taskbar, and only then a positional index.
- attach_to_taskbar briefly waits for the remembered monitor's taskbar to
  appear after an explorer restart instead of falling back immediately.
- drag-to-another-taskbar records the dropped monitor; Reset position clears
  the remembered monitor and re-attaches to the primary.
- taskbar_monitor is persisted in settings.json (backward compatible).

Also adds CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On multi-monitor setups, Settings now has a Monitor submenu listing each
detected taskbar (with the primary one marked). Picking one re-attaches the
widget to that monitor's taskbar and remembers it. New menu strings are
localized across all 10 languages.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Opening the Start menu/search makes the taskbar briefly drop out of
EnumWindows (~5s) even though its HWND is still valid. The watchdog read
that as an explorer restart and relaunched the process, wiping the widget.

Guard the watchdog with IsWindow on the stored taskbar handle: if it still
exists, treat it as a transient enumeration blip and skip. Only relaunch
when the handle is truly gone for TASKBAR_MISSING_TICKS consecutive checks.

Fix originally by André Escocard (andreescocard) in CodeZeno PR CodeZeno#47.

Co-Authored-By: André Escocard <andreescocard@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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