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

xtrchessreal
  • 1,036
  • 2
  • 15
  • 29
  • 2
  • 1
    Take a look at a script I wrote a year ago: http://askubuntu.com/a/589574/295286. It's the one after "Update" part. Perhaps you may find it useful – Sergiy Kolodyazhnyy Aug 23 '15 at 03: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 04: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
  • @muru I apologize if any of my words offended you. It was never my intention to do so. I am removing irrelevant comments on this question as a show of good faith. I proceeded to analyze each of the answers in the related question and actively edited information in the question with my results (still ongoing) in good faith. I am trying to participate in a collaborative way. I am editing the question further to read in a more positive, objective, and unbiased fashion. Thank you for editing the code and outputs to read better. That was a nice gesture in the face of apparent hostile comments. :) – xtrchessreal Aug 27 '15 at 04:11
  • @Jacob Vlijm, muru Please accept my apologies for my stubborn behavior and what must have seemed inappropriate. After Serg's comments led me to Raja's information I studied xrandr at X.org and links sourced there. I agree a script is a set of steps via function calls and commands that manipulate the OS for a specified result that as a whole can be called a program or an App. In my defense I am new here, to a well constructed Linux OS, and was uninformed which led to a string of unfortunately timed events. – xtrchessreal Aug 27 '15 at 07:16
  • Jacob Vlijm, muru, @Serg, Raja It is my hope that someone can place a generally stated explanation in an answer below with sourced links and/or material of the xrandr commands use such that these scripts and their use of xrandr can be understood by the community. – xtrchessreal Aug 27 '15 at 07:17
  • Create the Dimmer.sh manually with gedit text editor and change it's permission with chmod manually. They are nothing but simple text files – Sergiy Kolodyazhnyy Sep 16 '15 at 05:00
  • What's your username? x? – A.B. Sep 16 '15 at 06:38
  • @A.B. Yes my username is x - Thanks for the edit, I wish I knew how to make a scroll window for code output. – xtrchessreal Sep 16 '15 at 18:00

2 Answers2

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.

A.B.
  • 90,397
Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
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.

mchid
  • 43,546
  • 8
  • 97
  • 150
  • 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 00:16
  • @Zacharee1 Thanks for your input. GRUB is not broken and my PC boots without any fatal issues. – xtrchessreal Aug 27 '15 at 05:40