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

Reset display brightness to 0 #15

Open
VampireSilence opened this issue Apr 8, 2023 · 3 comments
Open

Reset display brightness to 0 #15

VampireSilence opened this issue Apr 8, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@VampireSilence
Copy link

VampireSilence commented Apr 8, 2023

I'd appreciate it if dmon also constantly reset the display brightness to 0. Some devices keep bugging me with that.

#import <UIKit/UIKit.h>

int dimDisplayBrightness (void)
{
    @autoreleasepool
    {
        UIScreen *mainScreen = [UIScreen mainScreen];
        mainScreen.brightness = 0.0f;
    }
    return 0;
}
@clburlison
Copy link
Owner

Really like this idea. Will likely get this added in the next release.

@clburlison clburlison added the enhancement New feature or request label Apr 9, 2023
@clburlison
Copy link
Owner

I played with this over the weekend and couldn't get it to work. Since dmon isn't a UI application this might need to be moved into a tweak of some kind.

@VampireSilence
Copy link
Author

VampireSilence commented Apr 17, 2023

True, i didn't consider that. But IOKit should be available in a background daemon, so we could try something like that:

#include <stdio.h>
#include <IOKit/graphics/IOGraphicsLib.h>

int dimDisplayBrightness (void)
{
    io_service_t displayWrangler = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IODisplayWrangler"));

    if (displayWrangler != IO_OBJECT_NULL)
    {
        IODisplaySetFloatParameter(displayWrangler, kNilOptions, CFSTR(kIODisplayBrightnessKey), 0.0f);
        IOObjectRelease(displayWrangler);
    }

    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants