Skip to content

rs-shell: keep Windows' dialogs on screen without Explorer; rust-explorer: the Open with chooser too (#191) - #192

Open
2sulraw wants to merge 1 commit into
Lemxy:mainfrom
2sulraw:fix/openwith-dialogs-on-screen
Open

2sulraw wants to merge 1 commit into
Lemxy:mainfrom
2sulraw:fix/openwith-dialogs-on-screen

Conversation

@2sulraw

@2sulraw 2sulraw commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #191.

Problem

When WinRust replaces Explorer as the shell, Windows' own dialogs — most visibly the "How do you want to open this file?" chooser shown for an unassociated file or a link with no default app — are created at (0,0) or off the monitor and get clipped. Only the "Just once" button is reachable, so the user can't pick a program (and can't set a default to make the prompt stop).

The chooser is OS-provided; WinRust never draws it. The shell normally positions it, and with Explorer gone that placement is lost.

Fix

1. rs-shell: keep stray dialogs on screen (covers external apps, e.g. a login link from TIDAL).
A WinEvent hook (EVENT_OBJECT_SHOW) is installed whenever Explorer is not the shell — shell mode, and the overlay when it replaces Explorer. When a new top-level window shows, if it sticks out of its monitor it is moved back inside the work area. It is event-driven (no polling), ignores maximized/full-screen windows and anything larger than the screen, and does nothing while Explorer is still the shell.

2. rust-explorer: the chooser from our own file manager.
activate() (double-click / Enter / Space) now reuses the existing keep_on_screen() around its ShellExecuteW, exactly as the context-menu path (sh::show) already does. So a .cfg double-click is handled even if rs-shell's watcher isn't running.

This does not touch file associations — "Always" stays Windows' (UserChoice is OS-guarded; see src/install/tools.rs). The fix only makes the system dialog reachable so the user can choose.

Testing

  • cargo build -p rust-explorer -p rs-shell — clean.
  • cargo test -p rust-explorer -p rs-shell — all pass.
  • cargo test --workspace — all pass except rtaskmgr-win32::gpu::tests::real_adapters_have_memory_directx_location_and_temperature, which fails on a clean main too on this machine (GPU reports an empty location string); unrelated.

Not verified on a live shell-swapped session — built and unit-tested only.

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.

Anything that needs to open a link or another app (browser, login redirects) fails; a clipped "Just once" prompt appears at the top-left

1 participant