Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 14 Dec 2018, 15:28
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Brightness & colour temperature control for desktop PCs
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 6 [84 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1716
Location: Japan

PostPosted: Wed 10 Oct 2018, 03:03    Post subject:  

greengeek wrote:
Also - the script does not work the same way my usual method does
And what is your usual method?
Quote:
the script seems to alter the gamma instead of backlight intensity
The script alters brightness as sensed by xrandr which AFAIK is not the same as the physical backlight intensity of the monitor. A value of 1.0 seems to be relative of the physical backlight intensity.

The script always resets gamma to 1.0 for all 3 colors. So yes, your gamma will be altered if it was set to different values. Reducing brightness results in washed out colors and IMO increasing gamma would result in a more pleasant and sharp display but that's not for me to decide.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5330
Location: Republic of Novo Zelande

PostPosted: Wed 10 Oct 2018, 03:06    Post subject:  

Mike Walsh wrote:
install this one instead:-

ScreenControl-v1.3-i686

Usage:-

You'll need to re-start 'X', first of all, since this is tray-based. That will place a black/yellow 'split-circle' icon in the tray.
Thanks - this works very well. One question though - I can't figure out how you get the icon into the tray. I expected your pet to incorporate a pinstall.sh which modified .jwmrc-tray, but i see nothing like that.

I'd like to understand how the icon gets where it does...
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5330
Location: Republic of Novo Zelande

PostPosted: Wed 10 Oct 2018, 03:18    Post subject:  

MochiMoppel wrote:
And what is your usual method?.
Well now that you ask, I realise that it uses xbacklight which I see Mike says is not a solution for desktops anyway.

(I had previously thought I was using a script to echo values to /sys/class/backlight/intel_backlight/brightness but that must have been a previous version)

Anyway, this is the relevant addition to my /root.jwmrc-tray:
Code:
      <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 label="◑">exec:/usr/bin/mm_brightness_slider</TrayButton>
      <TrayButton popup="XVkbd" icon="/usr/local/lib/X11/pixmaps/kbd24.png" border="true">exec:xvkbdstart</TrayButton>
      <Pager/>


I don't understand why xbacklight would not work for desktops though.

EDIT : Turns out my original script did not use:
# echo [numeric_value] >sys/class/backlight/intel_backlight/brightness,
instead it used
# echo [numeric_value] > /sys/class/backlight/toshiba/brightness

I don't know why my system shows the "intel_backlight/brightness" as well as the "toshiba/brightness".

EDIT2 : It also shows:
/sys/class/backlight/acpi_video0/brightness

In order to determine valid values for [numeric_value] I use the following syntax to see what max brightness values are permissible:
Code:
# cat /sys/class/backlight/toshiba/max_brightness
7
#


(The weird thing is that intel_backlight/brightness has a max permissible value of 1 but toshiba/brightness and acpi_video0/brightness have max permissible values of 7)

This max permissible value is not always the same on every system. I recall finding some useful scripts on the Arch forum for tailoring the [numeric_value] appropriately for each different system.

Found it:
Code:
#https://bbs.archlinux.org/viewtopic.php?id=134972

#!/bin/bash

# base dir for backlight class
basedir="/sys/class/backlight/"

# get the backlight handler
handler=$basedir$(ls $basedir)"/"

# get current brightness
old_brightness=$(cat $handler"brightness")

# get max brightness
max_brightness=$(cat $handler"max_brightness")

# get current brightness %
old_brightness_p=$(( 100 * $old_brightness / $max_brightness ))

# calculate new brightness %
new_brightness_p=$(($old_brightness_p $1))

# calculate new brightness value
new_brightness=$(( $max_brightness * $new_brightness_p / 100 ))

# set the new brightness value
sudo chmod 666 $handler"brightness"
echo $new_brightness > $handler"brightness"

Last edited by greengeek on Wed 10 Oct 2018, 05:09; edited 2 times in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1716
Location: Japan

PostPosted: Wed 10 Oct 2018, 04:55    Post subject:  

greengeek wrote:
Well now that you ask, I realise that it uses xbacklight which I see Mike says is not a solution for desktops anyway.
Shouldn't bother you as you seem to use a laptop. I've never used xbacklight so I don't know what is is capable of.

Since you complained about lost gamma: What are your gamma values? Does xbacklight retain those values? The funny thing with xrandr is that when only brightness is set, gamma is reset, and when only gamma is set, brightness is reset (to 1.0). I found that in order to keep the values, both brightness and gamma need to be set at the same time by a single xrandr command. Can be done but I'm not sure if anyone really needs it.

I'm also not sure if it is really necessary to directly change values in /sys/class/backlight. So far I assumed that xrandr would do this.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5330
Location: Republic of Novo Zelande

PostPosted: Wed 10 Oct 2018, 05:28    Post subject:  

MochiMoppel wrote:
What are your gamma values? .
To be honest I can't see how to display those at the moment. Will research more tomorrow.

EDIT : Just found the xgamma command:
Code:
# xgamma
-> Red  1.000, Green  1.000, Blue  1.000
#


Based on your comments I just tried tweaking gamma via xrandr and can see the blue tint appear (found a comment saying that xrandr "brightness alterations only adjust the 3 gamma values equally rather than changing backlight")

What do you see if you enter:
xrandr --verbose

does it show any comments about "backlight"?

See the last post here:
https://unix.stackexchange.com/questions/61256/how-to-change-lcd-intensivity-brightness
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4460
Location: King's Lynn, UK.

PostPosted: Wed 10 Oct 2018, 05:38    Post subject:  

MochiMoppel wrote:
@Mike Walsh: Sorry for the intrusion into your thread. I tried to respond to a request and didn't realize that such a small script can trigger so many issues. I just don't want to leave a mess. Laughing


No worries, Mochi. It all relates, in a roundabout way, to the original subject matter. That's OK by me. I've always maintained that I don't care if we do have lots of different ways available to do the same thing, as not everyone will wish to do stuff in the same fashion.

Choice is a good thing.


Mike. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1716
Location: Japan

PostPosted: Wed 10 Oct 2018, 05:43    Post subject:  

greengeek wrote:
I can't see how to display those at the moment.
xrandr --verbose | grep Gamma
Quote:
found a comment saying that xrandr "brightness alterations only adjust the 3 gamma values equally rather than changing backlight"
Hmmm... if so there wouldn't be any need for brightness control and gamma control would be sufficient, but I see that they do different things.

Quote:
What do you see if you enter:
xrandr --verbose
does it show any comments about "backlight"?
Backlight: 0 (0x00000000) range: (0,10)
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4460
Location: King's Lynn, UK.

PostPosted: Wed 10 Oct 2018, 06:03    Post subject:  

greengeek wrote:
Mike Walsh wrote:
install this one instead:-

ScreenControl-v1.3-i686

Usage:-

You'll need to re-start 'X', first of all, since this is tray-based. That will place a black/yellow 'split-circle' icon in the tray.

Thanks - this works very well. One question though - I can't figure out how you get the icon into the tray. I expected your pet to incorporate a pinstall.sh which modified .jwmrc-tray, but i see nothing like that.

I'd like to understand how the icon gets where it does...


Glad it works for you, GG.

As to how it places the icon into the tray.....well, I'm not too clear about that myself! If you open /root/my-applications/bin/ScreenControl.sh with Geany, you have this:-

Code:
#!/bin/sh
#
#YAD 'one-liner' from musher0 / fredx181, to place executable tray icon in notification area
#
yad --notification --text="Brightness and tint" --command='/usr/local/bin/BrightSelect.sh' --image='/usr/local/lib/X11/pixmaps/Bright.png' 2>/dev/null


When I was trying to sort out a way to implement a GUI for a 'permissions changer' (for the current Chromes, which run-as-spot), that triggered from the tray, Fred and musher0 between them came up with a quick, easy way to place the icon there.

Most of it's self-explanatory. The action is handled by the YAD '--notifications' command. (See smokey01's excellent YAD tutorial for more in-depth explanations of YAD's various functions. Probably aided by the fact that, as I understand it, ROX/JWM between them just treat the tray as another 'panel'?)

'--text' gives you the tooltip.

'--command' allows you to implement whatever function you want to employ when you click on it (in this case, calling a YAD script to display a GUI box.....which then lets you select further functions by calling additional scripts).

'--image' lets you choose the icon to use (in the tray).

But I'm really not certain exactly what the

Code:
2>/dev/null


.....actually does. Perhaps some web research would throw light on that particular function; maybe Mochi could tell us.....he's light-years ahead of me when it comes to understanding what various items of code will do. It worked at the time, so I didn't question it.....and I've since used it in various other scripts for this & that, where I want an icon in the notification area, as opposed to a 'launcher' or a .desktop Menu entry.


Mike. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1716
Location: Japan

PostPosted: Wed 10 Oct 2018, 07:37    Post subject:  

Mike Walsh wrote:
As to how it places the icon into the tray.....well, I'm not too clear about that myself!
The window manager has an area for applications that request to run in the tray (in JWM this area is called <Dock/>, normally placed left of the clock). Applications that are designed to run in the tray or request to do so, like yad with its --notification option, "find" this area. If there are already applications in the "Dock", a newcomer is normally placed left of them.
Quote:
But I'm really not certain exactly what the
Code:
2>/dev/null

.....actually does.
IMO does the wrong thing here and should be removed. It suppresses error messages, but since yad is a GUI application you wouldn't see them anyway, and when yad doesn't work as expected and you start it from a console, you definitely do want to see any error messages.

BTW: For changing color temperature is redshift really necessary? Your slider values range between 2400K and 6500K. These seem to correspond to gamma values between 1.0:1.7:3.0 and 1.0:1.0:1.0. Though this doesn't look like a linear correlation, someone with a math mind may figure out the formula. The rest can be done by xrandr. No extra tools needed.
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4460
Location: King's Lynn, UK.

PostPosted: Wed 10 Oct 2018, 07:59    Post subject:  

Thanks for the explanation, Mochi.

No explanation was forthcoming about that

Code:
2>/dev/null


...at the time. As I said, I didn't question it, simply because it 'worked' (and did what I wanted). Perhaps I should learn to be a wee bit more inquisitive!

The one thing I do know about /dev/null is that it's more or less a 'black hole'; a means to dispose of extraneous code you don't want hanging around, so you pipe it to /dev/null & it 'disappears' into thin air.

Is that a reasonable analogy? Laughing

Cheers.


Mike. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1716
Location: Japan

PostPosted: Wed 10 Oct 2018, 08:20    Post subject:  

Mike Walsh wrote:
Is that a reasonable analogy? Laughing:
I'm afraid not.
Black holes exist but for devices that can "dispose of extraneous code" we may still have to wait a couple of years Wink
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5330
Location: Republic of Novo Zelande

PostPosted: Wed 10 Oct 2018, 12:40    Post subject:  

@Mike - my question about how the icon appears in the tray is actually aimed at trying to get rid of the need to restart X (which ditches any open windows)

My method of getting icons into the tray is to add appropriate code to /root/.jwmrc-tray and then restarting the WM (JWM in my case). This method minimises disruption to the user.

However - it is only my assumption that the restartX required by your pet is for the purposes of getting the icon in place - I am probably wrong and it may be for other reasons.

If there was a way to get rid of the need to restartX the pet would be much better. (My system has no persistence so I rely on pets that can be loaded on the fly as needed - and reboots or X restarts are problematic for me as they trash my "current running environment").

I will see if I can rearrange your pet to avoid X restart.

cheers!
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5330
Location: Republic of Novo Zelande

PostPosted: Wed 10 Oct 2018, 12:50    Post subject:  

MochiMoppel wrote:
greengeek wrote:
What do you see if you enter:
xrandr --verbose
does it show any comments about "backlight"?
Backlight: 0 (0x00000000) range: (0,10)


What happens if you try the following commands (substituting your xrandr display identifier for LVDS1)?

Code:
xrandr --output LVDS1 --set BACKLIGHT 5

Code:
xrandr --output LVDS1 --set BACKLIGHT 10

("BACKLIGHT" must be uppercase)


EDIT : Reminder to self:- make a trial script using:
Code:
xrandr | grep " connected " | awk '{ print$1 }'

to identify display for xrandr to control BACKLIGHT on.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3579
Location: holland

PostPosted: Wed 10 Oct 2018, 14:13    Post subject:  

greengeek wrote:
However - it is only my assumption that the restartX required by your pet is for the purposes of getting the icon in place - I am probably wrong and it may be for other reasons.


The restart X is needed to execute /root/Startup/ScreenControl.sh
(as all scripts in /root/Startup/ will be executed at login)
But you can run in terminal:
Code:
/root/Startup/ScreenControl.sh

Instead of restarting X
(or just click on /root/Startup/ScreenControl.sh will do also)
Of course the .pet can include pinstall.sh executing /root/Startup/ScreenControl.sh but doing above is easy enough IMO.
I cannot understand btw, what can be the problem when restarting X, but apparently for you there's some issue with that.

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4460
Location: King's Lynn, UK.

PostPosted: Wed 10 Oct 2018, 14:19    Post subject:  

greengeek wrote:
@Mike - my question about how the icon appears in the tray is actually aimed at trying to get rid of the need to restart X (which ditches any open windows)

My method of getting icons into the tray is to add appropriate code to /root/.jwmrc-tray and then restarting the WM (JWM in my case). This method minimises disruption to the user.

However - it is only my assumption that the restartX required by your pet is for the purposes of getting the icon in place - I am probably wrong and it may be for other reasons.

If there was a way to get rid of the need to restartX the pet would be much better. (My system has no persistence so I rely on pets that can be loaded on the fly as needed - and reboots or X restarts are problematic for me as they trash my "current running environment").

I will see if I can rearrange your pet to avoid X restart.

cheers!


Mmm..

Frankly, I don't see how you can.....unless there's a location for JWM stuff that I don't yet know about.

/root/.jwmrc-tray gives definite locations for 'Launcher' items; for positioning of the pager; for the 'Dock.....and for the location of the 'notification area' (but not the contents of same.)

/root/.jwm deals with themes'n'stuff.

/etc/xdg/templates/_root_.jwmrc, AFAIK, deals with WM 'settings' and configuration of 'Menu' stuff. This is where changes are written to before running 'fixmenus', after which you re-start 'X' to complete the changes.

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


Mike. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------


Last edited by Mike Walsh on Wed 10 Oct 2018, 14:26; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 5 of 6 [84 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0859s ][ Queries: 12 (0.0123s) ][ GZIP on ]