Native display brightness mac os
A Mac app to control the brightness of external displays using keyboard shortcuts.
ExternalDisplayBrightness is a small utility which allows you to change the brightness of external displays connected to your Mac using keyboard shortcuts, just as you would change the brightness of the built-in display on a Macbook.
This is a small summer project which I did to get some practice with developing Mac apps. There are a bunch of similar projects available, but they feel hard to use and are cluttered with too many options. I wanted to make something simple which would Just Work™ and you could forget it’s even there.
ExternalDisplayBrightness supports macOS 10.13 High Sierra and higher.
To install, download the latest DMG release, open it and drag ExternalDisplayBrightness.app to your Applications folder.
During the first launch, the app will request permission to use accessibility services on your Mac to listen for keyboard shortcuts. Grant the permission and relaunch the app for the change to take effect.
The app runs as a hidden agent app, silently listening for keyboard shortcuts. To access the preferences, simply launch the app again using Launchpad or any other method, and the preferences window will open. The app keeps listening for keyboard shortcuts when you close the preferences window. To completely quit the app, use the Quit button in the window.
You can customize the keyboard shortcuts for the brightness actions to any of the F1 — F20 keys or the brightness keys on the Magic Keyboard (listed as MK_BDN and MK_BUP in the preferences). By default the application takes over the default brightness keys on a Mac keyboard, which are mapped to F14 and F15, respectively. When pressing the keyboard shortcut in combination with Option + Shift, the brightness changes in smaller increments, just like on a real Mac.
There is also an option to control the brightness of all connected displays simultaneously, by default triggered by using the keyboard shortcut in combination with the Command modifier. This behavior is also customizable in the app’s preferences.
ExternalDisplayBrightness uses the DDC/CI standard commands to control the brightness of external displays. For the app to work, your display needs to support the DDC/CI standard properly. Most displays do, but there are some issues with Samsung displays (and possibly others), which do not implement the standard correctly. Unfortunately, there is not much that can be done to remedy the situation.
There are some issues with certain Mac models which freeze when attempting to read the current brightness of the external display. Because of that, reading the initial brightness of the display is disabled by default, and when changing the brightness of a display for the first time, its initial brightness is set to 50%. You can enable reading the brightness from the display in the app’s preferences, but do so at your own risk.
Additionally, it seems the HDMI port on the 2018 Mac Mini does not work with the DDC/CI interface. Using an USB-C to HDMI adapter should work fine, though.
The utility is a standard Xcode & Swift project without any external dependencies. You can just download/clone the repository and open src/ExternalDisplayBrightness.xcodeproj to start making changes.
The whole project is written in Swift 4.2, without using any Objective-C bridging headers.
Quirks and perks
Due to the way the utility listens for global keyboard shortcuts (using CGEvents, to be able to consume them), it has to use Accessibility Services, and due to the way the app manages its login item (through Launch Services), App Sandbox can’t be enabled. This means the app can’t be released on the Mac App Store, at least for now.
There are several things you might find useful or interesting when poking through the code. DDC.swift contains a simple Swift implementation of sending DDC/CI commands over I2C to a connected display. Feel free to use it in any of your projects, I hope it will be helpful to someone.
LoginItemManager.swift contains an implementation of a login item manager for the app. There is a bunch of login item managers available already, I implemented it in a way that you can bind the property isEnabled of the manager to a checkbox in Interface Builder through the included value transformer LoginItemCheckboxTransformer. Unfortunately, Apple deprecated the APIs to access the login item list starting from Sierra, without offering any real alternative. I hope these will keep working for at least a few more years, but eventually this will need to be rewritten to utilize the Service Management Framework, which will have the side effect of not showing the login item in System Preferences.
BrightnessManager.swift contains an implementation of a manager of the brightness of the connected displays. The brightness of external displays is controlled through the aforementioned DDC/CI commands, the brightness of internal displays is controlled through some undocumented and private APIs in DisplayServices and CoreDisplay which might break at any time. Before Sierra, the internal display brightness could be changed through IOKit, but after the introduction of Night Shift in 10.12.4 something changed and the brightness changes don’t stick anymore. This is one of the reasons the app works only on High Sierra and higher, because the new CoreDisplay APIs weren’t around in 10.12.3 and lower, and I didn’t want to complicate the brightness changing logic too much. The native popup with the brightness bars is displayed through some more private undocumented APIs, this time of the OSD framework. You might find the code to load these private frameworks through CFBundle and NSBundle useful, it took me a while to figure out how to get the function pointers relatively safely, so maybe this will help you get there faster.
- Project homepage
- Project repository
- related projects
- ddcctl by kfix — a command line tool to control external monitors
The code in this project is licensed under the MIT license. Everybody is welcome to use, change and modify the project as they see fit.
Источник
Native display brightness mac os
Bensge released this Mar 1, 2017
This release fixes a bug that caused the beep sound to be played on key presses, which was caused by fixes in the last release.
The old installation instructions still apply:
IMPORTANT:
After launching the app, make sure you allow the assistive permissions in the system preferences (there should be an alert). Afterwards, kill the program with the Activity Monitor app and restart it. Then it should work 👍
Bensge released this Feb 28, 2017
This release fixes a freeze bug on shutdown and fixes interference with Dock.app’s auto-hide feature.
The old installation instructions still apply:
IMPORTANT:
After launching the app, make sure you allow the assistive permissions in the system preferences (there should be an alert). Afterwards, kill the program with the Activity Monitor app and restart it. Then it should work 👍
Bensge released this Jan 14, 2017
This release (hopefully) fixes preferences saving and restoration. The brightness value should now be remembered after a restart.
The old installation instructions still apply:
IMPORTANT:
After launching the app, make sure you allow the assistive permissions in the system preferences (there should be an alert). Afterwards, kill the program with the Activity Monitor app and restart it. Then it should work 👍
Источник
Native display brightness mac os
MonitorControl — Now with Apple Silicon support
Control your external display brightness and volume
Use menulet sliders or the native Apple keyboard keys
Behaves like native, with (optional) brightness & volume OSD
Go to Releases and download the latest .dmg
MonitorControl version | macOS version |
---|---|
v4.0.0 | Catalina 10.15* |
v3.1.1 | Mojave 10.14 |
v2.1.0 | Sierra 10.12 |
* With some limitations — full functionality available on macOS 11 Big Sur or newer.
Open issues if you have a question, an enhancement to suggest or a bug you’ve found. If you want you can fork the code yourself and submit a pull request to improve the app.
MonitorControl supports localization. We gladly welcome your contribution with a new language! See the opening post of the relevant discussion on how to add your translation!
- Xcode
- Swiftlint
- SwiftFormat
- BartyCrouch (for updating localizations)
Clone the project via this Terminal command:
If you want to clone one of the branches, add —single-branch —branch [branchname] after the clone option.
You’re all set ! Now open the MonitorControl.xcodeproj with Xcode! The dependencies will automatically get downloaded once you open the project. If they don’t:
File > Packages > Resolve Package Versions
Third party dependencies
- @mathew-kurian (original developer)
- @Tyilo (fork)
- @Bensge — (used some code from his project NativeDisplayBrightness)
- @nhurden (for the original MediaKeyTap)
- @kfix (for ddcctl)
- @reitermarkus (for DDC.Swift)
- @zhuowei (figured out M1 I²C communication)
- @tao-j (figured out M1 I²C write)
- @alin23 (generally spearheaded M1 DDC support and figured out a many of the caveats)
- javierocasio (app icon background)
About
🖥 Control your external monitor brightness & volume on your Mac
Источник
Native display brightness mac os
Command-line display brightness control for macOS.
This tool enables you to set and obtain the brightness level of all internal and certain external displays from the command line or a script.
If you cannot control your display’s brightness from Displays System Preferences, you will not be able to do it with brightness. See this issue for more information and some potential other options. |
---|
Install with Homebrew
brew install brightness
Install From Source
macOS Version Support
brightness requires OS X/macOS 10.8 or later — but go back in the commit history and you’ll find code compatible with older (Mac) OS X versions.
Through macOS 10.12.3, brightness uses documented APIs. It works on internal laptop displays. It doesn’t work on older Apple external LCDs which connect via DVI and USB. I don’t know if it works on newer external displays, such as Thunderbolt displays, because I don’t have any to test with. (Feedback welcome.)
As of macOS 10.12.4 with the introduction of Night Shift, the documented APIs fail to work correctly and Apple does not provide replacement APIs. Therefore, brightness uses an undocumented method to adjust brightness.
macOS 11 on M1/Apple Silicon Macs require yet another undocumented method to adjust brightness (thanks to @jtbandes).
Set 100% brightness: brightness 1
Set 50% brightness: brightness 0.5
Show current brightness: brightness -l
About
Command-line display brightness control for macOS.
Источник
Brightness Slider 4+
ACT Productions
Screenshots
Description
With Brightness Slider you can adjust screen brightness from the menu
bar, just like the sound menu provided by Apple, and with improved
control over the dimming process.
Using a keyboard with no brightness keys? Tired of low brightness
levels which are still too bright? Brightness Slider gives you total
control over your screen’s brightness settings, allowing in
particular for a really smooth transition between low light and total
darkness.
Features:
— Screen brightness level adjustment right from the menu bar
— Dimming control at low brightness levels
— Arrow key function with active Brightness Slider menu
— Custom hotkeys for lowering and raising brightness levels
— Start at login option available in the preferences
How Brightness Slider works:
Brightness Slider darkens your display by combining two separate
methods. Method A adjusts the real backlight intensity of your
display and method B creates a semi-transparent black veil above
everything else. Why the complexity? Well, when dimming a display,
the final jump down to no backlight at all is very large, especially
in a darkened room. To provide more control over the dimming process,
the top-half of the slider controls the backlight intensity from 1
down to 0.1 (method A). Then, the bottom-half controls the opacity of
the semi-transparent veil, whilst keeping the backlight at 0.1
(method B). When the slider is at zero, the backlight is turned off.
The result is that the final jump now has several intermediate steps,
which means the perceived brightness (the combined result of both
methods) is that much more adjustable.
One last thing:
There are displays where Brightness Slider cannot control backlight
intensity. However, it can still perceptually dim the screen by
controlling the opacity of the semi-transparent veil (which can be
created on any display).
Источник