mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-05-15 22:01:08 -06:00
Better handling of mirrors - non primary mirror members (displays which are destination screens of a mirrored screen) are now detected and can be controlled. Not tested on Intel but should work.
This commit is contained in:
parent
048ac9610d
commit
db015509d6
12 changed files with 85 additions and 12 deletions
|
|
@ -89,18 +89,37 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
func updateDisplays() {
|
||||
self.clearDisplays()
|
||||
|
||||
for screen in NSScreen.screens {
|
||||
let name: String
|
||||
if #available(OSX 10.15, *) {
|
||||
name = screen.localizedName
|
||||
} else {
|
||||
name = screen.displayName ?? NSLocalizedString("Unknown", comment: "Unknown display name")
|
||||
var onlineDisplayIDs = [CGDirectDisplayID](repeating: 0, count: 10)
|
||||
var displayCount: UInt32 = 0
|
||||
|
||||
guard CGGetOnlineDisplayList(10, &onlineDisplayIDs, &displayCount) == .success else {
|
||||
os_log("Unable to get display list.", type: .info)
|
||||
return
|
||||
}
|
||||
|
||||
for onlineDisplayID in onlineDisplayIDs where onlineDisplayID != 0 {
|
||||
var name: String = NSLocalizedString("Unknown", comment: "Unknown display name") + String(CGDisplaySerialNumber(onlineDisplayID))
|
||||
if let screen = NSScreen.getByDisplayID(displayID: onlineDisplayID) {
|
||||
if #available(OSX 10.15, *) {
|
||||
name = screen.localizedName
|
||||
} else {
|
||||
name = screen.displayName ?? name
|
||||
}
|
||||
} else if CGDisplayIsInHWMirrorSet(onlineDisplayID) != 0 || CGDisplayIsInMirrorSet(onlineDisplayID) != 0 {
|
||||
if let mirroredScreen = NSScreen.getByDisplayID(displayID: CGDisplayMirrorsDisplay(onlineDisplayID)) {
|
||||
name = NSLocalizedString("Mirror of", comment: "Shown in case a display mirrors an other display - like 'Mirror of DisplayName")
|
||||
if #available(OSX 10.15, *) {
|
||||
name = "" + name + " " + String(mirroredScreen.localizedName)
|
||||
} else {
|
||||
name = "" + name + " " + String(mirroredScreen.displayName ?? NSLocalizedString("Unknown", comment: "Unknown display name"))
|
||||
}
|
||||
}
|
||||
}
|
||||
let id = screen.displayID
|
||||
let vendorNumber = screen.vendorNumber
|
||||
let modelNumber = screen.modelNumber
|
||||
let id = onlineDisplayID
|
||||
let vendorNumber = CGDisplayVendorNumber(onlineDisplayID)
|
||||
let modelNumber = CGDisplayVendorNumber(onlineDisplayID)
|
||||
let display: Display
|
||||
if screen.isBuiltin {
|
||||
if CGDisplayIsBuiltin(onlineDisplayID) != 0 {
|
||||
display = InternalDisplay(id, name: name, vendorNumber: vendorNumber, modelNumber: modelNumber)
|
||||
} else {
|
||||
display = ExternalDisplay(id, name: name, vendorNumber: vendorNumber, modelNumber: modelNumber)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1065</string>
|
||||
<string>1097</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Tasten";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Keys";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Touches";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Tasti";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "キー";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Klawisze";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "Nie";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Сочетания клавиш";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "Клавіші";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
/* Shown in the main prefs window */
|
||||
"Keys" = "快捷键";
|
||||
|
||||
/* Shown in case a display mirrors an other display - like 'Mirror of DisplayName */
|
||||
"Mirror of" = "Mirror of";
|
||||
|
||||
/* Mirrors */
|
||||
"Mirrors" = "Mirrors";
|
||||
|
||||
/* Shown in the alert dialog */
|
||||
"No" = "No";
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1065</string>
|
||||
<string>1097</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue