Simple Brightness Slider
Posted: Wed 05 Sep 2018, 07:18
Update: new streamlined style. Closes on click-away:
Original big version
Stays open until you close it.
both scripts below.
i got tired of using heavy 'Power Manager' background services, when all i wanted was to adjust my screen brightness.
I started by using a simple command to adjust my brightness:
Then i made this lovely brightness slider. Works like a dream. It will auto-scale to the max brightness of your backlight. Small footprint while running, leaves nothing running in the background when you close it.
Will only work if you have the lightweight yad, and if the above command (or something similar) will adjust the brightness on your OS.
To understand the basic function, and to ensure you have yad, try this at a command-line:
Streamline script:
Big-Version script:
Explanation of all options:
https://www.mankier.com/1/yad
Now i can remove heavy 'power manager' background services!
Tested on:
StretchDog
Xtahr
radky's Dpup Stretch 7.5 (RC3)
Porteus desktop 32-bit
Linux Mint 19 xfce`
To install:
- Confirm the simple echo command works on your machine. Try various values and see if your brightness changes. But not 0, your screen will go black! Start high-- my machines go up to 12000000+!
- Confirm yad works:
- save the script in a file called set-brightness
- if needed, edit the `BrPath=` line to match your backlight path.
- put the script into /usr/local/bin
- create a launcher on your panel or desktop, which runs the command set-brightness. Since it's in /usr/local/bin, your OS should find it-- no need to enter entire path.
Causes of failure:
- Your backlight path might not be intel. Figure out which backlight path is correct for your machine
https://askubuntu.com/a/715310
https://askubuntu.com/questions/437983/ ... which-card
- You don't have backlight. But, as long as there's some command-line way to adjust the brightness of your screen, you can mod this script to use that command.
- You might have an old yad installed, or not installed at all. http://archive.ubuntu.com/ubuntu/pool/universe/y/yad/
- If you're not running as root, you may need to give your user (or all users) write-permissions on the brightness file
Funny story: i ran this on Mint 19 xfce. First time, Mint crashed Second time, Mint didn't crash, but you could see the slow-as-molasses performance, and jittery lags in the slider, compared with instantaneous responsiveness on xtahr, DebDog, or Porteus. Go Mint.
Volume slider
check out my alsa volume slider
http://murga-linux.com/puppy/viewtopic.php?t=114237
Original big version
Stays open until you close it.
both scripts below.
i got tired of using heavy 'Power Manager' background services, when all i wanted was to adjust my screen brightness.
I started by using a simple command to adjust my brightness:
Code: Select all
echo 10000000 > /sys/class/backlight/intel_backlight/brightness
Will only work if you have the lightweight yad, and if the above command (or something similar) will adjust the brightness on your OS.
To understand the basic function, and to ensure you have yad, try this at a command-line:
Code: Select all
yad --scale --print-partial
Code: Select all
#!/bin/sh
BrPath='/sys/class/backlight/intel_backlight/'
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" | sudo /usr/bin/tee ${BrPath}brightness
done
Code: Select all
#!/bin/sh
BrPath='/sys/class/backlight/intel_backlight/'
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 --title 'Set brightnessradky's Dpup Stretch 7.5 (RC3)' --width 300 --fixed --sticky --mouse --on-top --escape-ok --button OK --hide-value | while read BrNew
do echo "$BrNew" > ${BrPath}brightness
done
https://www.mankier.com/1/yad
Now i can remove heavy 'power manager' background services!
Tested on:
StretchDog
Xtahr
radky's Dpup Stretch 7.5 (RC3)
Porteus desktop 32-bit
Linux Mint 19 xfce`
To install:
- Confirm the simple echo command works on your machine. Try various values and see if your brightness changes. But not 0, your screen will go black! Start high-- my machines go up to 12000000+!
Code: Select all
echo 10000000 > /sys/class/backlight/intel_backlight/brightness
Code: Select all
yad --scale --print-partial
- if needed, edit the `BrPath=` line to match your backlight path.
- put the script into /usr/local/bin
- create a launcher on your panel or desktop, which runs the command set-brightness. Since it's in /usr/local/bin, your OS should find it-- no need to enter entire path.
Causes of failure:
- Your backlight path might not be intel. Figure out which backlight path is correct for your machine
Code: Select all
ll /sys/class/backlight/
https://askubuntu.com/questions/437983/ ... which-card
- You don't have backlight. But, as long as there's some command-line way to adjust the brightness of your screen, you can mod this script to use that command.
- You might have an old yad installed, or not installed at all. http://archive.ubuntu.com/ubuntu/pool/universe/y/yad/
- If you're not running as root, you may need to give your user (or all users) write-permissions on the brightness file
Code: Select all
chmod 666 /sys/class/backlight/intel_backlight/brightness
Funny story: i ran this on Mint 19 xfce. First time, Mint crashed Second time, Mint didn't crash, but you could see the slow-as-molasses performance, and jittery lags in the slider, compared with instantaneous responsiveness on xtahr, DebDog, or Porteus. Go Mint.
Volume slider
check out my alsa volume slider
http://murga-linux.com/puppy/viewtopic.php?t=114237