Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Review] Update hs.screen:name for M1 macs #2676

Merged
merged 2 commits into from Feb 14, 2021

Conversation

asmagill
Copy link
Member

@asmagill asmagill commented Feb 9, 2021

Uses NSScreen's localizedName attribute introduced in 10.15

Addresses #2663

Apparently M1 macs no longer use IOKit for maintaining display information which means IODisplay* no longer provides useful information on these machines. This change to the macOS will likely also result in hs.screen:get/setBrightness and hs.brightness to be useless... At present I am not aware of any promising leads for a work-around.

@asmagill
Copy link
Member Author

asmagill commented Feb 9, 2021

Tested against M1 MacBook Pro running 11.2 and iMac running 10.15 (which should use new method as well as it's 10.15 -- but I can confirm on my machine the names match the ones returned by the previous code). A test against 10.14 would be appreciated, if anyone running development builds still uses it.

@cmsj
Copy link
Member

cmsj commented Feb 9, 2021

Great find! I suspect we may have to just mark the brightness calls as unavailable on M1 macs, and hope that Apple gives us some API in the future.

@latenitefilms
Copy link
Contributor

Tested on macOS 10.14.6:

> for _, screen in pairs(hs.screen.allScreens()) do
	hs.printf("name: %s", screen:name())
end
2021-02-10 17:57:24: -- Loading extension: screen
2021-02-10 17:57:24: name: LG UltraFine
2021-02-10 17:57:24: name: Color LCD

@cmsj
Copy link
Member

cmsj commented Feb 10, 2021

@asmagill FYI, CI should be fully fixed now, so if you want to get results, rebase your PRs onto master and re-push them 👍

@cmsj cmsj merged commit a74db19 into Hammerspoon:master Feb 14, 2021
@github-actions
Copy link

Unit Test Results

    1 files    25 suites   2m 48s ⏱️
315 tests 315 ✔️ 0 💤 0 ❌

Results for commit a74db19.

@dcai dcai mentioned this pull request Feb 21, 2021
@asmagill asmagill deleted the screenName branch March 4, 2021 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants