Screen Brightness Slider

Moderator: Forum moderators

Post Reply
User avatar
stemsee
Posts: 779
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 131 times

Screen Brightness Slider

Post by stemsee »

Control your screen brightness with this handy high resolution yad slider. Press escape to close slider, while it has focus.
screen_brightness.png
screen_brightness.png (7.68 KiB) Viewed 4784 times

Code: Select all

#!/bin/sh
# by stemsee
BRAND=$(ls /sys/class/backlight/ | grep _backlight)
yad --title="Brightness $BRAND" --height=400 --width=40 \
--no-buttons --on-top --vertical --scale \
--print-partial --min-value=0 --max-value=$(cat /sys/class/backlight/"$BRAND"/max_brightness) --step=1 --value=$(cat /sys/class/backlight/"$BRAND"/brightness) | while read line; do echo "$line" > /sys/class/backlight/"$BRAND"/brightness; sleep 0.01; done &
Last edited by stemsee on Sat Sep 12, 2020 7:35 am, edited 4 times in total.
User avatar
bigpup
Moderator
Posts: 6971
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 898 times
Been thanked: 1520 times

Re: Screen Brightness Slider

Post by bigpup »

Here is the script file you can click on to run.

Had to add .zip to file name, so it would attach.
Remove .zip from name.
Right click on file.
Select properties.
Give exec permission.
So you can click on it, to run.

Made the window a little wider to be able to see the window minimize, size, and close.
.
brightness.zip
Remove .zip from name.
Had to put .zip on name so file would attach.
(428 Bytes) Downloaded 697 times
Last edited by bigpup on Sun Sep 27, 2020 1:29 am, edited 3 times in total.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 6971
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 898 times
Been thanked: 1520 times

Re: Screen Brightness Slider

Post by bigpup »

I changed the code for my likes.
Made width 200
Changed title to Brightness.

My slider looks like this.
Screenshot.jpg
Screenshot.jpg (8.81 KiB) Viewed 4771 times

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
stemsee
Posts: 779
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 131 times

Re: Screen Brightness Slider

Post by stemsee »

Hey bigpup it looks good.

Whats the max brightness value for your hardware?
User avatar
bigpup
Moderator
Posts: 6971
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 898 times
Been thanked: 1520 times

Re: Screen Brightness Slider

Post by bigpup »

My hardware max brightness:
7812

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
stemsee
Posts: 779
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 131 times

Re: Screen Brightness Slider

Post by stemsee »

mine is 1500 ... yours must be like a headlight!
Philh
Posts: 30
Joined: Sun Aug 16, 2020 1:50 pm
Been thanked: 7 times

Re: Screen Brightness Slider

Post by Philh »

On my hp laptop
ls /sys/class/backlight/ gives radeon_bl0
So I had to remove the pipe and grep to make it work.
User avatar
mikewalsh
Moderator
Posts: 6139
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1971 times

Re: Screen Brightness Slider

Post by mikewalsh »

Fred & I messed about with a whole bunch of ideas in this vein a couple of years ago, after johnywhy published his YAD-powered brightness slider:-

https://oldforum.puppylinux.com/viewtopic.php?t=114229

I wanted to do this with my AMD-powered desktop, but had no /sys/class/backlight directory or files to make use of. So, I cast around for another method of making this happen.....and ended up using xrandr instead.

I'm not going into details; you can follow the thread for yourselves if you're interested:-

https://oldforum.puppylinux.com/viewtopic.php?t=114229

The eventual outcome led to Fred building his self-extracting script for a lightweight, Puppy version of RedShift. Along the way, we played around with the idea of using a tiny little binary called sct.....a command-line utility for setting the "red" tint for your screen.

The attached are recently updated versions for that release of ScreenControl - v1.4, making use of Fred's code for an xrandr slider, and another one for setting screen tint with sct. I've modded them to include a right-click 'Quit' function for the tray icon, and a MenuEntry under Menu->Desktop to put it back again (you may not want this thing permanently in the tray. Just covering all the bases here..!)

A later version made use of a CLI version of "redshift" rather than "sct", and merged the two sliders into one. Personally, I rather like the offset between the two sliders, with the way one superimposes on the other.....but that's just me.

The GIF below demonstrates its usage. I had hoped the GIF would also show the adjustments actually happening, but unfortunately brightness & tint adjustment don't translate through any form of screen-capture... (*shrug*)

Trust me, it DOES work..!

Image

Pets are attached below. Different arches, only because of the minute sct binary.

Enjoy.

Mike. ;)

Attachments
ScreenControl-v1.4-i686.pet
32-bit ScreenControl .pet...
(28.36 KiB) Downloaded 242 times
ScreenControl-v1.4-amd64.pet
64-bit ScreenControl .pet...
(28.56 KiB) Downloaded 323 times
User avatar
mikewalsh
Moderator
Posts: 6139
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1971 times

Re: Screen Brightness Slider

Post by mikewalsh »

I've just updated a slightly different, earlier version of the above tool.

This one has the brightness slider, but instead of using a slider to control the tint level, it merely implements your preferred day-time/night-time level of "sct" directly by means of "Night" or "Day" buttons. Instructions for how to change these levels are included via the "Info" button (very simple to do).


Image


Pets for both arches are attached below. Enjoy.


Mike. ;)
Attachments
BSTC4desktop-amd64.pet
64-bit version...
(29.14 KiB) Downloaded 195 times
BSTC4desktop-i686.pet
32-bit version...
(28.92 KiB) Downloaded 131 times
User avatar
fredx181
Posts: 3043
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 370 times
Been thanked: 1295 times
Contact:

Re: Screen Brightness Slider

Post by fredx181 »

Here's ScreenControl_redshift-v1.4-noarch.pet from Mike Walsh, earlier shared Here, it depends on redshift , can be installed from PPM or install attached pet.

What I like about it is that brightness and color temp setting doesn't influence each other.

Fred
Attachments
Screencontrol, brightness and colot
Screencontrol, brightness and colot
2020-08-19-235254_498x230_scrot.png (109.32 KiB) Viewed 4584 times
ScreenControl_redshift-v1.4-noarch.pet
Dual-slider ScreenControl utility, v1.4 - noarch (needs redshift command-line utility installed from PPM)
(24.89 KiB) Downloaded 200 times
redshift_cli-v1.7-i686.pet
32-bit redshift 'backend' package (for older Pups where you can't obtain it from the PPM)
(106.04 KiB) Downloaded 153 times
User avatar
vovchik
Posts: 12
Joined: Sun Jul 12, 2020 9:56 pm
Been thanked: 7 times

Re: Screen Brightness Slider

Post by vovchik »

Dear Fred and Mike,

Thanks. What about this svg as an icon (smaller than the png)?

With kind regards,
vovchik
Attachments
semicircle2a.svg_20200820.tar.gz
(597 Bytes) Downloaded 72 times
User avatar
mikewalsh
Moderator
Posts: 6139
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1971 times

Re: Screen Brightness Slider

Post by mikewalsh »

vovchik wrote: Wed Aug 19, 2020 10:54 pm Dear Fred and Mike,

Thanks. What about this svg as an icon (smaller than the png)?

With kind regards,
vovchik
@vovchik :-

Mmm..!! Yeah, I like that. :thumbup:

Mine got built in my favourite photo/graphics editor, Mooitech's PhotoScape, running under WINE. But.....it kinda got "thrown" together, ya know? :lol:

I work with PNG images a lot. I like 'em because of the transparency layer built-in to the PNG specs. I'll be honest, I've never really got the hang of working with SVG images, despite that there's a ton of vector editors out there.

As to the size aspect, well; that's probably down to the fact that I mostly work with images downloaded from web-searches. I often modify the hell out of 'em, but you can't get really good detail out of a PNG image without bumping up the size somewhat.....

Tell you what. Could you make the left half of this somewhat darker, while still keeping that slight 'sheen' to it? That would be awesome!


Mike. ;)
Last edited by mikewalsh on Tue Sep 29, 2020 10:05 am, edited 1 time in total.
User avatar
vovchik
Posts: 12
Joined: Sun Jul 12, 2020 9:56 pm
Been thanked: 7 times

Re: Screen Brightness Slider

Post by vovchik »

Dear Mike,

How about this???

With kind regards,
vovchik

PS. I didn't use a a graphic editor - just geany - and did it "by hand". SVG syntax is pretty simple. Technosaurus had posted quite a few useful examples on the old forum. Just have a look and you will get how to create SVGs quickly. The nice thing is that they scale without losing detail and, oftentimes, are tiny. I often use potrace to get the vector outline of an object and then subject that object to a few modifications (gradients, geometric transforms, clipping). It is even possible to include base64 encoded png/jpg bits inside an svg, which makes it possible to have the SVG-wrapped png included in a script.
Attachments
semicircle2b.svg_20200820.tar.gz
(599 Bytes) Downloaded 64 times
User avatar
puddlemoon
Posts: 189
Joined: Sun Sep 06, 2020 9:26 pm
Location: In between
Has thanked: 89 times
Been thanked: 64 times

Re: Screen Brightness Slider

Post by puddlemoon »

Just what I needed!
both the tool and a reason to try playing with yad.
made a few tweaks(under mouse, timeout etc..) and it works quite well as a dock button. I prefer the lcd adjustments to the gamma so this is perfect.
brightness.jpg
brightness.jpg (9.75 KiB) Viewed 2243 times
#!/bin/sh
# by stemsee
BRAND=$(ls /sys/class/backlight/ | grep _backlight)
yad --title="Brightness $BRAND" --height=55 --width=333 \
--no-buttons --on-top --horizontal --mouse --scale --undecorated --timeout=5 \
--print-partial --min-value=0 --max-value=$(cat /sys/class/backlight/"$BRAND"/max_brightness) --step=10 --value=$(cat /sys/class/backlight/"$BRAND"/brightness) | while read line; do echo "$line" > /sys/class/backlight/"$BRAND"/brightness; sleep 0.01; done &
User avatar
deki20
Posts: 22
Joined: Sun Nov 15, 2020 7:21 pm
Location: Denmark
Has thanked: 2 times
Been thanked: 3 times

Re: Screen Brightness Slider

Post by deki20 »

Here is the script file you can click on to run.

Had to add .zip to file name, so it would attach.
Remove .zip from name.
Right click on file.
Select properties.
Give exec permission.
So you can click on it, to run.

Beautiful.

Thx man!

Lassar
Posts: 107
Joined: Mon Jan 18, 2021 12:59 am
Been thanked: 1 time

Re: Screen Brightness Slider

Post by Lassar »

Could some one create a screen control that include brightness, contrast, and color saturation control?

Would be great for watching videos on the internet.

User avatar
deki20
Posts: 22
Joined: Sun Nov 15, 2020 7:21 pm
Location: Denmark
Has thanked: 2 times
Been thanked: 3 times

Re: Screen Brightness Slider

Post by deki20 »

don't know if this works:

Not being able to do so directly in YouTube, I stream them through VLC player, and use the brightness control in that player.

Copy the YouTube video URL and paste into the VLC player's Media -> Open Network Stream network tab. As the video streams through VLC, you'll have all the graphics features associated with the player.

source: https://superuser.com/questions/250341/ ... on-the-fly

vlc has all those features.. brightness, saturation, contrast

(you can look for different solutions on several search engines, e.g. youtube adjust contrast. there must be something in the huge library)

Muzunduleno
Posts: 9
Joined: Mon Feb 15, 2021 7:11 pm
Has thanked: 2 times

Re: Screen Brightness Slider

Post by Muzunduleno »

Uau I'm looking for this . I've an Asus 1005
I will try
Thank you

johnywhy
Posts: 6
Joined: Fri Aug 18, 2023 9:17 pm
Has thanked: 2 times
Been thanked: 1 time

Re: Screen Brightness Slider

Post by johnywhy »

mikewalsh wrote: Tue Aug 18, 2020 8:45 pm

Fred & I messed about with a whole bunch of ideas in this vein a couple of years ago, after johnywhy published his YAD-powered brightness slider:-

https://oldforum.puppylinux.com/viewtopic.php?t=114229

The eventual outcome led to Fred building his self-extracting script for a lightweight, Puppy version of RedShift.

Hey Mike, thx for the credit! And great looking work you and Fred!

User avatar
mikewalsh
Moderator
Posts: 6139
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1971 times

Re: Screen Brightness Slider

Post by mikewalsh »

johnywhy wrote: Sun Aug 27, 2023 6:41 am
mikewalsh wrote: Tue Aug 18, 2020 8:45 pm

Fred & I messed about with a whole bunch of ideas in this vein a couple of years ago, after johnywhy published his YAD-powered brightness slider:-

https://oldforum.puppylinux.com/viewtopic.php?t=114229

The eventual outcome led to Fred building his self-extracting script for a lightweight, Puppy version of RedShift.

Hey Mike, thx for the credit! And great looking work you and Fred!

No worries, my son. I'd been 'toying' with the idea for some time, but it was your thread that finally got me off my backside, and with @fredx181 's invaluable assistance, eventually did something about it.

A whole bunch of different ideas ensued from that, so.....credit where credit's due, mate! :thumbup:

Mike. ;)

johnywhy
Posts: 6
Joined: Fri Aug 18, 2023 9:17 pm
Has thanked: 2 times
Been thanked: 1 time

Re: Screen Brightness Slider

Post by johnywhy »

On arch linux, i had to do the following:

Script
I had to remove an embedded sudo from my original script:

Code: Select all

...
	do echo "$BrNew" | sudo /usr/bin/tee ${BrPath}brightness
...

Changed the path for my AMD Lenovo box:

Code: Select all

...
BrPath='/sys/class/backlight/amdgpu_bl1/'
...

Final script:

Code: Select all

#!/bin/sh
BrPath='/sys/class/backlight/amdgpu_bl1/'
BrCur=`cat ${BrPath}brightness`
BrMax=`cat ${BrPath}max_brightness`
BrMin=$(( (BrMax + (100 - 1)) / 100))	# 100th max-brightness, rounded up to nearest integer
yad --scale --min-value $BrMin --max-value $BrMax --value $BrCur --print-partial --undecorated - --width 300 --fixed --sticky --mouse --on-top --escape-ok --no-buttons --hide-value --close-on-unfocus | while read BrNew 
	do echo "$BrNew" |  /usr/bin/tee ${BrPath}brightness
	done

Permissions
I also had make the following tweaks for a non-root user:

- udev rule: As described in my original thread. Here's the rule that works on my AMD Lenovo box:

Code: Select all

ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", RUN+="/bin/chgrp users /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"

- User group: Add the user account to users group (if not already). Users group has write permission to the brightness file by default, when arch is installed with archinstall (and maybe manual install too, not sure).

Code: Select all

gpasswd -a johny users

@mikewalsh If you have a chance, can you fix your link to my original post?
https://oldforum.puppylinux.com/viewtopic.php?t=114229

Cheers!

Last edited by johnywhy on Sun Aug 27, 2023 4:00 pm, edited 5 times in total.
User avatar
mikewalsh
Moderator
Posts: 6139
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1971 times

Re: Screen Brightness Slider

Post by mikewalsh »

johnywhy wrote: Sun Aug 27, 2023 2:41 pm

@mikewalsh If you have a chance, can you fix your link to my original post?
https://oldforum.puppylinux.com/viewtopic.php?t=114229

@johnywhy :-

No sooner said than done. I don't quite know what happened with that old link, but various tweaks HAVE been made to the forum/domain URLs over the last couple of years, and I honestly wouldn't have noticed these unless someone drew my attention to them... Anyways; all sorted.

Mike. ;)

Post Reply

Return to “Utilities”