Page 1 of 1
Screen Brightness Slider
Posted: Fri Aug 07, 2020 10:47 am
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 (7.68 KiB) Viewed 4894 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 &
Re: Screen Brightness Slider
Posted: Fri Aug 07, 2020 2:02 pm
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 706 times
Re: Screen Brightness Slider
Posted: Fri Aug 07, 2020 3:04 pm
by bigpup
I changed the code for my likes.
Made width 200
Changed title to Brightness.
My slider looks like this.
- Screenshot.jpg (8.81 KiB) Viewed 4881 times
Re: Screen Brightness Slider
Posted: Sat Aug 15, 2020 8:41 pm
by stemsee
Hey bigpup it looks good.
Whats the max brightness value for your hardware?
Re: Screen Brightness Slider
Posted: Mon Aug 17, 2020 10:12 am
by bigpup
My hardware max brightness:
7812
Re: Screen Brightness Slider
Posted: Mon Aug 17, 2020 11:51 am
by stemsee
mine is 1500 ... yours must be like a headlight!
Re: Screen Brightness Slider
Posted: Tue Aug 18, 2020 5:08 pm
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.
Re: Screen Brightness Slider
Posted: Tue Aug 18, 2020 8:45 pm
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..!
Pets are attached below. Different arches, only because of the minute sct binary.
Enjoy.
Mike.
Re: Screen Brightness Slider
Posted: Wed Aug 19, 2020 6:22 pm
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).
Pets for both arches are attached below. Enjoy.
Mike.
Re: Screen Brightness Slider
Posted: Wed Aug 19, 2020 9:55 pm
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
Re: Screen Brightness Slider
Posted: Wed Aug 19, 2020 10:54 pm
by vovchik
Dear Fred and Mike,
Thanks. What about this svg as an icon (smaller than the png)?
With kind regards,
vovchik
Re: Screen Brightness Slider
Posted: Thu Aug 20, 2020 12:07 am
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.
Mine got built in my favourite photo/graphics editor, Mooitech's PhotoScape, running under WINE. But.....it kinda got "thrown" together, ya know?
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.
Re: Screen Brightness Slider
Posted: Thu Aug 20, 2020 9:06 am
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.
Re: Screen Brightness Slider
Posted: Tue Sep 29, 2020 8:38 am
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 (9.75 KiB) Viewed 2353 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 &
Re: Screen Brightness Slider
Posted: Wed Dec 02, 2020 12:42 pm
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!
Re: Screen Brightness Slider
Posted: Mon Jan 18, 2021 4:26 pm
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.
Re: Screen Brightness Slider
Posted: Mon Jan 18, 2021 10:47 pm
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)
Re: Screen Brightness Slider
Posted: Mon Feb 15, 2021 7:43 pm
by Muzunduleno
Uau I'm looking for this . I've an Asus 1005
I will try
Thank you
Re: Screen Brightness Slider
Posted: Sun Aug 27, 2023 6:41 am
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!
Re: Screen Brightness Slider
Posted: Sun Aug 27, 2023 11:45 am
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!
Mike.
Re: Screen Brightness Slider
Posted: Sun Aug 27, 2023 2:41 pm
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).
@mikewalsh If you have a chance, can you fix your link to my original post?
https://oldforum.puppylinux.com/viewtopic.php?t=114229
Cheers!
Re: Screen Brightness Slider
Posted: Sun Aug 27, 2023 3:01 pm
by mikewalsh
@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.