├── .gitignore ├── FluffyDisplay.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── tml.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── FluffyDisplay ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── FluffyDisplay-1024.png │ │ ├── FluffyDisplay-128.png │ │ ├── FluffyDisplay-16.png │ │ ├── FluffyDisplay-256.png │ │ ├── FluffyDisplay-257.png │ │ ├── FluffyDisplay-32.png │ │ ├── FluffyDisplay-33.png │ │ ├── FluffyDisplay-512.png │ │ ├── FluffyDisplay-513.png │ │ └── FluffyDisplay-64.png │ ├── Contents.json │ └── Icon.imageset │ │ ├── Contents.json │ │ └── FluffyDisplay.png ├── Base.lproj │ └── Main.storyboard ├── FluffyDisplay-Bridging-Header.h ├── FluffyDisplay.entitlements ├── Info.plist ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── VirtualDisplay.h └── VirtualDisplay.m ├── LICENSE ├── NOTICE ├── README.md └── include ├── CGVirtualDisplay.h ├── CGVirtualDisplayDescriptor.h ├── CGVirtualDisplayMode.h ├── CGVirtualDisplaySettings.h └── original-dump ├── CGVirtualDisplay.h ├── CGVirtualDisplayDescriptor.h ├── CGVirtualDisplayMode.h ├── CGVirtualDisplaySettings.h └── README.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | xcdebugger 3 | -------------------------------------------------------------------------------- /FluffyDisplay.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BEB26A432530B2F600744C86 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB26A422530B2F600744C86 /* AppDelegate.swift */; }; 11 | BEB26A472530B2F700744C86 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEB26A462530B2F700744C86 /* Assets.xcassets */; }; 12 | BEB26A4A2530B2F700744C86 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BEB26A492530B2F700744C86 /* Preview Assets.xcassets */; }; 13 | BEB26A4D2530B2F700744C86 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BEB26A4B2530B2F700744C86 /* Main.storyboard */; }; 14 | BEB26A792531163C00744C86 /* VirtualDisplay.m in Sources */ = {isa = PBXBuildFile; fileRef = BEB26A782531163C00744C86 /* VirtualDisplay.m */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | BEB26A3F2530B2F600744C86 /* FluffyDisplay.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FluffyDisplay.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | BEB26A422530B2F600744C86 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | BEB26A462530B2F700744C86 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 21 | BEB26A492530B2F700744C86 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 22 | BEB26A4C2530B2F700744C86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | BEB26A4E2530B2F700744C86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | BEB26A4F2530B2F700744C86 /* FluffyDisplay.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FluffyDisplay.entitlements; sourceTree = ""; }; 25 | BEB26A562530B51000744C86 /* include */ = {isa = PBXFileReference; lastKnownFileType = folder; path = include; sourceTree = ""; }; 26 | BEB26A772531163C00744C86 /* FluffyDisplay-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FluffyDisplay-Bridging-Header.h"; sourceTree = ""; }; 27 | BEB26A782531163C00744C86 /* VirtualDisplay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VirtualDisplay.m; sourceTree = ""; }; 28 | BEB26A7E2531183700744C86 /* VirtualDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VirtualDisplay.h; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | BEB26A3C2530B2F600744C86 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | BEB26A362530B2F600744C86 = { 43 | isa = PBXGroup; 44 | children = ( 45 | BEB26A562530B51000744C86 /* include */, 46 | BEB26A412530B2F600744C86 /* FluffyDisplay */, 47 | BEB26A402530B2F600744C86 /* Products */, 48 | ); 49 | sourceTree = ""; 50 | }; 51 | BEB26A402530B2F600744C86 /* Products */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | BEB26A3F2530B2F600744C86 /* FluffyDisplay.app */, 55 | ); 56 | name = Products; 57 | sourceTree = ""; 58 | }; 59 | BEB26A412530B2F600744C86 /* FluffyDisplay */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | BEB26A7E2531183700744C86 /* VirtualDisplay.h */, 63 | BEB26A422530B2F600744C86 /* AppDelegate.swift */, 64 | BEB26A462530B2F700744C86 /* Assets.xcassets */, 65 | BEB26A4B2530B2F700744C86 /* Main.storyboard */, 66 | BEB26A4E2530B2F700744C86 /* Info.plist */, 67 | BEB26A4F2530B2F700744C86 /* FluffyDisplay.entitlements */, 68 | BEB26A482530B2F700744C86 /* Preview Content */, 69 | BEB26A782531163C00744C86 /* VirtualDisplay.m */, 70 | BEB26A772531163C00744C86 /* FluffyDisplay-Bridging-Header.h */, 71 | ); 72 | path = FluffyDisplay; 73 | sourceTree = ""; 74 | }; 75 | BEB26A482530B2F700744C86 /* Preview Content */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | BEB26A492530B2F700744C86 /* Preview Assets.xcassets */, 79 | ); 80 | path = "Preview Content"; 81 | sourceTree = ""; 82 | }; 83 | /* End PBXGroup section */ 84 | 85 | /* Begin PBXNativeTarget section */ 86 | BEB26A3E2530B2F600744C86 /* FluffyDisplay */ = { 87 | isa = PBXNativeTarget; 88 | buildConfigurationList = BEB26A522530B2F700744C86 /* Build configuration list for PBXNativeTarget "FluffyDisplay" */; 89 | buildPhases = ( 90 | BEB26A3B2530B2F600744C86 /* Sources */, 91 | BEB26A3C2530B2F600744C86 /* Frameworks */, 92 | BEB26A3D2530B2F600744C86 /* Resources */, 93 | ); 94 | buildRules = ( 95 | ); 96 | dependencies = ( 97 | ); 98 | name = FluffyDisplay; 99 | productName = FluffyDisplay; 100 | productReference = BEB26A3F2530B2F600744C86 /* FluffyDisplay.app */; 101 | productType = "com.apple.product-type.application"; 102 | }; 103 | /* End PBXNativeTarget section */ 104 | 105 | /* Begin PBXProject section */ 106 | BEB26A372530B2F600744C86 /* Project object */ = { 107 | isa = PBXProject; 108 | attributes = { 109 | LastSwiftUpdateCheck = 1200; 110 | LastUpgradeCheck = 1200; 111 | TargetAttributes = { 112 | BEB26A3E2530B2F600744C86 = { 113 | CreatedOnToolsVersion = 12.0.1; 114 | LastSwiftMigration = 1200; 115 | }; 116 | }; 117 | }; 118 | buildConfigurationList = BEB26A3A2530B2F600744C86 /* Build configuration list for PBXProject "FluffyDisplay" */; 119 | compatibilityVersion = "Xcode 9.3"; 120 | developmentRegion = en; 121 | hasScannedForEncodings = 0; 122 | knownRegions = ( 123 | en, 124 | Base, 125 | ); 126 | mainGroup = BEB26A362530B2F600744C86; 127 | productRefGroup = BEB26A402530B2F600744C86 /* Products */; 128 | projectDirPath = ""; 129 | projectRoot = ""; 130 | targets = ( 131 | BEB26A3E2530B2F600744C86 /* FluffyDisplay */, 132 | ); 133 | }; 134 | /* End PBXProject section */ 135 | 136 | /* Begin PBXResourcesBuildPhase section */ 137 | BEB26A3D2530B2F600744C86 /* Resources */ = { 138 | isa = PBXResourcesBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | BEB26A4D2530B2F700744C86 /* Main.storyboard in Resources */, 142 | BEB26A4A2530B2F700744C86 /* Preview Assets.xcassets in Resources */, 143 | BEB26A472530B2F700744C86 /* Assets.xcassets in Resources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXResourcesBuildPhase section */ 148 | 149 | /* Begin PBXSourcesBuildPhase section */ 150 | BEB26A3B2530B2F600744C86 /* Sources */ = { 151 | isa = PBXSourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | BEB26A792531163C00744C86 /* VirtualDisplay.m in Sources */, 155 | BEB26A432530B2F600744C86 /* AppDelegate.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin PBXVariantGroup section */ 162 | BEB26A4B2530B2F700744C86 /* Main.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | BEB26A4C2530B2F700744C86 /* Base */, 166 | ); 167 | name = Main.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | BEB26A502530B2F700744C86 /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 200 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 201 | CLANG_WARN_STRICT_PROTOTYPES = YES; 202 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 203 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 204 | CLANG_WARN_UNREACHABLE_CODE = YES; 205 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 206 | COPY_PHASE_STRIP = NO; 207 | DEBUG_INFORMATION_FORMAT = dwarf; 208 | ENABLE_STRICT_OBJC_MSGSEND = YES; 209 | ENABLE_TESTABILITY = YES; 210 | GCC_C_LANGUAGE_STANDARD = gnu11; 211 | GCC_DYNAMIC_NO_PIC = NO; 212 | GCC_NO_COMMON_BLOCKS = YES; 213 | GCC_OPTIMIZATION_LEVEL = 0; 214 | GCC_PREPROCESSOR_DEFINITIONS = ( 215 | "DEBUG=1", 216 | "$(inherited)", 217 | ); 218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 220 | GCC_WARN_UNDECLARED_SELECTOR = YES; 221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 222 | GCC_WARN_UNUSED_FUNCTION = YES; 223 | GCC_WARN_UNUSED_VARIABLE = YES; 224 | MACOSX_DEPLOYMENT_TARGET = 10.15; 225 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 226 | MTL_FAST_MATH = YES; 227 | ONLY_ACTIVE_ARCH = YES; 228 | SDKROOT = macosx; 229 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 230 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 231 | }; 232 | name = Debug; 233 | }; 234 | BEB26A512530B2F700744C86 /* Release */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_ENABLE_OBJC_WEAK = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 257 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 258 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 261 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 262 | CLANG_WARN_STRICT_PROTOTYPES = YES; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 269 | ENABLE_NS_ASSERTIONS = NO; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu11; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | MACOSX_DEPLOYMENT_TARGET = 10.15; 280 | MTL_ENABLE_DEBUG_INFO = NO; 281 | MTL_FAST_MATH = YES; 282 | SDKROOT = macosx; 283 | SWIFT_COMPILATION_MODE = wholemodule; 284 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 285 | }; 286 | name = Release; 287 | }; 288 | BEB26A532530B2F700744C86 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 293 | CLANG_ENABLE_MODULES = YES; 294 | CODE_SIGN_ENTITLEMENTS = FluffyDisplay/FluffyDisplay.entitlements; 295 | CODE_SIGN_IDENTITY = "Developer ID Application"; 296 | CODE_SIGN_STYLE = Manual; 297 | COMBINE_HIDPI_IMAGES = YES; 298 | CURRENT_PROJECT_VERSION = 6; 299 | DEVELOPMENT_ASSET_PATHS = ""; 300 | DEVELOPMENT_TEAM = DD8CRVRRU7; 301 | ENABLE_HARDENED_RUNTIME = YES; 302 | ENABLE_PREVIEWS = YES; 303 | HEADER_SEARCH_PATHS = include; 304 | INFOPLIST_FILE = FluffyDisplay/Info.plist; 305 | LD_RUNPATH_SEARCH_PATHS = ( 306 | "$(inherited)", 307 | "@executable_path/../Frameworks", 308 | ); 309 | MACOSX_DEPLOYMENT_TARGET = 10.15; 310 | MARKETING_VERSION = 1.1; 311 | OTHER_CODE_SIGN_FLAGS = "--timestamp"; 312 | PRODUCT_BUNDLE_IDENTIFIER = fi.iki.tml.FluffyDisplay; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | PROVISIONING_PROFILE_SPECIFIER = ""; 315 | SWIFT_OBJC_BRIDGING_HEADER = "FluffyDisplay/FluffyDisplay-Bridging-Header.h"; 316 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 317 | SWIFT_VERSION = 5.0; 318 | }; 319 | name = Debug; 320 | }; 321 | BEB26A542530B2F700744C86 /* Release */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 325 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 326 | CLANG_ENABLE_MODULES = YES; 327 | CODE_SIGN_ENTITLEMENTS = FluffyDisplay/FluffyDisplay.entitlements; 328 | CODE_SIGN_IDENTITY = "Developer ID Application"; 329 | CODE_SIGN_STYLE = Manual; 330 | COMBINE_HIDPI_IMAGES = YES; 331 | CURRENT_PROJECT_VERSION = 6; 332 | DEVELOPMENT_ASSET_PATHS = ""; 333 | DEVELOPMENT_TEAM = DD8CRVRRU7; 334 | ENABLE_HARDENED_RUNTIME = YES; 335 | ENABLE_PREVIEWS = YES; 336 | HEADER_SEARCH_PATHS = include; 337 | INFOPLIST_FILE = FluffyDisplay/Info.plist; 338 | LD_RUNPATH_SEARCH_PATHS = ( 339 | "$(inherited)", 340 | "@executable_path/../Frameworks", 341 | ); 342 | MACOSX_DEPLOYMENT_TARGET = 10.15; 343 | MARKETING_VERSION = 1.1; 344 | OTHER_CODE_SIGN_FLAGS = "--timestamp"; 345 | PRODUCT_BUNDLE_IDENTIFIER = fi.iki.tml.FluffyDisplay; 346 | PRODUCT_NAME = "$(TARGET_NAME)"; 347 | PROVISIONING_PROFILE_SPECIFIER = ""; 348 | SWIFT_OBJC_BRIDGING_HEADER = "FluffyDisplay/FluffyDisplay-Bridging-Header.h"; 349 | SWIFT_VERSION = 5.0; 350 | }; 351 | name = Release; 352 | }; 353 | /* End XCBuildConfiguration section */ 354 | 355 | /* Begin XCConfigurationList section */ 356 | BEB26A3A2530B2F600744C86 /* Build configuration list for PBXProject "FluffyDisplay" */ = { 357 | isa = XCConfigurationList; 358 | buildConfigurations = ( 359 | BEB26A502530B2F700744C86 /* Debug */, 360 | BEB26A512530B2F700744C86 /* Release */, 361 | ); 362 | defaultConfigurationIsVisible = 0; 363 | defaultConfigurationName = Release; 364 | }; 365 | BEB26A522530B2F700744C86 /* Build configuration list for PBXNativeTarget "FluffyDisplay" */ = { 366 | isa = XCConfigurationList; 367 | buildConfigurations = ( 368 | BEB26A532530B2F700744C86 /* Debug */, 369 | BEB26A542530B2F700744C86 /* Release */, 370 | ); 371 | defaultConfigurationIsVisible = 0; 372 | defaultConfigurationName = Release; 373 | }; 374 | /* End XCConfigurationList section */ 375 | }; 376 | rootObject = BEB26A372530B2F600744C86 /* Project object */; 377 | } 378 | -------------------------------------------------------------------------------- /FluffyDisplay.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FluffyDisplay.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FluffyDisplay.xcodeproj/xcuserdata/tml.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FluffyDisplay.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /FluffyDisplay/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // -*- Mode: Swift; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import Cocoa 16 | import CoreGraphics 17 | 18 | @NSApplicationMain 19 | class AppDelegate: NSObject, NSApplicationDelegate, NetServiceDelegate, NetServiceBrowserDelegate { 20 | 21 | struct Resolution { 22 | let width, height, ppi: Int32 23 | let hiDPI: Bool 24 | let description: String 25 | init(_ width: Int32, _ height: Int32, _ ppi: Int32, _ hiDPI: Bool, _ description: String) { 26 | self.width = width 27 | self.height = height 28 | self.ppi = ppi 29 | self.hiDPI = hiDPI 30 | self.description = description 31 | } 32 | init(_ width: Int, _ height: Int, _ ppi: Int, _ hiDPI: Bool, _ description: String) { 33 | self.init(Int32(width), Int32(height), Int32(ppi), hiDPI, description) 34 | } 35 | } 36 | 37 | let predefResolutions: [Resolution] = [ 38 | // List from https://en.wikipedia.org/wiki/Graphics_display_resolution and 39 | // https://www.theverge.com/tldr/2016/3/21/11278192/apple-iphone-ipad-screen-sizes-pixels-density-so-many-choices 40 | 41 | Resolution(6016, 3384, 218, true, "Apple Pro Display XDR"), 42 | Resolution(5120, 2880, 218, true, "UHD+, 27-inch Apple Studio Display, 27-inch iMac with Retina 5K display"), 43 | Resolution(4480, 2520, 218, true, "24-inch iMac (23.5-inch)"), 44 | Resolution(5120, 2160, 200, true, "21:9, 64∶27, 237:100 (27.8-inch)"), 45 | Resolution(4096, 2304, 219, true, "21.5-inch iMac with Retina 4K display"), 46 | Resolution(3840, 2400, 200, true, "WQUXGA"), 47 | Resolution(3840, 2160, 200, true, "UHD"), 48 | Resolution(3456, 2234, 254, true, "16.2-inch MacBook Pro"), 49 | Resolution(5120, 1440, 200, true, "32:9, 356:100, DQHD (26.6-inch)"), 50 | Resolution(3840, 1600, 200, true, "WQHD+, UW-QHD+, 21:9, 240:100 (20.8-inch)"), 51 | Resolution(3440, 1440, 200, true, "21:9, 239:100 (18.6-inch)"), 52 | Resolution(3840, 1080, 200, true, "DFHD"), 53 | Resolution(3024, 1964, 254, true, "14.2-inch MacBook Pro"), 54 | Resolution(3072, 1920, 226, true, "16-inch MacBook Pro with Retina display"), 55 | Resolution(2880, 1864, 224, true, "15.3-inch MacBook Air"), 56 | Resolution(2880, 1800, 220, true, "15.4-inch MacBook Pro with Retina display"), 57 | Resolution(2560, 1664, 224, true, "13.6-inch MacBook Air"), 58 | Resolution(2560, 1600, 227, true, "WQXGA, 13.3-inch MacBook Pro with Retina display"), 59 | Resolution(2560, 1440, 109, false, "27-inch Apple Thunderbolt display"), 60 | Resolution(2304, 1440, 226, true, "12-inch MacBook with Retina display"), 61 | Resolution(2048, 1536, 150, false, "QXGA"), 62 | Resolution(2048, 1152, 150, false, "QWXGA"), 63 | Resolution(1920, 1200, 98, false, "WUXGA, 23-inch Apple Cinema HD Display"), 64 | Resolution(1600, 1200, 125, false, "UXGA"), 65 | Resolution(1920, 1080, 102, false, "HD, 21.5-inch iMac"), 66 | Resolution(1680, 1050, 99, false, "WSXGA+, Apple Cinema Display (20-inch), 20-inch iMac"), 67 | Resolution(1600, 1024, 86, false, "WSXGA, Apple Cinema Display (22-inch)"), 68 | Resolution(1440, 900, 127, false, "WXGA+, 13.3-inch MacBook Air"), 69 | Resolution(1400, 1050, 125, false, "SXGA+"), 70 | Resolution(1366, 768, 135, false, "11.6-inch MacBook Air"), 71 | Resolution(1280, 1024, 100, false, "SXGA"), 72 | Resolution(1280, 800, 113, false, "13.3-inch MacBook Pro"), 73 | ] 74 | 75 | var activeDisplays = [Resolution]() 76 | 77 | // Represents one local virtual display 78 | struct VirtualDisplay { 79 | let number: Int 80 | let display: Any 81 | } 82 | 83 | var virtualDisplayCounter = 0 84 | var virtualDisplays = [Int: VirtualDisplay]() 85 | 86 | // Represents one (real) display on a peer running FluffyDisplay 87 | struct PeerDisplay { 88 | let number: Int 89 | let peer: String 90 | let resolution: Resolution 91 | } 92 | var peerDisplayCounter = 0 93 | var peerDisplays = [Int: PeerDisplay]() 94 | 95 | var statusBarItem: NSStatusItem! 96 | 97 | let newSubmenu = NSMenuItem(title: "New", action: nil, keyEquivalent: "") 98 | 99 | let autoSubmenu = NSMenuItem(title: "New on peer", action: nil, keyEquivalent: "") 100 | let autoMenu = NSMenu() 101 | 102 | let deleteSubmenu = NSMenuItem(title: "Delete", action: nil, keyEquivalent: "") 103 | let deleteMenu = NSMenu() 104 | 105 | let ns = NetService(domain: "local.", type: "_fi-iki-tml-flfd._tcp", name: "\(Host.current().localizedName ?? "?")") 106 | let browser = NetServiceBrowser() 107 | let queue = DispatchQueue(label: "networkIO") 108 | 109 | var discoveredServices = [String: NetService]() 110 | 111 | let beingDebugged = amIBeingDebugged() 112 | 113 | func applicationDidFinishLaunching(_ aNotification: Notification) { 114 | let maxDisplays: Int32 = 5 115 | var activeDisplayIDs = [CGDirectDisplayID](repeating: 0, count: Int(maxDisplays)) 116 | var activeDisplayCount: UInt32 = 0 117 | 118 | if CGGetActiveDisplayList(UInt32(maxDisplays), &activeDisplayIDs, &activeDisplayCount) == .success { 119 | for i in (0...UInt32(activeDisplayCount)-1) { 120 | 121 | // Just use the current mode of the display 122 | if let mode = CGDisplayCopyDisplayMode(activeDisplayIDs[Int(i)]) { 123 | let size = CGDisplayScreenSize(activeDisplayIDs[Int(i)]) 124 | activeDisplays.append(Resolution(Int32(mode.pixelWidth), Int32(mode.pixelHeight), 125 | Int32(CGFloat(mode.pixelWidth) / size.width * 25.4), 126 | mode.pixelWidth > mode.width, 127 | CGDisplayIsBuiltin(activeDisplayIDs[Int(i)]) != 0 ? "Built-in Display" : "Display #\(i)")) 128 | } 129 | } 130 | } 131 | 132 | ns.delegate = self 133 | ns.publish(options: [.listenForConnections]) 134 | ns.startMonitoring() 135 | 136 | browser.includesPeerToPeer = true 137 | browser.delegate = self 138 | browser.searchForServices(ofType: "_fi-iki-tml-flfd._tcp", inDomain: "local.") 139 | 140 | self.statusBarItem = NSStatusBar.system.statusItem(withLength: CGFloat(NSStatusItem.variableLength)) 141 | if let button = self.statusBarItem.button { 142 | button.image = NSImage(named: "Icon") 143 | } 144 | 145 | let menu = NSMenu() 146 | let newMenu = NSMenu() 147 | 148 | var i = 0 149 | for size in predefResolutions { 150 | let item = NSMenuItem(title: "\(size.width)×\(size.height) (\(size.description))", action: #selector(newDisplay(_:)), keyEquivalent: "") 151 | item.tag = i 152 | newMenu.addItem(item) 153 | i += 1 154 | } 155 | 156 | newSubmenu.submenu = newMenu 157 | menu.addItem(newSubmenu) 158 | 159 | autoSubmenu.submenu = autoMenu 160 | menu.addItem(autoSubmenu) 161 | 162 | deleteSubmenu.submenu = deleteMenu 163 | menu.addItem(deleteSubmenu) 164 | 165 | // When we start we haven't found any other Macs and we don't have anythung to delete. 166 | autoSubmenu.isHidden = true 167 | deleteSubmenu.isHidden = true 168 | 169 | menu.addItem(NSMenuItem.separator()) 170 | menu.addItem(NSMenuItem(title: "Quit FluffyDisplay", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")) 171 | 172 | statusBarItem.menu = menu 173 | } 174 | 175 | @objc func newDisplay(_ sender: AnyObject?) { 176 | if let menuItem = sender as? NSMenuItem { 177 | if menuItem.tag >= 0 && menuItem.tag < predefResolutions.count { 178 | let resolution = predefResolutions[menuItem.tag] 179 | let name = "FluffyDisplay Virtual Display #\(virtualDisplayCounter)" 180 | if let display = createVirtualDisplay(resolution.width, 181 | resolution.height, 182 | resolution.ppi, 183 | resolution.hiDPI, 184 | name) { 185 | virtualDisplays[virtualDisplayCounter] = VirtualDisplay(number: virtualDisplayCounter, display: display) 186 | let menuItem = NSMenuItem(title: "\(name) (\(resolution.width)×\(resolution.height))", 187 | action: #selector(deleteDisplay(_:)), 188 | keyEquivalent: "") 189 | menuItem.tag = virtualDisplayCounter 190 | deleteMenu.addItem(menuItem) 191 | deleteSubmenu.isHidden = false 192 | 193 | virtualDisplayCounter += 1 194 | 195 | // If we have created a new virtual display, this FluffyDisplay clearly is the 196 | // "main" Mac and no other Mac will use a physical display on this Mac. So we 197 | // don't need to advertise our displays. 198 | ns.setTXTRecord(nil) 199 | } 200 | } 201 | } 202 | } 203 | 204 | @objc func newAutoDisplay(_ sender: AnyObject?) { 205 | if let menuItem = sender as? NSMenuItem { 206 | if menuItem.tag >= 0 && menuItem.tag < peerDisplays.count { 207 | if let peerDisplay = peerDisplays[menuItem.tag], 208 | let display = createVirtualDisplay(peerDisplay.resolution.width, 209 | peerDisplay.resolution.height, 210 | peerDisplay.resolution.ppi, 211 | peerDisplay.resolution.hiDPI, 212 | peerDisplay.resolution.description) { 213 | virtualDisplays[virtualDisplayCounter] = VirtualDisplay(number: virtualDisplayCounter, display: display) 214 | let menuItem = NSMenuItem(title: peerDisplay.resolution.description, 215 | action: #selector(deleteDisplay(_:)), 216 | keyEquivalent: "") 217 | menuItem.tag = virtualDisplayCounter 218 | deleteMenu.addItem(menuItem) 219 | deleteSubmenu.isHidden = false 220 | 221 | virtualDisplayCounter += 1 222 | 223 | // Advertise that we want the other Mac to connect to our new virtual display 224 | // with Screen Sharing. 225 | advertiseRequestToConnect(from: peerDisplay.peer, on: ns) 226 | } 227 | } 228 | } 229 | } 230 | 231 | @objc func deleteDisplay(_ sender: AnyObject?) { 232 | if let menuItem = sender as? NSMenuItem { 233 | virtualDisplays[menuItem.tag] = nil 234 | menuItem.menu?.removeItem(menuItem) 235 | // We can clear our TXT record now 236 | ns.setTXTRecord(nil) 237 | 238 | if deleteMenu.numberOfItems == 0 { 239 | deleteSubmenu.isHidden = true 240 | } 241 | } 242 | } 243 | 244 | func stringInDict(_ dict: [String: Data], _ key: String) -> String? { 245 | if let d = dict[key] { 246 | return String(data: d, encoding: .utf8) 247 | } 248 | return nil 249 | } 250 | 251 | func intInDict(_ dict: [String: Data], _ key: String) -> Int? { 252 | if let s = stringInDict(dict, key) { 253 | return Int(s) 254 | } 255 | return nil 256 | } 257 | 258 | static func amIBeingDebugged() -> Bool { 259 | var info = kinfo_proc() 260 | var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()] 261 | var size = MemoryLayout.stride 262 | let junk = sysctl(&mib, UInt32(mib.count), &info, &size, nil, 0) 263 | assert(junk == 0, "sysctl failed") 264 | return (info.kp_proc.p_flag & P_TRACED) != 0 265 | } 266 | 267 | func advertiseDisplays(on service: NetService) { 268 | var txtDict = [String: Data]() 269 | var i = 0 270 | txtDict["ndisplays"] = "\(activeDisplays.count)".data(using: .utf8) 271 | for display in activeDisplays { 272 | txtDict["width\(i)"] = "\(display.width)".data(using: .utf8) 273 | txtDict["height\(i)"] = "\(display.height)".data(using: .utf8) 274 | txtDict["ppi\(i)"] = "\(display.ppi)".data(using: .utf8) 275 | let hiDPI = display.hiDPI ? 1 : 0 276 | txtDict["hidpi\(i)"] = "\(hiDPI)".data(using: .utf8) 277 | txtDict["name\(i)"] = "\(display.description)".data(using: .utf8) 278 | i += 1 279 | } 280 | setTXTRecord(type: "displays", with: txtDict, on: service) 281 | } 282 | 283 | func advertiseRequestToConnect(from source: String, on service: NetService) { 284 | let txtDict = ["source": source.data(using: .utf8)!]; 285 | setTXTRecord(type: "request", with: txtDict, on: service) 286 | } 287 | 288 | func setTXTRecord(type: String, with txtDict: [String: Data], on service: NetService) { 289 | var dict = txtDict 290 | dict["--type"] = type.data(using: .utf8) 291 | let txtData = NetService.data(fromTXTRecord: dict) 292 | if service.setTXTRecord(txtData) { 293 | debug("Set txtRecord \(txtDictAsString(dict))") 294 | } else { 295 | debug("Did not set txtRecord \(txtDictAsString(dict))") 296 | } 297 | } 298 | 299 | func txtDictAsString(_ txtDict: [String: Data]) -> String { 300 | var result = "" 301 | for key in txtDict.keys.sorted() { 302 | if result != "" { 303 | result += "," 304 | } 305 | result += key + "=" + String(decoding: txtDict[key]!, as: UTF8.self) 306 | } 307 | return result 308 | } 309 | 310 | func debug(_ string: String) { 311 | if beingDebugged || ProcessInfo.processInfo.environment["FLUFFYDISPLAY_DEBUG"] != nil { 312 | print(string) 313 | } 314 | } 315 | 316 | // NetServiceDelegate 317 | 318 | func netService(_ sender: NetService, didNotPublish errorDict: [String : NSNumber]) { 319 | debug("Did not publish: \(sender), because: \(errorDict)") 320 | } 321 | 322 | func netServiceDidPublish(_ sender: NetService) { 323 | advertiseDisplays(on: sender) 324 | debug("Published: \(sender)") 325 | } 326 | 327 | func netService(_ sender: NetService, didUpdateTXTRecord data: Data) { 328 | debug("Got updated TXT record of: \(sender.name): \(data.count) bytes"); 329 | 330 | if sender.name != ns.name { 331 | let dict = NetService.dictionary(fromTXTRecord: data) 332 | debug("\(txtDictAsString(dict))") 333 | 334 | if let type = stringInDict(dict, "--type") { 335 | switch type { 336 | case "displays": 337 | if let ndisplays = intInDict(dict, "ndisplays") { 338 | debug("\(sender.name) has \(ndisplays) display(s)") 339 | 340 | // Delete old menu entries for the peer's displays 341 | for item in autoMenu.items { 342 | if let match = item.title.range(of: "^.* on \(sender.name)", 343 | options: .regularExpression) { 344 | if (!match.isEmpty) { 345 | peerDisplays[item.tag] = nil 346 | autoMenu.removeItem(item) 347 | } 348 | } 349 | } 350 | 351 | // Add new menu entries for them 352 | for i in 0...ndisplays-1 { 353 | if let width = intInDict(dict, "width\(i)"), 354 | let height = intInDict(dict, "height\(i)"), 355 | let ppi = intInDict(dict, "ppi\(i)"), 356 | let hiDPI = intInDict(dict, "hidpi\(i)"), 357 | let name = stringInDict(dict, "name\(i)") { 358 | let hiDPIString = hiDPI == 0 ? "" : " (Retina)" 359 | let title = "\(name) on \(sender.name): \(width) x \(height)\(hiDPIString)" 360 | let item = NSMenuItem(title: title, action: #selector(newAutoDisplay(_:)), keyEquivalent: "") 361 | item.tag = peerDisplayCounter 362 | peerDisplays[peerDisplayCounter] = PeerDisplay(number: peerDisplayCounter, 363 | peer: sender.name, 364 | resolution: Resolution(width, height, ppi, hiDPI != 0, title)) 365 | autoMenu.addItem(item) 366 | autoSubmenu.isHidden = false 367 | peerDisplayCounter += 1 368 | } 369 | } 370 | } 371 | case "request": 372 | if let source = stringInDict(dict, "source") { 373 | if source == ns.name { 374 | // We now know that this Mac is not the "main" one, so we have no need 375 | // for the newSubmenu, autoSubmenu, or deleteSubmenu on this Mac. 376 | newSubmenu.isHidden = true 377 | autoSubmenu.isHidden = true 378 | deleteSubmenu.isHidden = true 379 | 380 | debug("Will open Screen Sharing to \(sender.name).\(sender.domain)") 381 | let configuration = NSWorkspace.OpenConfiguration() 382 | configuration.createsNewApplicationInstance = true 383 | 384 | if let url = URL(string: "vnc://\(sender.name).\(sender.domain)") { 385 | NSWorkspace.shared.open(url, configuration: configuration) { application, error in 386 | if error != nil { 387 | self.debug("Opening the URL \(url) failed: \(error!)"); 388 | } 389 | } 390 | } 391 | } 392 | } 393 | default: 394 | debug("Unhandled TXT record type \(type)") 395 | } 396 | } 397 | } 398 | } 399 | 400 | func netServiceDidStop(_ sender: NetService) { 401 | debug("Stopped: \(sender)") 402 | } 403 | 404 | func netService(_ sender: NetService, didAcceptConnectionWith inputStream: InputStream, outputStream: OutputStream) { 405 | debug("Accepted connection: \(sender)") 406 | inputStream.close() 407 | } 408 | 409 | // NetServiceBrowserDelegate 410 | 411 | func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) { 412 | debug("Did not search: \(errorDict)") 413 | } 414 | 415 | func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { 416 | if service.name != ns.name { 417 | debug("Found: \(service.name)") 418 | discoveredServices[service.name] = service; 419 | service.delegate = self 420 | service.startMonitoring() 421 | } 422 | } 423 | 424 | func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) { 425 | if service.name != ns.name { 426 | debug("Removed: \(service.name)") 427 | if discoveredServices[service.name] != nil { 428 | discoveredServices[service.name] = nil 429 | } 430 | if let item = autoMenu.item(withTitle: service.name) { 431 | autoMenu.removeItem(item) 432 | if autoMenu.numberOfItems == 0 { 433 | autoSubmenu.isHidden = true 434 | } 435 | } 436 | } 437 | } 438 | 439 | func netServiceBrowserDidStopSearch(_ browser: NetServiceBrowser) { 440 | debug("Did stop: \(browser)") 441 | } 442 | 443 | } 444 | -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "FluffyDisplay-16.png", 5 | "idiom" : "mac", 6 | "scale" : "1x", 7 | "size" : "16x16" 8 | }, 9 | { 10 | "filename" : "FluffyDisplay-32.png", 11 | "idiom" : "mac", 12 | "scale" : "2x", 13 | "size" : "16x16" 14 | }, 15 | { 16 | "filename" : "FluffyDisplay-33.png", 17 | "idiom" : "mac", 18 | "scale" : "1x", 19 | "size" : "32x32" 20 | }, 21 | { 22 | "filename" : "FluffyDisplay-64.png", 23 | "idiom" : "mac", 24 | "scale" : "2x", 25 | "size" : "32x32" 26 | }, 27 | { 28 | "filename" : "FluffyDisplay-128.png", 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "filename" : "FluffyDisplay-256.png", 35 | "idiom" : "mac", 36 | "scale" : "2x", 37 | "size" : "128x128" 38 | }, 39 | { 40 | "filename" : "FluffyDisplay-257.png", 41 | "idiom" : "mac", 42 | "scale" : "1x", 43 | "size" : "256x256" 44 | }, 45 | { 46 | "filename" : "FluffyDisplay-512.png", 47 | "idiom" : "mac", 48 | "scale" : "2x", 49 | "size" : "256x256" 50 | }, 51 | { 52 | "filename" : "FluffyDisplay-513.png", 53 | "idiom" : "mac", 54 | "scale" : "1x", 55 | "size" : "512x512" 56 | }, 57 | { 58 | "filename" : "FluffyDisplay-1024.png", 59 | "idiom" : "mac", 60 | "scale" : "2x", 61 | "size" : "512x512" 62 | } 63 | ], 64 | "info" : { 65 | "author" : "xcode", 66 | "version" : 1 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-1024.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-128.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-16.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-256.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-257.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-257.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-32.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-33.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-512.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-513.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-513.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/AppIcon.appiconset/FluffyDisplay-64.png -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/Icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "FluffyDisplay.png", 5 | "idiom" : "mac" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | }, 12 | "properties" : { 13 | "compression-type" : "lossless", 14 | "template-rendering-intent" : "template" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /FluffyDisplay/Assets.xcassets/Icon.imageset/FluffyDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tml1024/FluffyDisplay/67180e3490741c3ba20f8dcedfc23adf77b44549/FluffyDisplay/Assets.xcassets/Icon.imageset/FluffyDisplay.png -------------------------------------------------------------------------------- /FluffyDisplay/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /FluffyDisplay/FluffyDisplay-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "VirtualDisplay.h" 2 | -------------------------------------------------------------------------------- /FluffyDisplay/FluffyDisplay.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.network.client 6 | 7 | com.apple.security.network.server 8 | 9 | com.apple.security.app-sandbox 10 | 11 | com.apple.security.temporary-exception.mach-lookup.global-name 12 | 13 | com.apple.VirtualDisplay 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /FluffyDisplay/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSApplicationCategoryType 24 | public.app-category.utilities 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | LSUIElement 28 | 29 | NSBonjourServices 30 | 31 | _fi-iki-tml-flfd._tcp 32 | 33 | NSMainStoryboardFile 34 | Main 35 | NSPrincipalClass 36 | NSApplication 37 | 38 | 39 | -------------------------------------------------------------------------------- /FluffyDisplay/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /FluffyDisplay/VirtualDisplay.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import 16 | 17 | id createVirtualDisplay(int width, int height, int ppi, BOOL hiDPI, NSString *name); 18 | -------------------------------------------------------------------------------- /FluffyDisplay/VirtualDisplay.m: -------------------------------------------------------------------------------- 1 | // -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import 16 | #import 17 | 18 | #import "CGVirtualDisplay.h" 19 | #import "CGVirtualDisplayDescriptor.h" 20 | #import "CGVirtualDisplayMode.h" 21 | #import "CGVirtualDisplaySettings.h" 22 | 23 | #import "VirtualDisplay.h" 24 | 25 | id createVirtualDisplay(int width, int height, int ppi, BOOL hiDPI, NSString *name) { 26 | 27 | CGVirtualDisplaySettings *settings = [[CGVirtualDisplaySettings alloc] init]; 28 | settings.hiDPI = hiDPI; 29 | 30 | CGVirtualDisplayDescriptor *descriptor = [[CGVirtualDisplayDescriptor alloc] init]; 31 | descriptor.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); 32 | descriptor.name = name; 33 | 34 | // See System Preferences > Displays > Color > Open Profile > Apple display native information 35 | descriptor.whitePoint = CGPointMake(0.3125, 0.3291); 36 | descriptor.bluePrimary = CGPointMake(0.1494, 0.0557); 37 | descriptor.greenPrimary = CGPointMake(0.2559, 0.6983); 38 | descriptor.redPrimary = CGPointMake(0.6797, 0.3203); 39 | descriptor.maxPixelsHigh = height; 40 | descriptor.maxPixelsWide = width; 41 | descriptor.sizeInMillimeters = CGSizeMake(25.4 * width / ppi, 25.4 * height / ppi); 42 | descriptor.serialNum = 1; 43 | descriptor.productID = 1; 44 | descriptor.vendorID = 1; 45 | 46 | CGVirtualDisplay *display = [[CGVirtualDisplay alloc] initWithDescriptor:descriptor]; 47 | 48 | if (settings.hiDPI) { 49 | width /= 2; 50 | height /= 2; 51 | } 52 | CGVirtualDisplayMode *mode = [[CGVirtualDisplayMode alloc] initWithWidth:width 53 | height:height 54 | refreshRate:60]; 55 | settings.modes = @[mode]; 56 | 57 | if (![display applySettings:settings]) 58 | return nil; 59 | 60 | return display; 61 | } 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | FluffyDisplay was developed by Tor Lillqvist . 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FluffyDisplay: Manage virtual displays on your Mac 2 | ================================================== 3 | 4 | Typical use case 5 | ---------------- 6 | 7 | You have a "leftover" old Mac that you want to use as an additional 8 | display for your current main Mac. 9 | 10 | It is an oldish iMac that as such still has a very nice display but it 11 | is underpowered for your actual work, and you have a newer iMac, or 12 | MacBook, that you do your work on. You want to use the old iMac as a 13 | display for your main Mac. You can use FluffyDisplay for that. 14 | 15 | You set up the old iMac so that it is right on either side of your 16 | main Mac's display. 17 | 18 | You start FluffyDisplay. It appears as an icon in the menu bar. You 19 | use it to create a "virtual" monitor on your main Mac. 20 | 21 | In System Preferences -> Displays, arrange the displays so that the 22 | virtual one is on the side of the built-in display where you put your 23 | old iMac. 24 | 25 | You then use Screen Sharing app on the other Mac to connect to your 26 | main Mac, and specifically select in Screen Sharing's View menu to 27 | view the "virtual" monitor. You switch Screen Sharing to observation 28 | mode and to full-screen. You then don't need to touch the mouse, 29 | trackpad or keyboard on the other Mac until you want to close the 30 | connection. (Or until the other Mac starts its screen saver.) 31 | 32 | You can also run FluffyDisplay also on the other Mac. In that case the 33 | main Mac notices that and automatically adds a menu "New on peer" 34 | (suggestions for better but still short name welcome) under which will 35 | appear the displays of other Macs running FluffyDisplay. When you 36 | choose one of those, FluffyDisplay on that other Mac will 37 | automatically start ScreenSharing to connect to your main Mac. 38 | 39 | You will still have to switch to observation mode and to full-screen, 40 | etc, this is not (and can not be) fully automated. It would be lovely 41 | if Screen Sharing could be passed query parameters in the vnc: URL 42 | that would tell it which display to show, to switch to observation 43 | mode, and to full-screen. But apparently no. Having those settings in 44 | a .vncloc file doesn't seem to work either. 45 | 46 | 47 | Not useful use case 48 | ------------------- 49 | 50 | The performance of Screen Sharing is probably not good enough to let 51 | you view videos in high quality, sorry. If that is what you want to 52 | do, just view them on the other Mac locally. 53 | 54 | Problems and future work 55 | ------------------------ 56 | 57 | Even if you move the cursor of the main Mac off the virtual display 58 | (that is showing in Screen Sharing on the other Mac), there is still a 59 | "ghost" cursor moving in the Screen Sharing window. That is highly 60 | irritating and misleading. 61 | 62 | The use is a bit too complicated, but see the next section. 63 | 64 | Security aspects 65 | ---------------- 66 | 67 | I suspect that the use of FluffyDisplay can't be made much simpler or 68 | more automated while still being able to run FluffyDisplay as a 69 | sandboxed app. 70 | 71 | Sandboxing and notarization is something I definitely want to keep. 72 | End-users should not run random non-sandboxed apps downloaded from the 73 | Internet, period. I don't trust such apps, and correspondingly, it 74 | would be rude to expect people who download a ready-built 75 | FluffyDisplay app to trust it. 76 | 77 | As this is open source, I can't prevent a third party from taking this 78 | code and producing something similar. That might then be distributed 79 | as a non-sandboxed app that works in a much more automated fashion. 80 | But end-users should then be aware that such an app could potentially 81 | be a very large security risk. The FluffyDisplay.app released here 82 | (inside the .zip archive(s) is digitally signed, securely timestamped, 83 | notarized, and runs sandboxed. 84 | 85 | What if Apple at some stage starts providing the same functionality 86 | ------------------------------------------------------------------- 87 | 88 | (In the same way as macOS has Sidecar, for using an iPad as a 89 | secondary display.) I would welcome that very much. They would be able 90 | to make the user experience much smoother than what this tool offers. 91 | 92 | Will this be in the Mac App Store? 93 | ---------------------------------- 94 | 95 | No way. It uses undocumented CoreGraphics APIs and requires the 96 | com.apple.security.temporary-exception.mach-lookup.global-name 97 | entitlement. 98 | 99 | If you find this useful 100 | ----------------------- 101 | 102 | If you find FluffyDisplay useful, and want to thank me in some way, 103 | feel free to contact me and I can send an invoice. Or point you to a 104 | charity of my choice. 105 | -------------------------------------------------------------------------------- /include/CGVirtualDisplay.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface CGVirtualDisplay : NSObject 10 | { 11 | unsigned int _vendorID; 12 | unsigned int _productID; 13 | unsigned int _serialNum; 14 | NSString *_name; 15 | struct CGSize _sizeInMillimeters; 16 | unsigned int _maxPixelsWide; 17 | unsigned int _maxPixelsHigh; 18 | struct CGPoint _redPrimary; 19 | struct CGPoint _greenPrimary; 20 | struct CGPoint _bluePrimary; 21 | struct CGPoint _whitePoint; 22 | id _queue; 23 | id _terminationHandler; 24 | void *_client; 25 | unsigned int _displayID; 26 | unsigned int _hiDPI; 27 | NSArray *_modes; 28 | unsigned int _serverRPC_port; 29 | unsigned int _proxyRPC_port; 30 | unsigned int _clientHandler_port; 31 | } 32 | 33 | @property(readonly, nonatomic) NSArray *modes; // @synthesize modes=_modes; 34 | @property(readonly, nonatomic) unsigned int hiDPI; // @synthesize hiDPI=_hiDPI; 35 | @property(readonly, nonatomic) unsigned int displayID; // @synthesize displayID=_displayID; 36 | @property(readonly, nonatomic) id terminationHandler; // @synthesize terminationHandler=_terminationHandler; 37 | @property(readonly, nonatomic) id queue; // @synthesize queue=_queue; 38 | @property(readonly, nonatomic) struct CGPoint whitePoint; // @synthesize whitePoint=_whitePoint; 39 | @property(readonly, nonatomic) struct CGPoint bluePrimary; // @synthesize bluePrimary=_bluePrimary; 40 | @property(readonly, nonatomic) struct CGPoint greenPrimary; // @synthesize greenPrimary=_greenPrimary; 41 | @property(readonly, nonatomic) struct CGPoint redPrimary; // @synthesize redPrimary=_redPrimary; 42 | @property(readonly, nonatomic) unsigned int maxPixelsHigh; // @synthesize maxPixelsHigh=_maxPixelsHigh; 43 | @property(readonly, nonatomic) unsigned int maxPixelsWide; // @synthesize maxPixelsWide=_maxPixelsWide; 44 | @property(readonly, nonatomic) struct CGSize sizeInMillimeters; // @synthesize sizeInMillimeters=_sizeInMillimeters; 45 | @property(readonly, nonatomic) NSString *name; // @synthesize name=_name; 46 | @property(readonly, nonatomic) unsigned int serialNum; // @synthesize serialNum=_serialNum; 47 | @property(readonly, nonatomic) unsigned int productID; // @synthesize productID=_productID; 48 | @property(readonly, nonatomic) unsigned int vendorID; // @synthesize vendorID=_vendorID; 49 | - (BOOL)applySettings:(id)arg1; 50 | - (void)dealloc; 51 | - (id)initWithDescriptor:(id)arg1; 52 | 53 | @end 54 | 55 | -------------------------------------------------------------------------------- /include/CGVirtualDisplayDescriptor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | #import 10 | 11 | @interface CGVirtualDisplayDescriptor : NSObject 12 | { 13 | unsigned int _vendorID; 14 | unsigned int _productID; 15 | unsigned int _serialNum; 16 | NSString *_name; 17 | struct CGSize _sizeInMillimeters; 18 | unsigned int _maxPixelsWide; 19 | unsigned int _maxPixelsHigh; 20 | struct CGPoint _redPrimary; 21 | struct CGPoint _greenPrimary; 22 | struct CGPoint _bluePrimary; 23 | struct CGPoint _whitePoint; 24 | id _queue; 25 | id _terminationHandler; 26 | } 27 | 28 | @property(retain, nonatomic) id queue; // @synthesize queue=_queue; 29 | @property(retain, nonatomic) NSString *name; // @synthesize name=_name; 30 | @property(nonatomic) struct CGPoint whitePoint; // @synthesize whitePoint=_whitePoint; 31 | @property(nonatomic) struct CGPoint bluePrimary; // @synthesize bluePrimary=_bluePrimary; 32 | @property(nonatomic) struct CGPoint greenPrimary; // @synthesize greenPrimary=_greenPrimary; 33 | @property(nonatomic) struct CGPoint redPrimary; // @synthesize redPrimary=_redPrimary; 34 | @property(nonatomic) unsigned int maxPixelsHigh; // @synthesize maxPixelsHigh=_maxPixelsHigh; 35 | @property(nonatomic) unsigned int maxPixelsWide; // @synthesize maxPixelsWide=_maxPixelsWide; 36 | @property(nonatomic) struct CGSize sizeInMillimeters; // @synthesize sizeInMillimeters=_sizeInMillimeters; 37 | @property(nonatomic) unsigned int serialNum; // @synthesize serialNum=_serialNum; 38 | @property(nonatomic) unsigned int productID; // @synthesize productID=_productID; 39 | @property(nonatomic) unsigned int vendorID; // @synthesize vendorID=_vendorID; 40 | - (void)dealloc; 41 | - (id)init; 42 | @property(copy, nonatomic) id terminationHandler; 43 | - (id)dispatchQueue; 44 | - (void)setDispatchQueue:(id)arg1; 45 | 46 | @end 47 | 48 | -------------------------------------------------------------------------------- /include/CGVirtualDisplayMode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface CGVirtualDisplayMode : NSObject 10 | { 11 | unsigned int _width; 12 | unsigned int _height; 13 | double _refreshRate; 14 | } 15 | 16 | @property(readonly, nonatomic) double refreshRate; // @synthesize refreshRate=_refreshRate; 17 | @property(readonly, nonatomic) unsigned int height; // @synthesize height=_height; 18 | @property(readonly, nonatomic) unsigned int width; // @synthesize width=_width; 19 | - (id)initWithWidth:(unsigned int)arg1 height:(unsigned int)arg2 refreshRate:(double)arg3; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /include/CGVirtualDisplaySettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface CGVirtualDisplaySettings : NSObject 10 | { 11 | NSArray *_modes; 12 | unsigned int _hiDPI; 13 | } 14 | 15 | @property(nonatomic) unsigned int hiDPI; // @synthesize hiDPI=_hiDPI; 16 | - (void)dealloc; 17 | - (id)init; 18 | @property(retain, nonatomic) NSArray *modes; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /include/original-dump/CGVirtualDisplay.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSArray, NSObject, NSString; 10 | 11 | @interface CGVirtualDisplay : NSObject 12 | { 13 | unsigned int _vendorID; 14 | unsigned int _productID; 15 | unsigned int _serialNum; 16 | NSString *_name; 17 | struct CGSize _sizeInMillimeters; 18 | unsigned int _maxPixelsWide; 19 | unsigned int _maxPixelsHigh; 20 | struct CGPoint _redPrimary; 21 | struct CGPoint _greenPrimary; 22 | struct CGPoint _bluePrimary; 23 | struct CGPoint _whitePoint; 24 | NSObject *_queue; 25 | CDUnknownBlockType _terminationHandler; 26 | void *_client; 27 | unsigned int _displayID; 28 | unsigned int _hiDPI; 29 | NSArray *_modes; 30 | unsigned int _serverRPC_port; 31 | unsigned int _proxyRPC_port; 32 | unsigned int _clientHandler_port; 33 | } 34 | 35 | @property(readonly, nonatomic) NSArray *modes; // @synthesize modes=_modes; 36 | @property(readonly, nonatomic) unsigned int hiDPI; // @synthesize hiDPI=_hiDPI; 37 | @property(readonly, nonatomic) unsigned int displayID; // @synthesize displayID=_displayID; 38 | @property(readonly, nonatomic) CDUnknownBlockType terminationHandler; // @synthesize terminationHandler=_terminationHandler; 39 | @property(readonly, nonatomic) NSObject *queue; // @synthesize queue=_queue; 40 | @property(readonly, nonatomic) struct CGPoint whitePoint; // @synthesize whitePoint=_whitePoint; 41 | @property(readonly, nonatomic) struct CGPoint bluePrimary; // @synthesize bluePrimary=_bluePrimary; 42 | @property(readonly, nonatomic) struct CGPoint greenPrimary; // @synthesize greenPrimary=_greenPrimary; 43 | @property(readonly, nonatomic) struct CGPoint redPrimary; // @synthesize redPrimary=_redPrimary; 44 | @property(readonly, nonatomic) unsigned int maxPixelsHigh; // @synthesize maxPixelsHigh=_maxPixelsHigh; 45 | @property(readonly, nonatomic) unsigned int maxPixelsWide; // @synthesize maxPixelsWide=_maxPixelsWide; 46 | @property(readonly, nonatomic) struct CGSize sizeInMillimeters; // @synthesize sizeInMillimeters=_sizeInMillimeters; 47 | @property(readonly, nonatomic) NSString *name; // @synthesize name=_name; 48 | @property(readonly, nonatomic) unsigned int serialNum; // @synthesize serialNum=_serialNum; 49 | @property(readonly, nonatomic) unsigned int productID; // @synthesize productID=_productID; 50 | @property(readonly, nonatomic) unsigned int vendorID; // @synthesize vendorID=_vendorID; 51 | - (BOOL)applySettings:(id)arg1; 52 | - (void)dealloc; 53 | - (id)initWithDescriptor:(id)arg1; 54 | 55 | @end 56 | 57 | -------------------------------------------------------------------------------- /include/original-dump/CGVirtualDisplayDescriptor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSObject, NSString; 10 | 11 | @interface CGVirtualDisplayDescriptor : NSObject 12 | { 13 | unsigned int _vendorID; 14 | unsigned int _productID; 15 | unsigned int _serialNum; 16 | NSString *_name; 17 | struct CGSize _sizeInMillimeters; 18 | unsigned int _maxPixelsWide; 19 | unsigned int _maxPixelsHigh; 20 | struct CGPoint _redPrimary; 21 | struct CGPoint _greenPrimary; 22 | struct CGPoint _bluePrimary; 23 | struct CGPoint _whitePoint; 24 | NSObject *_queue; 25 | CDUnknownBlockType _terminationHandler; 26 | } 27 | 28 | @property(retain, nonatomic) NSObject *queue; // @synthesize queue=_queue; 29 | @property(retain, nonatomic) NSString *name; // @synthesize name=_name; 30 | @property(nonatomic) struct CGPoint whitePoint; // @synthesize whitePoint=_whitePoint; 31 | @property(nonatomic) struct CGPoint bluePrimary; // @synthesize bluePrimary=_bluePrimary; 32 | @property(nonatomic) struct CGPoint greenPrimary; // @synthesize greenPrimary=_greenPrimary; 33 | @property(nonatomic) struct CGPoint redPrimary; // @synthesize redPrimary=_redPrimary; 34 | @property(nonatomic) unsigned int maxPixelsHigh; // @synthesize maxPixelsHigh=_maxPixelsHigh; 35 | @property(nonatomic) unsigned int maxPixelsWide; // @synthesize maxPixelsWide=_maxPixelsWide; 36 | @property(nonatomic) struct CGSize sizeInMillimeters; // @synthesize sizeInMillimeters=_sizeInMillimeters; 37 | @property(nonatomic) unsigned int serialNum; // @synthesize serialNum=_serialNum; 38 | @property(nonatomic) unsigned int productID; // @synthesize productID=_productID; 39 | @property(nonatomic) unsigned int vendorID; // @synthesize vendorID=_vendorID; 40 | - (void)dealloc; 41 | - (id)init; 42 | @property(copy, nonatomic) CDUnknownBlockType terminationHandler; 43 | - (id)dispatchQueue; 44 | - (void)setDispatchQueue:(id)arg1; 45 | 46 | @end 47 | 48 | -------------------------------------------------------------------------------- /include/original-dump/CGVirtualDisplayMode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @interface CGVirtualDisplayMode : NSObject 10 | { 11 | unsigned int _width; 12 | unsigned int _height; 13 | double _refreshRate; 14 | } 15 | 16 | @property(readonly, nonatomic) double refreshRate; // @synthesize refreshRate=_refreshRate; 17 | @property(readonly, nonatomic) unsigned int height; // @synthesize height=_height; 18 | @property(readonly, nonatomic) unsigned int width; // @synthesize width=_width; 19 | - (id)initWithWidth:(unsigned int)arg1 height:(unsigned int)arg2 refreshRate:(double)arg3; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /include/original-dump/CGVirtualDisplaySettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSArray; 10 | 11 | @interface CGVirtualDisplaySettings : NSObject 12 | { 13 | NSArray *_modes; 14 | unsigned int _hiDPI; 15 | } 16 | 17 | @property(nonatomic) unsigned int hiDPI; // @synthesize hiDPI=_hiDPI; 18 | - (void)dealloc; 19 | - (id)init; 20 | @property(retain, nonatomic) NSArray *modes; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /include/original-dump/README.txt: -------------------------------------------------------------------------------- 1 | These are from 2 | https://github.com/w0lfschild/macOS_headers/tree/master/macOS/Frameworks/CoreGraphics/1348/ 3 | 4 | Copies, slightly modified to actually compile, are in the parent 5 | directory. 6 | --------------------------------------------------------------------------------