1

With using linux on and off on different PC's through the years, one issue I have not been able to solve is the brightness setting during boot sitting at the Display Manager.

I am running KDE version of ubuntu so I have sddm installed. Googling and searching through the Arch wiki, I am unable to find anything relating to brightness setting when at a Display manager. Once logged on, I set up a script to lower it to the brightness that I like best.

Is there any way to change the brightness when first booting, even an option to hardcode it? From what I see, it is not a setting per display managers.

pc specs

1 Answer 1

1

I found a solution using a bash script and systemd services for anyone else that may come along and wish there was a screen brightness perseverance.

  1. Make a bash script and place it where you see fit. Here is my example where I named it Brightness_Checker.bash. Also create a text file names something like Brightness_Checker.backup, this will be for storing the brightness value. You will want to update sLoc with that path to the .backup file.
#!/bin/bash

bLoc=/sys/class/backlight/intel_backlight/brightness
sLoc=/home/kar/Programs/BashTools/Brightness_Checker.backup

bVal=$(cat $sLoc)

echo $bVal > $bLoc

while :
do
    cVal=$(cat $bLoc)

    if [ $cVal = "0" ];
    then
        echo 1 > $bLoc
        cVal=1
    fi

    if [ $bVal != $cVal ];
    then
        bVal=$cVal
        echo $bVal > $sLoc
    fi
    sleep 10
done
  1. Within /etc/systemd/system, create a service file similar to mine where ExecStart will point to your bash script:
[Unit]
Description = Brightness checker

[Service]
ExecStart=/home/kar/Programs/BashTools/Brightness_Checker.bash

[Install]
WantedBy=multi-user.target
  1. From here you want to enable the service:

    sudo systemctl enable Brightness_Checker.service
    

Then restart your pc.

Note: The reason I have it echo 1 if the brightness is 0 is due to something beyond my pay grade that resets the brightness to full when booting up.

EDIT: One thing I forgot to mention, for security, I would suggest making those 2 files root owner and remove write access from everyone but root otherwise any update to that script could be ran on next startup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .