3

I used an app in Windows 7, I think called dimmer to make the screen change its contrast settings so I could dim it lower than the controls of the PC defaults such as function key or the power options in control panel.

Are there any of these type apps for Ubuntu 15.04 or approved for the latest Ubuntu LTS version on a PC-laptop.

My computer has the use of function keys that change its brightness. It uses a 0-8 step brightness scale where 0 is the least bright and 8 is the brightest. 0 is too bright for my comfort level especially at night

Following the suggestion in an answer below I added the following to etc/default/grub:

GRUB_CMDLINE_LINUX="resume=UUID=8bcb4169-f5ab-4ab6-b644-23e528088d41 acpi_backlight=vendor"

and updated grub

My screen brightness did not go any dimmer than it had before. Oddly the brightness level seems to go to level 2 brightness on a 0-8 scale every time I reboot which it did not do prior to the etc/default/grub change. I reverted my grub file back to previous settings.

I've installed Indicator-Brightness but this app does not dim my desktop any further than my function keys do and there are no menus to configure it to do so.

I actively pursued other related questions to find a solution and reporting results of that action here. Its a process that takes time. To those that have provided input, Thank you for being patient.

There are many aspects to graphics, screen brightness, contrasts, color temp, gamma.

I tried

xbacklight -set 50
xbacklight -dec 10 and 03 etc.

This never increased or decreased beyond the usual 0-8 steps the PC provides i.e. no difference than current function key levels.

Interestingly a comment below my question by Serg Kolo (thanks :) led me to info on xrandr via the linked sources at the bottom of the information he provided concerning his script:

xrandr -q | grep " connected"
xrandr --output LVDS1 --brightness 0.5

I had no idea this was available and already installed - apparently. With the second command in terminal my screen went darker than it ever has. I then tested:

xrandr --output LVDS1 --brightness 0.9

Which got me back to the usual lowest level. This appears to be changing contrast levels not brightness, which is exactly what I was asking about. A simple command in terminal is as good as an App.

I have since studied xrandr so that I can get an idea of how that command works.

Perhaps someone could explain xrandr in easy terms but until then please explore the information from the link above.

Edit Sept 16

In good faith and collaboration I decided to try the script from Serg's answer below. Following his directions I was able to make this script work for me. I wish I knew how the script determines what the name of my screen is for the use of xrandr command but the good news is it works.

Thank you Serg and all for your input

  • 2
    possible duplicate of Is there any brightness control for desktops? – muru Aug 23 '15 at 0:03
  • 1
    Take a look at a script I wrote a year ago: askubuntu.com/a/589574/295286. It's the one after "Update" part. Perhaps you may find it useful – Sergiy Kolodyazhnyy Aug 23 '15 at 3:53
  • Also, questions marked as duplicates for a reason. The type of question you ask has been asked hundreds of times on this and unix.stackexchange.com sites. They are not intended as offence, but rather as tool to direct users to similar questions that already have possible solutions. Additionally, scripts are one of the standard ways to troubleshooting Linux issues or creating workarounds. And a script file, made executable, is already a custom-made app. – Sergiy Kolodyazhnyy Aug 23 '15 at 4:01
  • @Serg Your link led me to something that is very close to a solution but I don't understand it. Could you please review the bottom area of my question and provide an explanation/answer. – xtrchessreal Aug 23 '15 at 21:38
  • @xtrchessreal Alright, I'll post an answer a bit later. Right now a bit busy. I'll try to make it as simple as possible – Sergiy Kolodyazhnyy Aug 23 '15 at 21:47
4

Follow these steps exactly:

  1. Open terminal via Ctrl-Alt-T

  2. Create a folder for the script

    mkdir -p ~/bin
    
  3. Open the file ~/bin/setup.sh in gedit.

    gedit ~/bin/setup.sh 
    
  4. Copy over the code below save the file, close the editor.

    #!/bin/sh
    # Author: Serg Kolo
    # Date: Mon Aug 24 , 2015
    # Description: setup script for creating
    # launcher and setting up the Dimmer script
    
    DESKFILE="$HOME/bin/Dimmer.desktop"
    SCHEMA="com.canonical.Unity.Launcher"
    KEY="favorites"
    SCRIPTFILE="$HOME/bin/Dimmer.sh"
    
    createBinFolder() {
     if [ ! -e "$HOME/bin" ]; then
       mkdir "$HOME/bin"
     fi
     echo "created bin folder"
    }
    
    createLauncher() {
     OUTPUT="$(gsettings get $SCHEMA $KEY | awk -v file="$DESKFILE" -v sq="'"  '{ sub(/\]/,""); print  $0","sq"application://"file sq "]"  }')" ;
     gsettings set $SCHEMA $KEY "$OUTPUT" ;
     echo "Launcher for Dimmer created"
    }
    
    createScriptFile() {
     touch "$SCRIPTFILE"
     chmod 755 "$SCRIPTFILE"
     echo "Created script file. Please copy over the code to \"$SCRIPTFILE\""
    }
    
    createDeskFile() {
     printf "[Desktop Entry]\nName=Dimmer\nExec=%s\nType=Application\nTerminal=false" "$SCRIPTFILE" > "$DESKFILE"
    }
    
    createBinFolder
    createScriptFile
    createDeskFile
    createLauncher
    
  5. Make the file executable and start the setup script

    chmod 755 ~/bin/setup.sh && ~/bin/setup.sh
    

    That script will create bin folder and blank Dimmer.sh file.

  6. Edit the file Dimmer.sh

    gedit ~/bin/Dimmer.sh
    
  7. Copy the code below, save and close the editor

    #!/bin/sh
    # Name: backlightscript
    # Author: Serg Kolo
    # Date: March 2 , 2015
    # Description: Simple script to change screen brightness using xrandr
    
    # uncomment this for debugging as needed
    # set -x
    
    NEWVAL=$( zenity --scale --min-value=0 --max-value=7 --text="Enter number between 0 and 7" ) && brightness=$(($NEWVAL+2))
    
    if [ "$NEWVAL" != "" ]; then
        xrandr --output "$( xrandr | awk '$2=="connected" {print $1}')" --brightness 0.$brightness
    fi
    

Now you should be able to double click on the launcher and get that dimmer app working.

  • Where is SCHEMA and KEY defined? – A.B. Aug 25 '15 at 6:14
  • Top of the script , bellow the #! Line – Sergiy Kolodyazhnyy Aug 25 '15 at 6:17
  • Arg, I'm blind =\ – A.B. Aug 25 '15 at 6:20
  • Serg I need your help, I seem to have run into a problem while trying to build the script, I cannot find the dimmer.sh file to copy the rest of the script into. Please see my new entry at the bottom of my question for details. Thank you for your help – xtrchessreal Sep 16 '15 at 4:31
  • 1
    In the setup.sh file, there is no call to the createBinFolder function. Add it above the createScriptFile function call. – Terrance Sep 16 '15 at 15:14
0

If you edit the file /etc/default/grub and change the line:

GRUB_CMDLINE_LINUX=""

to

GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

and then run

sudo update-grub

and reboot, you should have the ability to lower the screen backlight to completely black.

  • To backup grub first is this the correct line: 'sudo cp /etc/default/grub /etc/default/grub.bak' and if I had a boot fail for any reason can I revert via recovery mode terminal and just reverse the order of that line like: 'sudo cp /etc/default/grub.bak /etc/default/grub' Thanks for your input. – xtrchessreal Aug 23 '15 at 18:12
  • @xtrchessreal if GRUB is broken, can you still enter Recovery Mode? I think you'd have to use a liveUSB/CD, which you could use to just rebuild GRUB. – TheWanderer Aug 25 '15 at 0:16
  • @Zacharee1 Thanks for your input. GRUB is not broken and my PC boots without any fatal issues. – xtrchessreal Aug 27 '15 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.