Add F5 shortcut key for Reload - #1922
Conversation
Agent-Logs-Url: https://github.com/QL-Win/QuickLook/sessions/aa25454c-4765-4d7c-8a9e-0dfc21750caf Co-authored-by: emako <24737061+emako@users.noreply.github.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideImplements an F5 keyboard shortcut to reload the preview by introducing a new pipe message, wiring it through the pipe server and keystroke dispatcher, and exposing the shortcut text in the Viewer UI menu. Sequence diagram for F5 reload preview workflowsequenceDiagram
actor User
participant KeystrokeDispatcher
participant PipeServerManager
participant ViewWindowManager
User->>KeystrokeDispatcher: keydown F5
KeystrokeDispatcher->>KeystrokeDispatcher: Validate key in _validKeys
KeystrokeDispatcher->>PipeServerManager: SendMessage(PipeMessages.Reload)
PipeServerManager->>PipeServerManager: MessageReceived(PipeMessages.Reload)
PipeServerManager->>ViewWindowManager: GetInstance().ReloadPreview() via Dispatcher
ViewWindowManager-->>User: Preview content reloaded
Class diagram for new F5 reload integrationclassDiagram
class PipeMessages {
<<static>>
+string Close
+string Quit
+string Fullscreen
+string Reload
}
class PipeServerManager {
+bool MessageReceived(string msg)
+void Dispose()
+static void SendMessage(string msg)
}
class KeystrokeDispatcher {
-Keys[] _validKeys
+void InvokeRoutine(Keys key, bool isKeyDown)
+void Register()
+void Unregister()
}
class ViewWindowManager {
+static ViewWindowManager GetInstance()
+void ReloadPreview()
}
PipeServerManager ..|> System_IDisposable
KeystrokeDispatcher --> PipeServerManager : uses
PipeServerManager --> PipeMessages : uses
PipeServerManager --> ViewWindowManager : calls
class System_IDisposable {
<<interface>>
+void Dispose()
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
Adds an F5 keyboard shortcut to reload the currently open preview, making “Reload” accessible without using the UI menu.
Changes:
- Added a new
PipeMessages.Reloadmessage and dispatched it toViewWindowManager.ReloadPreview(). - Updated global keystroke handling to treat
F5as a valid key and send the reload pipe message on keydown. - Updated the Viewer “More” context menu to display
F5as the Reload shortcut (InputGestureText).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| QuickLook/ViewerWindow.xaml | Displays the Reload shortcut in the More menu for discoverability. |
| QuickLook/PipeServerManager.cs | Defines and dispatches a new Reload pipe message to trigger preview reload on the UI thread. |
| QuickLook/KeystrokeDispatcher.cs | Sends the Reload pipe message when F5 is pressed (global hook), consistent with existing F11 handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return false; | ||
|
|
||
| case PipeMessages.Reload: | ||
| Application.Current.Dispatcher.BeginInvoke( |
There was a problem hiding this comment.
PipeServerManager uses _lastOperation to cancel pending dispatcher work for actions that can be triggered repeatedly (e.g., Invoke/Switch/Toggle). The new Reload handler schedules a dispatcher operation but does not assign it to _lastOperation, so repeated F5 presses can enqueue multiple reloads without cancellation, potentially causing unnecessary plugin reloads and UI churn. Consider assigning the BeginInvoke result to _lastOperation here (consistent with the other preview-changing cases) so subsequent pipe messages can abort a pending reload.
| Application.Current.Dispatcher.BeginInvoke( | |
| _lastOperation = Application.Current.Dispatcher.BeginInvoke( |
Previewing files that change on disk (e.g. Markdown) required closing and reopening the preview or clicking "Reload" from the More menu — no keyboard shortcut existed.
Changes
PipeServerManager.cs: AddedPipeMessages.Reloadconstant; wired it toViewWindowManager.ReloadPreview()in the message dispatcherKeystrokeDispatcher.cs: AddedKeys.F5to the valid keys set; sendsPipeMessages.Reloadon keydown — consistent with F11 (fullscreen) handlingViewerWindow.xaml: AddedInputGestureText="F5"to the Reload menu item so the shortcut is discoverable via the More menuSummary by Sourcery
Add support for reloading the current preview via an F5 keyboard shortcut and corresponding pipe message.
New Features: