It is currently December 3rd, 2020, 10:33 am

A screen brightness plugin

Share and get help with Plugins and Addons
FlyingHyrax
Posts: 251
Joined: July 1st, 2011, 1:32 am
Location: US

A screen brightness plugin

Post by FlyingHyrax »

Using the console app from here as a starting point, I took a crack at making a simple screen brightness plugin.

https://github.com/FlyingHyrax/rm-brightness-plugin

Nothing especially cool happening - no threading, child measures, or even options. It just returns the current brightness level and there are some bangs to increase/decrease/set the brightness. (Heck, the entire .cs file including the plugin SDK interface class is < 350 loc.)

The WMI class it uses is only in Windows Vista or later, and obviously it needs a screen with brightness levels. I have not yet tested this with multiple monitors, e.g. having a laptop with brightness control plugged into a desktop monitor without it. As-is it probably wouldn't work but at least shouldn't crash. (Should find out relatively soon.)

Check out the Readme for a bit more documentation, and Releases for debug .dlls.

Edit
  • See exper1mental's first reply for a better example skin
  • cfixd has written a more complete plugin that can also set the brightness of desktop monitors: viewtopic.php?p=103782#p103782
You do not have the required permissions to view the files attached to this post.
Last edited by FlyingHyrax on December 3rd, 2014, 3:36 pm, edited 1 time in total.
Flying Hyrax on DeviantArt
User avatar
exper1mental
Posts: 284
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: A screen brightness plugin

Post by exper1mental »

Nice! I've been looking for a way to control screen brightness for one of my skins, this might just do the trick.

EDIT:
I modified your skin because it felt sluggish and unresponsive (I was relived it wasn't the plugin though).
ScreenBrightnessModNoPlugin.rmskin
Works without a problem on dual monitor Windows 8.1 Pro 64-bit. Only affects (primary) laptop monitor (which I'm guessing is what it is supposed to do).

I did encounter one bug though, it can only reduce screen brightness to 20%, not 0%.
You do not have the required permissions to view the files attached to this post.
Image
FlyingHyrax
Posts: 251
Joined: July 1st, 2011, 1:32 am
Location: US

Re: A screen brightness plugin

Post by FlyingHyrax »

exper1mental wrote: Works without a problem on dual monitor Windows 8.1 Pro 64-bit. Only affects (primary) laptop monitor (which I'm guessing is what it is supposed to do).
Excellent! The behavior may be different if you switched the primary display to the second monitor, but that's easy to test.
exper1mental wrote: I did encounter one bug though, it can only reduce screen brightness to 20%, not 0%.
The plugin actually queries WMI for an array of brightness levels supported by the monitor, and sets the brightness to the closest level it can find to the number you give it. This may be what is causing that. Can you normally set your brightness to 0% using hotkeys/control panel?

In my case, my laptop screen actually has more levels when using Linux then in Windows, so I suppose it is determined by a driver somehow. I haven't tried just setting the brightness to an arbitrary level, but I will.
Flying Hyrax on DeviantArt
User avatar
exper1mental
Posts: 284
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: A screen brightness plugin

Post by exper1mental »

FlyingHyrax wrote:Excellent! The behavior may be different if you switched the primary display to the second monitor, but that's easy to test.
Still only affect laptop monitor.
FlyingHyrax wrote:The plugin actually queries WMI for an array of brightness levels supported by the monitor, and sets the brightness to the closest level it can find to the number you give it. This may be what is causing that. Can you normally set your brightness to 0% using hotkeys/control panel?

In my case, my laptop screen actually has more levels when using Linux then in Windows, so I suppose it is determined by a driver somehow. I haven't tried just setting the brightness to an arbitrary level, but I will.
Yes, it goes all the way between 0% and 100% using either.

EDIT: I think I figured out what might be going on. Once it gets to 20% the monitor stops getting darker, even though I can set it to 10% and 0%.
Image