LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-23-2020, 04:45 PM   #1
MozillaUser3172
LQ Newbie
 
Registered: Mar 2020
Posts: 19

Rep: Reputation: Disabled
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.
 
Old 03-23-2020, 05:19 PM   #2
Mill J
Senior Member
 
Registered: Feb 2017
Location: 127.0.0.1 Sweet 127.0.0.1
Distribution: Void, MX, Haiku, Icaros, Puppy and many others
Posts: 1,002
Blog Entries: 2

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
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.
 
Old 03-23-2020, 05:47 PM   #3
MozillaUser3172
LQ Newbie
 
Registered: Mar 2020
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Mill J View Post
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?
 
Old 03-23-2020, 06:11 PM   #4
Mill J
Senior Member
 
Registered: Feb 2017
Location: 127.0.0.1 Sweet 127.0.0.1
Distribution: Void, MX, Haiku, Icaros, Puppy and many others
Posts: 1,002
Blog Entries: 2

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Quote:
Originally Posted by MozillaUser3172 View Post
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.
 
Old 03-23-2020, 07:40 PM   #5
0XBF
Member
 
Registered: Nov 2018
Location: Winnipeg
Distribution: Slackware
Posts: 136

Rep: Reputation: 101Reputation: 101
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.
 
Old 03-24-2020, 06:07 PM   #6
MozillaUser3172
LQ Newbie
 
Registered: Mar 2020
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Mill J View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: XO Laptop Price Increase & Maybe Decrease LXer Syndicated Linux News 0 02-20-2009 12:50 AM
how zoom increase/decrease in KDE konsole LinuxLover Linux - Software 1 12-26-2006 02:14 AM
increase free physical memory, decrease disk cache efm Linux - Hardware 4 03-30-2006 09:53 AM
How can I decrease brightness in Blackbox/X windows? CrazyHoboMan Linux - Software 0 02-10-2005 09:34 PM
How to increase/decrease brightness? ginda Linux - Newbie 3 02-01-2005 10:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration