Translate

2020-01-28

Xubuntu, you can't regulate the brightness of your laptop screen? Dual screen application!

Prerequisites: See the end of this blog post!!

Running Ubuntu 18.04 LTS in the Xubuntu release, I had this problem. Since I'm nearly 70 yrs old and have had the lenses in my eyes swapped for synthetic ones (cataracts), I'm sensitive to strong contrasts like a white homepage on my 24" screen in a moderately lit room. It dazzles my eyes.

It wasn't the fault of 18.04, it was the implementation in Xubuntu that made my laptop stop reacting when I wanted to lower the brightness of the laptop screen.

So: how do we fix this?

"Using your favorite editor", as the saying goes whenever you are asked to do changes to files in the system, by those who deliver your app or extension you need, we could create a couple of files named "Scron.sh" and "Scroff.sh". Or we could call them "Edna" and "Phil", it's up to you.
In this case we set the filenames when we save them.

We can alternatively do that by opening a "Terminal" or "Konsole" window and enter:

prompt> "touch Edna" <press Enter>
prompt> "touch Phil" <press Enter>
Then we'd like these to be executable, (running as a program) otherwise nothing will happen. So do in the same window:

prompt>chmod 0744 ./Edna <press Enter>
prompt>chmod 0744 ./Phil <press Enter>

When we have entered the code for the programs into these files, the system will now trust (us), that they are executable files. We can read, write and execute them, them others can only read them :0)

So, let's say we associate Edna with the light of you eyes  and Phil, well he's a real a-hole. That means that we associate Edna with light and Phil with darkness.

So now we enter the "code" doing the work for us in Edna.

We enter the following in Edna (by right clicking Edna in "your favorite file manager" and then choosing "your favorite editor"):

"xrandr  --output eDP-1 --brightness 0.9"

and then "Save".

Next we do the same to the Prince of Darkness (or maybe "the Prince of Insufficient Light" as Scott Adams in "Dilbert" so wisely prefers) Phil, right click Phil and choose the same editor and enter:

xrandr  --output eDP-1 --brightness 0.0

and then "Save".

Then we like to have an icon to click on whenever we like to light or turn off the display. 
In Xubuntu we right click the desktop itself, where there is no icon, and choose "Create Launcher". We'll get one of those gray small windows (I wish I were the guy producing them, he/she must be a billionaire by now) with some fields to fill in:

   Name: "Edna"
   Comment: whatever you feel like
   Command: /home/<[y]our user name>/Edna
   Working directory: /home/<[y]our user name> 
And then click the "No icon" button 
    and choose an icon, preferably among the "Applications" icons (more of them there)
and click the  "Create" button

A working Edna icon should now exist on our desktop.
We do the same for Phil but we exchange "Edna" for "Phil".

Done!

Doubleclicking on any one of them should now light up (or  kill)  the light on our laptop. The back light is still on but it's negligable.

Yeah. when youv'e snuffed out the light by clicking Phil, how can you then find the Edna? Well as the title says: in a "Dual screen application" you've chosen to use the big separate screen as your primary screen, letting the laptop screen be your secondary. In that situation, the icons will be in your primary screen's Desktop, it will not be a problem.

You realize, naturally, that by exchanging the "--brightness 0.0" or "--brightness 0.9" for "--brightness 0.5" you'll end up somewhere in between. May be of some use for somebodies.


=== Prerequisites: ====
In a "Terminal"or "Konsole" window enter.

prompt> apt install libXrandr2 [or "libXrandr2:i386"] <press Enter>
... a lot of text...
    ending eventually with the question if you accept to install.
    our answer should be "Yes" <press Enter>
 prompt>

libXrandr2  if we are running a 64 bit system
libXrandr2:i386 if we're running a 32 bit system

How do we know?

prompt> lscpu <press Enter>
   Architecture:        x86_64           <== this is our answer! Our system is 64 bit!
   CPU op-mode(s):      32-bit, 64-bit <== this says "I can run both!"
   Byte Order:          Little Endian
   CPU(s):              4
   On-line CPU(s) list: 0-3
   Thread(s)...
   ...and a lot more text...
prompt>
=== END "Prerequisites"====


If this doesn't work for you you might try using "xrandr  --output eDP-1 --brightness x.x" 
in the launcher itself!



Inga kommentarer:

Skicka en kommentar