Skip to content

Cannot change the brightness of main display  #26

Description

@Pratham-commits-code
def setBrightness(self, brightness):
    """
    :param brightness: The desired brightness, from 0 to 1.
    """
    error = iokit["IODisplaySetFloatParameter"](self.__servicePort, 0, iokit["kDisplayBrightness"], brightness)
    if error:
        if self.isMain:
            raise DisplayError("Cannot manage brightness on display \"{}\"".format(self.tag))
        else:
            raise DisplayError(
                "Display \"{}\"\'s brightness cannot be set.\n"
                "External displays may not be compatible with Display Manager. "
                "Try setting manually on device hardware.".format(self.tag))

I wanted to use this code for my project as I am unable to find a way to change the macos brightness from python and this library is one caught my eye but it clearly doesnt support changing main display brightness , or I am just understanding it wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions