Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-23-2020, 04:45 PM
|
#1
|
LQ Newbie
Registered: Mar 2020
Posts: 23
Rep: 
|
Change brightness percentage that screen brightness keys increase/decrease
Hi,
I'd like to change percentage of brightness that the screen brightness keys increase/decrease the brightness.
On laptop A, which seems to have only 8 brightness levels. This laptop's 0 brightness level is actually 50%, which sucks. The keys increase/decrease by 1 unit (1/16 total brightness) from 100% down to 50%.
On laptop B, which has 1000 levels, the keys increase/decrease by seemingly 90 units (1/11 total brightness).
How, on laptop B at least, can I reduce the delta to 50?
Thanks.
Last edited by MozillaUser3172; 03-23-2020 at 05:18 PM.
|
|
|
03-23-2020, 05:19 PM
|
#2
|
Senior Member
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
|
I use xrandr. It has a brightness option. It's also capable of adjusting gamma levels(red:green:blue).
It's not very user-friendly though. Its cli and unless you write a script or something it won't save changes over a reboot.
Edit: I think I misread the question so answer might not be relevant.
Last edited by Mill J; 03-23-2020 at 05:22 PM.
|
|
|
03-23-2020, 05:47 PM
|
#3
|
LQ Newbie
Registered: Mar 2020
Posts: 23
Original Poster
Rep: 
|
Quote:
Originally Posted by Mill J
I use xrandr. It has a brightness option.
|
This is ultimately a question of, when the user presses Brightness Up or Brightness Down keys, what happens behind the scenes to alter the brightness?
|
|
|
03-23-2020, 06:11 PM
|
#4
|
Senior Member
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
|
Quote:
Originally Posted by MozillaUser3172
This is ultimately a question of, when the user presses Brightness Up or Brightness Down keys, what happens behind the scenes to alter the brightness?
|
Right I misread your first post. I'm guessing it's dependant on either the desktop or a kernel driver or both.
|
|
|
03-23-2020, 07:40 PM
|
#5
|
Member
Registered: Nov 2018
Distribution: Slackware
Posts: 919
|
I'm not sure on how you would go about redefining the increment amount for the brightness keys in the existing system. You could manage it with a script though. I had written a brightness script for an old MBP a while ago. I reworked the code so it could be called by a custom keyboard shortcut. In my system (KDE5) I just unbound the existing keyboard shortcut and then made a custom shortcut for the brightness keys, calling the script as follows:
Code:
sh <your script directory>/brightness_keys.sh up
or
Code:
sh <your script directory>/brightness_keys.sh down
brightness_keys.sh (note the comments)
Code:
#!/bin/sh
#
# brightness_keys.sh
#
# Adjusts the backlight in user specified increments
#
set -e
# Check what exists at your own /sys/class/backlight/* and
# adjust accordingly.
SYS_DIR="/sys/class/backlight/intel_backlight"
# Set your own desired increment here. E.g. 5% for 20 steps full scale
INCREMENT_PERCENT=5
MAX_BRIGHT=$(cat $SYS_DIR/max_brightness)
CUR_BRIGHT=$(cat $SYS_DIR/brightness)
INCREMENT_BRIGHT=$(( ($MAX_BRIGHT * $INCREMENT_PERCENT) / 100))
if ! [ -z "$1" ]; then
case "$1" in
"up")
if [ $(($CUR_BRIGHT + $INCREMENT_BRIGHT)) -ge $MAX_BRIGHT ]; then
# Ensures we always get up to 100
echo "$MAX_BRIGHT" > $SYS_DIR/brightness
else
echo "$(( $CUR_BRIGHT + $INCREMENT_BRIGHT ))" > $SYS_DIR/brightness
fi
;;
"down")
if [ $(($CUR_BRIGHT - $INCREMENT_BRIGHT)) -le 0 ]; then
# Ensures we always get down to 0
echo "0" > $SYS_DIR/brightness
else
echo "$(( $CUR_BRIGHT - $INCREMENT_BRIGHT ))" > $SYS_DIR/brightness
fi
;;
*)
echo "Proper usage: sh brightness_keys.sh (up|down)"
exit 1
;;
esac
else
echo "Proper usage: sh brightness_keys.sh (up|down)"
exit 1
fi
exit 0
Good luck!
I should note that this script is changing the value of /sys/class/backlight/<your_backlight_vendor>/brightness, while staying within its set limits. You could set it manually if you wish by echoing values into there.
Last edited by 0XBF; 03-23-2020 at 07:42 PM.
|
|
|
03-24-2020, 06:07 PM
|
#6
|
LQ Newbie
Registered: Mar 2020
Posts: 23
Original Poster
Rep: 
|
Quote:
Originally Posted by Mill J
Right I misread your first post. I'm guessing it's dependant on either the desktop or a kernel driver or both.
|
It seems all Linuxes that run acpid can "see" the brightness up/down keypressed.
If you run acpi_watch it will print them.
However the shell script in /etc/acpi maybe doesn't get run for these events. I'm still investigating.
|
|
|
All times are GMT -5. The time now is 02:11 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|