It is currently April 19th, 2024, 12:33 pm

A screen brightness plugin

Share and get help with Plugins and Addons
FlyingHyrax
Posts: 232
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: 269
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: 232
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: 269
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
ashutosh.02
Posts: 3
Joined: November 14th, 2022, 6:07 pm

Re: A screen brightness plugin

Post by ashutosh.02 »

exper1mental wrote: May 27th, 2014, 5:05 pm 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%.
Hi, can you please help me change the color of the Bar from Green to any other color?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: A screen brightness plugin

Post by eclectic-tech »

ashutosh.02 wrote: March 31st, 2023, 5:06 am Hi, can you please help me change the color of the Bar from Green to any other color?
The default bar color is green. See Docs: Bar Meter
To change it to another color, as an example RED, add BarColor=128,0,0 to [meterBar] section, or change the 3 values to the right of the equal sign to your desired RGB value.

Code: Select all

[meterBar]
 Meter=Bar
 MeasureName=measureBrightness
 BarOrientation=Horizontal
 BarColor=128,0,0
 X=r
 Y=r
 W=140
 H=10
ashutosh.02
Posts: 3
Joined: November 14th, 2022, 6:07 pm

Re: A screen brightness plugin

Post by ashutosh.02 »

eclectic-tech wrote: March 31st, 2023, 11:55 am The default bar color is green. See Docs: Bar Meter
To change it to another color, as an example RED, add BarColor=128,0,0 to [meterBar] section, or change the 3 values to the right of the equal sign to your desired RGB value.

Code: Select all

[meterBar]
 Meter=Bar
 MeasureName=measureBrightness
 BarOrientation=Horizontal
 BarColor=128,0,0
 X=r
 Y=r
 W=140
 H=10
THANKS A LOT, I will try it out. Earlier I was using backlight plugin to adjust screen brightness; it was working without any issue but to then I had to re-install my windows then for some reason it stopped working. The plugin used in this skin is working properly. Any idea why backlight plugin stopped working?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: A screen brightness plugin

Post by eclectic-tech »

ashutosh.02 wrote: March 31st, 2023, 9:42 pm THANKS A LOT, I will try it out. Earlier I was using backlight plugin to adjust screen brightness; it was working without any issue but to then I had to re-install my windows then for some reason it stopped working. The plugin used in this skin is working properly. Any idea why backlight plugin stopped working?
Sorry, I don't use this plugin (I'm on a desktop PC), so I can't really test any of it's functions.