Skip to content

Commit

Permalink
196 move white pixel behind notch on macbooks (#198)
Browse files Browse the repository at this point in the history
* move get xdr displays function to utils and extract isBuiltInScreen function

* move white pixel to horizontal center of screen when the pixel is on a built in screen

* bump version
  • Loading branch information
niklasr22 authored Jan 11, 2025
1 parent fc127a4 commit 3946cf0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
16 changes: 8 additions & 8 deletions BrightIntosh.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
CODE_SIGN_ENTITLEMENTS = BrightIntosh/BrightIntosh_SE.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 60;
CURRENT_PROJECT_VERSION = 61;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9K32WDUN2H;
Expand All @@ -419,7 +419,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.5.1;
MARKETING_VERSION = 3.6.0;
PRODUCT_BUNDLE_IDENTIFIER = de.brightintosh.app;
PRODUCT_NAME = BrightIntosh;
SDKROOT = auto;
Expand All @@ -444,7 +444,7 @@
CODE_SIGN_ENTITLEMENTS = BrightIntosh/BrightIntosh_SE.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 60;
CURRENT_PROJECT_VERSION = 61;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9K32WDUN2H;
Expand All @@ -471,7 +471,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.5.1;
MARKETING_VERSION = 3.6.0;
PRODUCT_BUNDLE_IDENTIFIER = de.brightintosh.app;
PRODUCT_NAME = BrightIntosh;
SDKROOT = auto;
Expand All @@ -494,7 +494,7 @@
CODE_SIGN_ENTITLEMENTS = BrightIntosh/BrightIntosh.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 60;
CURRENT_PROJECT_VERSION = 61;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9K32WDUN2H;
Expand All @@ -521,7 +521,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.5.1;
MARKETING_VERSION = 3.6.0;
PRODUCT_BUNDLE_IDENTIFIER = de.brightintosh.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand All @@ -545,7 +545,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 60;
CURRENT_PROJECT_VERSION = 61;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9K32WDUN2H;
Expand All @@ -572,7 +572,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.5.1;
MARKETING_VERSION = 3.6.0;
PRODUCT_BUNDLE_IDENTIFIER = de.brightintosh.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down
12 changes: 0 additions & 12 deletions BrightIntosh/BrightnessManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,3 @@ class BrightnessManager {
self.brightnessTechnique?.enable()
}
}

func getXDRDisplays() -> [NSScreen] {
var xdrScreens: [NSScreen] = []
for screen in NSScreen.screens {
let screenNumber = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")]
let displayId: CGDirectDisplayID = screenNumber as! CGDirectDisplayID
if ((CGDisplayIsBuiltin(displayId) != 0 && isDeviceSupported()) || (externalXdrDisplays.contains(screen.localizedName) && !Settings.shared.brightIntoshOnlyOnBuiltIn)) {
xdrScreens.append(screen)
}
}
return xdrScreens
}
3 changes: 3 additions & 0 deletions BrightIntosh/OverlayWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ final class OverlayWindowController: NSWindowController, NSWindowDelegate {

func getIdealPosition(screen: NSScreen) -> CGPoint {
var position = screen.frame.origin
if isBuiltInScreen(screen: screen) {
position.x += screen.frame.width / 2
}
position.y += screen.frame.height - 1
return position
}
Expand Down
18 changes: 17 additions & 1 deletion BrightIntosh/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@
// Created by Niklas Rousset on 01.01.24.
//

import Foundation
import IOKit
import StoreKit
import Cocoa

func getXDRDisplays() -> [NSScreen] {
var xdrScreens: [NSScreen] = []
for screen in NSScreen.screens {
if ((isBuiltInScreen(screen: screen) && isDeviceSupported()) || (externalXdrDisplays.contains(screen.localizedName) && !Settings.shared.brightIntoshOnlyOnBuiltIn)) {
xdrScreens.append(screen)
}
}
return xdrScreens
}

func isBuiltInScreen(screen: NSScreen) -> Bool {
let screenNumber = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")]
let displayId: CGDirectDisplayID = screenNumber as! CGDirectDisplayID
return CGDisplayIsBuiltin(displayId) != 0
}

func getModelIdentifier() -> String? {
let service = IOServiceGetMatchingService(
Expand Down

0 comments on commit 3946cf0

Please sign in to comment.