Brightness & colour temperature control for desktop PCs

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#76 Post by greengeek »

fredx181 wrote:I cannot understand btw, what can be the problem when restarting X, but apparently for you there's some issue with that.
Yes, X restart is problematic for me - I will try to explain:

I try to keep my system small and "lean" - so I often use software by loading pets during a session - rather than having those pets permanently loaded into a savefile (I have no savefile).

Imagine the situation where I have a number of windows open (browser , word processor etc) and I decide the screen is too bright so I load Mikes pet to control gamma and brightness - if I am forced to restart X to get the pet working, then all of those windows will close and I will be back to a blank desktop and I will have to start my session all over again.

(Restart WM does not cause window loss)

User avatar
fabrice_035
Posts: 765
Joined: Mon 28 Apr 2014, 17:54
Location: Bretagne / France

#77 Post by fabrice_035 »

greengeek wrote:

Code: Select all

xrandr --output LVDS1 --set BACKLIGHT 5

Code: Select all

xrandr --output LVDS1 --set BACKLIGHT 10
("BACKLIGHT" must be uppercase)
.

Code: Select all

root# xrandr | grep " connected " | awk '{ print$1 }'
HDMI-0
LVDS

root# xrandr --output LVDS --set BACKLIGHT 5
X Error of failed request:  BadName (named color or font does not exist)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  11 (RRQueryOutputProperty)
  Serial number of failed request:  33
  Current serial number in output stream:  33
root# 


User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#78 Post by greengeek »

Mike Walsh wrote:Does anybody know where the script dealing with the contents of the notification area resides? Be interesting to find out, actually.:
Hi Mike,

I am no expert at this but hopefully I can show one method to position tray icons:

If you are using JWM as your WM, open the hidden file /root/.jwmrc-tray
Here is mine:

Code: Select all

<JWM>
	<Tray  autohide="false" insert="right" x="0" y="-1" border="1" height="28" >
		<!-- Additional TrayButton attribute: label -->
		<TrayButton label="Menu" icon="logo-mini.png" border="true">root:3</TrayButton>
		<TrayButton popup="Show Desktop" icon="mini-desktop.xpm" border="true">showdesktop</TrayButton>
		<TrayButton popup="Terminal" icon="/usr/local/lib/X11/pixmaps/console24.png" border="true">exec:urxvt</TrayButton>
		<TrayButton popup="Files" icon="/usr/local/lib/X11/pixmaps/folder24.png" border="true">exec:rox</TrayButton>
		<TrayButton popup="Browser" icon="/usr/local/lib/X11/pixmaps/www24.png" border="true">exec:defaultbrowser</TrayButton>
		<TrayButton popup="Leafpad" icon="/usr/local/lib/X11/mini-icons/leafpad.png" border="true">exec:leafpad</TrayButton>
		<TrayButton popup="BacklightUP" icon="/usr/local/lib/X11/pixmaps/brightup24.png" border="true">exec:xbacklight +15</TrayButton>
		<TrayButton popup="BacklightDWN" icon="/usr/local/lib/X11/pixmaps/brightdwn24.png" border="true">exec:xbacklight -10</TrayButton>
		
		<TrayButton popup="XVkbd" icon="/usr/local/lib/X11/pixmaps/kbd24.png" border="true">exec:xvkbdstart</TrayButton>
		<Pager/>
		<!-- Additional TaskList attribute: maxwidth -->
		<TaskList maxwidth="200"/>
		<Dock/>
		<!-- Additional Swallow attribute: height -->
	<!--	<Swallow name="blinky">
			blinkydelayed -bg "#DCDAD5"
		</Swallow> -->
	<!--	<Swallow name="xtmix-launcher">
			xtmix -launch
		</Swallow> -->
	<!--	<Swallow name="asapm">
			asapmshell -u 4
		</Swallow> -->
			<!--	<Swallow name="freememapplet" width="34">
			freememappletshell
		</Swallow> -->
	<!--	<Swallow name="freememapplet" width="34">
			freememappletshell
		</Swallow> -->
		<Swallow name="xload" width="32">
			xload -nolabel -bg "#888888" -fg red -hl white
		</Swallow>
		<Clock format="%H:%M">minixcal</Clock>
	</Tray>
</JWM>
I can now add in the line that Mochi was using to position his unicode symbol as a tray icon eg:

Code: Select all

<TrayButton label="◑">exec:/usr/bin/mm_brightness_slider</TrayButton>
If I put that line in the "TrayButton" area (eg in the blank space that I left above the "XVKBD" tray button declaration) then that icon will appear on the left hand side of the menu tray, with the icons sitting to the right of the menu button.

If I put that line somewhere in the "swallow" declarations then it will appear in the tray area near the clock

To activate the change all I need to do is:

Code: Select all

jwm -restart
and the icon appears without losing all of my open windows (as would happen with a restart X)

(I am sure Mochi and others will correct my fundamental misunderstandings about this :-) )

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#79 Post by greengeek »

fabrice_035 wrote:root# xrandr --output LVDS --set BACKLIGHT 5
X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 11 (RRQueryOutputProperty)
Serial number of failed request: 33
Current serial number in output stream: 33
root#

[/code]
Hi Fabrice, can you post the output of the following command please?

Code: Select all

xrandr --verbose | grep Backlight
(must use capital B for Backlight)

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#80 Post by fredx181 »

@greengeek

Following MochiMoppel's brightness slider example for adding to ~/.jwmrc:

Code: Select all

<TrayButton label="◑">exec:/usr/bin/mm_brightness_slider</TrayButton>
Then:
For Mike's BrightSelect.sh script, add in ~/.jwmrc

Code: Select all

<TrayButton label="◑">exec:/usr/local/bin/BrightSelect.sh</TrayButton>
Then: "jwm -restart" should do.

But then maybe better remove /root/Startup/ScreenControl.sh
(to avoid displaying the yad icon (will be duplicate), in case you do restart X or reboot with save)
xrandr --verbose | grep Backlight
This gives no output for me.

Fred

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#81 Post by Mike Walsh »

@ Ian:-

Give this one a try. It's identical to the one from last night, with the addition of a 'pinstall.sh' script that places the icon in the tray when you install it.

https://www.datafilehost.com/d/dc10b5c2

Not sure how you'd remove the icon afterwards, though.

Code: Select all

jwm -restart
....doesn't get rid of it for me (and I'm not too sure how a 'puninstall.sh' script works.)

See what ya think. I spoil you, buddy..! :lol:


Mike. :wink:

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#82 Post by greengeek »

Mike Walsh wrote:Give this one a try....
Not sure how you'd remove the icon afterwards, though.
Not a problem for me - the icon mysteriously disappears after I shut down (that's why I like having no save file) :twisted:
See what ya think. I spoil you, buddy..! :lol:
Indeed - many thanks for the updated pet. It's perfect for some of my needs. Working as described and yad definitely makes the interface look good :!:

HOWEVER - i still feel that adjusting gamma is the wrong approach if backlight control is available. Of course it isn't always available, but on many monitors - even external ones it is available so I feel people should be aware of it.

Here are some threads that offer more information:

https://unix.stackexchange.com/question ... tor/189690

https://github.com/jonls/redshift/issues/436
(this thread also mentions "Clight")

and here is the thread re ddccontrol: https://github.com/ddccontrol/ddccontrol

I think each user should inspect the output of xrandr (xrandr --verbose) to see if "BACKLIGHT" or "Backlight" or "backlight" are mentioned anywhere.

In theory, any device that has such a variable noted by xrandr should be able to have its backlight controlled, rather than dimming pixels or altering the colour balance of pixels.

Once you have the info from xrandr regarding the range of backlight values permissible within xrandr then you can script the required values into the correctly spelled "backlight" variable.

(i mention this not as a negative against your pets - but just in case future users are looking for other specific ways to control backlight)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#83 Post by greengeek »

To find out if you might be able to control backlight intensity rather than controlling pixel attributes try the following command:

Code: Select all

xrandr --verbose | grep -e "ack" -e "ACK"
If it returns numerical values then you do not necessarily need to use pixel control as a method of controlling brightness.

EDIT : Ooops! Corrected typo. The command will work now. Sorry!
:oops:

User avatar
gjuhasz
Posts: 422
Joined: Mon 29 Sep 2008, 14:28

Battery saving brightness control for Intel laptops

#84 Post by gjuhasz »

Hi,

I found a battery saving brightness control method for my HP laptop (HP 250 G6 with Intel HD 520 graphics).

See details at

http://murga-linux.com/puppy/viewtopic. ... &start=241

Have fun!

Regards

gjuhasz

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#85 Post by recobayu »

I go to here:
https://unix.stackexchange.com/a/429389 and works for me. Now, what is the keyboard shortcut for this? I have acer laptop that uses Fn+left arrow and Fn+right arrow to change brightness. But I don't know what is the shortcut key. I want to add it to /root/.jwm/jwmrc-personal.
Thank you.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#86 Post by Mike Walsh »

@ recobayu:-

I think you would need to set up the keyboard shortcuts first, in /etc/xdg/templates/_root_.jwmrc. (See the 'Key bindings' section down near the bottom). Needs a re-start of 'X' for them to be recognised.

Then you should be able to add the shortcuts into /root/.jwm/jwmrc-personal. No guarantees, mind, but that's the way I would approach it.


Mike. :wink:

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#87 Post by recobayu »

Thank You Mike, It works! :D
First, I make a script "brightup" in /usr/bin and write this:

Code: Select all

bright=`cat /sys/class/backlight/intel_backlight/brightness`;echo $(($bright+50))>/sys/class/backlight/intel_backlight/brightness
And I make a script "brightdown" in /usr/bin and also write this:

Code: Select all

bright=`cat /sys/class/backlight/intel_backlight/brightness`;echo $(($bright-50))>/sys/class/backlight/intel_backlight/brightness
After that, I clik on menu:
Desktop >> Desktop Settings >> Shortcuts >> On the Keyboard shortcuts tab, I choose "Add new shortcut" >> On Combobox, I choose XF86MonBrightnessUp >> on Action, I write "exec: brightup" >> click Apply.
I also choose key XF86MonBrightnessDown --> action "exec:brightdown", click Apply.
I click Ok on the window JWM shortcus, I think it is automatically restartwm. So I do not need to restart x. And alhamdulillah It works!
I look at /root/.jwm/jwmrc-personal, and i see two line added below <!-- Key bindings -->

Code: Select all

<Key key="XF86MonBrightnessUp">exec: brightup</Key>
<Key key="XF86MonBrightnessDown">exec: brightdown</Key>
Thank You, Mike. ;)

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#88 Post by Mike Walsh »

@ recobayu:-

Ah, that's good to hear. Glad it's working for you.

I meant to say that you need to run

Code: Select all

fixmenus
...in the terminal, followed by a re-start of "X". That's only because it's the exact same routine which is automatically run by every .pet package when it first installs; /etc/xdg/templates/_root_.jwmrc is the 'master' script for the main Menu (and it also re-updates all your key-bindings, etc., and anything else which might have changed with the install of a new package).


Mike. :wink:

Post Reply