Repository navigation
feat(windows): option to open each document in its own window - #57
Merged
Merged
Conversation
QuickMD forces every document into the frontmost window as a tab (WindowTabbing.preferTabsAlways + a manual merge), so two documents can never be read side by side. Settings ▸ General ▸ Windows ▸ "Open each document in its own window" turns that off: each document then gets its own window. How it works: - At launch, the tabbing preference is written to the argument domain as "manual" instead of "always", and NSWindow.allowsAutomaticWindowTabbing is set to false. The preference is what AppKit reads when it shows a window, and AppKit caches it for the whole process, so it can only be chosen at launch. - While the app runs, the two levers that do work at runtime are used: NSWindow.allowsAutomaticWindowTabbing (global) and NSWindow.tabbingMode (per window). The manual merge that joins a new window to an existing tab group is skipped in separate-windows mode. Documents already open keep the tab group they are in — AppKit gives an app no way to take a tab group apart — but every document opened from then on honours the new mode.
Merged
Owner
|
Thank you, this is in 1.15.0: Settings > General > "Open documents in separate windows", off by default. Changes on top of your branch:
You are credited in the changelog. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Settings ▸ General ▸ Windows ▸ "Open each document in its own window".
QuickMD deliberately puts every document in the frontmost window as a tab
(
WindowTabbing.preferTabsAlways()plus the manual merge injoinExistingTabs), so two documents can never be read side by side. Withthe new option on, each document gets its own window instead.
Off by default — the tab behaviour is unchanged.
Why
Reading two documents at once (a spec and the code that implements it, two
related notes) is a normal thing to want, and the tab layout makes it
impossible without a second app instance.
How
Three AppKit levers, with different lifetimes — the distinction is the
whole difficulty here:
NSWindow.userTabbingPreference(AppleWindowTabbingModein the argument domain)NSWindow.allowsAutomaticWindowTabbingNSWindow.tabbingMode"manual"instead of"always",and
allowsAutomaticWindowTabbingis set tofalse. The preference hasto be chosen here: AppKit reads
userTabbingPreferenceonce per processand caches it, so rewriting the defaults domain later has no effect.
allowsAutomaticWindowTabbing(global) andtabbingMode(per window).skipped in separate-windows mode.
Note for the record: the raw value for "never tab" is
"manual", not"never"—"never"is an old alias for"inFullScreen".Limitation
Documents that are already open keep the tab group they are in. AppKit
gives an app no way to take a tab group apart (
addTabbedWindow(_:ordered:)is public,
removeTabbedWindowis not), so the option applies to documentsopened from the moment it is switched on. At launch it applies to
everything.
Tests
WindowTabbingTestscovers the preference values written to the argumentdomain,
allowsAutomaticWindowTabbingin both modes, the per-window mode,that the manual merge is skipped, and that switching the option back and
forth restores the previous behaviour.
Checked by hand as well: with the option on, every document is its own
window (
window.tabbedWindowsisnilfor each); with it off, they alljoin one tab group.