Repository navigation
Add a Display Mode picker for choosing which screens are on - #1955
Open
zolferfigueiredo wants to merge 6 commits into
Open
zolferfigueiredo wants to merge 6 commits into
zolferfigueiredo wants to merge 6 commits into
Conversation
A Win+P-style shortcut, in Settings > Shortcuts > ⋯ > Extra. The row shows when more than one screen is connected or a shortcut is set. The shortcut opens a list of every combination of screens (Screen 1 Only, Screens 1 + 2, ...) plus Mirror All Screens, and shows each screen's number in the middle of that screen. Pressing it again while holding the modifiers moves the highlight; letting go applies it. A single press leaves the list open for the arrow keys, Return or a click. Mirroring uses the public CoreGraphics API. Turning a screen off uses the private CGSConfigureDisplayEnabled call, looked up at runtime: when it's missing, only all screens and mirroring are offered. Screens turned off come back when Rectangle quits, or when every screen still on is disconnected. Also available as rectangle://execute-action?name=display-mode.
zolferfigueiredo
marked this pull request as draft
November 5, 2026 16:37
Five or more screens give 32+ rows, which grew the list past the bottom of the screen. The list now stops at the room below the screen's number (at least 5 rows) and scrolls, and the highlighted row is scrolled into view as the shortcut or the arrow keys move it. DisplayModePanel is no longer file-private, so a test can open a 32-row list and check it fits on the screen and scrolls to the last row.
The list was built while the scroll view still kept room for a classic scroll bar, so its rows came out about 15 pt narrower than the list and left an empty strip on the right, even with 3 screens where nothing scrolls. The scroller is now only turned on when the list is cut off, and the rows take their width after the scroll view has laid out.
The 5 Display Mode strings stay translated in English, Spanish (es) and Brazilian Portuguese (pt-BR), which have been checked. The other 9 languages are marked needs_review until a native speaker checks them. Only the state changes; the app keeps showing every translation.
They match the checked Spanish (es) strings word for word.
zolferfigueiredo
marked this pull request as ready for review
November 5, 2026 17:03
Modalità schermo, Duplica tutti gli schermi, Solo schermo %lld, Schermi %@ and Schermo %lld, worded like the existing Italian (schermo for display), and marked translated.
Owner
|
Thanks for continuing to contribute! I'm currently cleaning up some of the commonly tread paths in Rectangle, and I'll let you know when I'm done so the conflicts can be resolved all at once instead of continuously. At that time, I'll be working through my backlog of pull requests to review. |
Contributor
Author
|
Amazing! Take your time. Let me know when I should fix the conflicts; |
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
A Display Mode shortcut that works like Win+P on Windows: choose from the keyboard which screens are on, or mirror them.
displayModeTemplatein the style of the other action icons (two screens in a frame).rectangle://execute-action?name=display-mode.README.mdandREADME.zh-Hans.md, anddisplay-modein the URL action list.Screenshot
How it works
CGSConfigureDisplayEnabled(falling back toSLSConfigureDisplayEnabled), looked up at runtime withdlsym, so nothing links against it. When neither exists, the list offers only every screen on plus Mirror All Screens.forAppOnly), so quitting Rectangle turns it back on. If every screen still on is disconnected, the screens Rectangle turned off come back on.Rectangle/DisplayMode.swift. Elsewhere the change is the new action, one early return inShortcutManager.execute, and the conditional row in the Extra section. The picker reusesStackBadgeManager.navigationKeyandScreenDetection.order.Translations
The 5 new strings are translated into 12 languages: de, es, es-419, fa, fr, hi, it, ja, pt-BR, uk, zh-Hans and zh-Hant. English, Spanish (
es,es-419), Brazilian Portuguese (pt-BR) and Italian (it) have been checked and are marked translated. The others are markedneeds_reviewin the catalog until a native speaker checks them; corrections are welcome.Tests
xcodebuild test: all 730 tests pass, including newDisplayModeTestsfor the option order, the per-screen configuration, a 32-row list (5 screens) that stays on screen and scrolls to its last row, and a list that fits with no room kept for a scroll bar.Known limits