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 Tue 18 Sep 2018, 15:05
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 1 of 3 [35 Posts]   Goto page: 1, 2, 3 Next
Author Message
Mike Walsh


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

PostPosted: Thu 13 Sep 2018, 16:43    Post subject:  Brightness & colour temperature control for desktop PCs
Subject description: Inspiration from johnywhy, assistance from Fredx181.....
 

Evening, all.

I had a gander at johnywhy's 'Simple brightness slider' a couple of days ago. It's a neat idea, and it's something I was tinkering with the idea of 2-3 years ago, before I knew much at all of how Puppy works.

I haven't yet tried it on the old Dell lappie. But it doesn't work at all on the big old Compaq desktop.

Simple reason being, that the directory Johny's based this around, /sys/class/backlight, although it exists on a desktop install.....there's nothing in there. The cupboard is bare, boys & girls!

-------------------------------------

I still wanted to find summat that would work for me, so I started searching the 'net.

Tried 'xbacklight'. Nope. Didn't do anything.

Tried 'xgamma'. Weeell.....it kinda worked. Sort of. It's supposed to work very much the same way as RedShift's brightness slider does - by manipulating the gamma 'ramp'. Except where RedShift makes a half-way decent job of things, this just makes everything look very odd..!

Then I tried another one, which is (to the best of my knowledge) built-in to all Linux distros; 'xrandr'. Aha....

----------------------------------------

I got this from a thread on askubuntu.com, where I started poking around after one of Johny's links sent me there.

https://askubuntu.com/questions/149054/how-to-change-lcd-brightness-from-command-line-or-via-script

We're looking at the second reply here. Essentially, you run this command:-

Code:
xrandr -q | grep " connected"


.....hit 'Enter', and, in the string that's returned, the very first item is the reference for your specific monitor.....the way Puppy is seeing it. In my case,

Code:
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 304mm x 228mm


.....it's 'VGA-0', although in the answer itself, Ubuntu was seeing this guy's monitor as 'LVDS1'???

So; you take that first item. You insert it into the following command, like so (using my personal example):-

Code:
xrandr --output VGA-0--brightness 0.5


.....where the number at the end represents the brightness value recognised by 'xrandr'. 0.0 is full dark; 1.0 is full bright. It'll recognise down to 0.01 steps.

To check whether this will work for you, we'll borrow a tip from johnywhy's thread. Open a terminal, enter:-

Code:
yad --scale --print-partial


.....and hit the 'Enter' key.

You should get a wee YAD box appear with a slider in it. Click on the slider and move it back & forth, and, as you do so, you should see a series of readouts in the terminal, showing rising & falling values as you move the slider up & down. If you do, YAD's behaving itself, and performing as we want it to.....this is the slider's 'output', printed to the terminal.

Fred's given invaluable help with this, and added some stuff to the script which runs the first command, extracts that first item and inserts it into the second command, running that at the appropriate time. Thus, no need to figure out what your monitor is designated as, since the script 'detects' it automatically.

------------------------------------------------

I've put together a slider and tray icon for this. No MenuEntry; at startup, the tray icon is placed in the notification area, and you simply click it to bring the control up, and click 'Done' when finished. I was going to use the '--close-on-unfocus' option with this, where you can click anywhere on your desktop and it'll close, but it seems the ROX 'pinboard' is not recognised as a viable 'window', the way most DEs are.....so, 'Done' it is.





The slider runs from the tray icon below; the black & yellow split circle:-





You won't need an up-to-date version of YAD for this; it works fine even with the elderly version included in most Pups by default. Bottom line; with YAD's backward compatibility, whatever version you have on your system, it'll run.

The Brightness Control .pet is attached below. If needed, you can find 'generic' versions of YAD 0.40.0 @ my G-Drive, as detailed below.

The .pet itself is architecture-independent.

---------------------------------------------------

Thanks to Johny for the inspiration, and to Fred for his usual patient & helpful assistance. Here's hoping some of you may find this useful; after all...

.....why should laptops have all the fun?

Enjoy.


Mike. Wink

Attachments:-

'Generic' .pets of the current YAD (v0.40.0) available from my G-Drive.

32-bit & 64-bit.

All .pets from this thread attached below.
ScreenControl_redshift-v1.4-noarch.pet
Description  Dual-slider ScreenControl utility, v1.4 - noarch (needs redshift command-line utility installed from PPM)
pet

 Download 
Filename  ScreenControl_redshift-v1.4-noarch.pet 
Filesize  24.89 KB 
Downloaded  3 Time(s) 
ScreenControl-v1.3-amd64.pet
Description  ScreenControl v1.3 - SCT-based 64-bit .pet
pet

 Download 
Filename  ScreenControl-v1.3-amd64.pet 
Filesize  28.83 KB 
Downloaded  0 Time(s) 
ScreenControl-v1.3-i686.pet
Description  ScreenControl v1.3 - SCT-based 32-bit .pet
pet

 Download 
Filename  ScreenControl-v1.3-i686.pet 
Filesize  28.7 KB 
Downloaded  5 Time(s) 
Brightness_control_4_desktop_PCs-v1.1.pet
Description  Tray-based brightness slider for desktop PCs, utilising xrandr
pet

 Download 
Filename  Brightness_control_4_desktop_PCs-v1.1.pet 
Filesize  24.7 KB 
Downloaded  15 Time(s) 

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


Last edited by Mike Walsh on Sun 16 Sep 2018, 19:27; edited 6 times in total
Back to top
View user's profile Send private message Visit poster's website 
Mike Walsh


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

PostPosted: Thu 13 Sep 2018, 22:24    Post subject:  

Hm! A slight case of two apps apparently using the same set of commands here, kiddiwinks. 'Twould appear that I've inadvertently isolated the same command that RedShift must use for its own brightness control.....

(*Aw, shucks..! Hell & tarnation.....*)

Now then; let me state, here & now (to quash any confusion); this Brightness Control .pet works perfectly, as a standalone app.

Which is absolutely true. Let me explain.....

----------------------------------------------------

If (as I do) you use RedShiftGUI - to control screen hue late at night - and, moreover, have it set to auto-start - whether sym-linked into /root/Startup, or by some other means - it apparently interferes with the command in use by the Brightness Control .pet.

I put this thing together this afternoon, after Fred had answered a query or two about its operation on the YAD tips thread. It was working perfectly at that time.

Installing the .pet into another Pup this evening, it installed and worked exactly as it should do. Except for one small, trifling detail.....

It didn't actually do what it was supposed to!

(*sheesh*)

Anyway; I tried the same terminal command that makes this work in 3 or 4 other Pups. Exactly the same thing again. Then I booted back into Slacko 560, where I'd originally been putting this thing together, and where I've been for the last 2 or 3 days. Ah, hell.....wouldn't you just know it? Yep; no workee! Curious. Very curious, in fact (given that it worked perfectly earlier on..!)

Then, something occurred to me. Fred had mentioned to me earlier on that RedShiftGUI also has a 'true' brightness control. A-ha. I wonder.....

As an experiment, I turned RedShift off temporarily. Clicked on the tray icon for the Brightness Control, and.....wouldn't you just know it?

Working perfectly. So; RedShift was somehow interfering with the command in use by the Brightness Control.

RedShift also has a feature whereby if you right-click the tray icon, it 'disables' the normal cycle of getting redder as time goes by (I have mine set for a very slow transition, taking something like 2 hours to reach its final setting, OK?) To indicate this, the normally red tray icon turns blue.....and RedShift no longer does its thing until you right-click the icon again, turning it red again.

To check this, I brought RedShift's window up, and experimented with the Brightness Control, together with right-clicking RedShift's icon back & forth. And uncovered the mystery in the process..!

---------------------------------------------------------

In normal operation, RedShift's icon is red, and the window looks like this:-





When it's like this, all the Brightness Control does is flicker when you move the slider.....but the screen remains at full brightness. When you right-click the tray icon, to 'disable' RedShift, this happens:-





Notice the previously blank check-box for 'Disable auto-adjust'. It now has a tick in it.....and in this condition, the Brightness Control app's slider works, dimming or brightening the screen (as it's meant to).

Conclusion? When RedShift is in normal operation, after sunset its own internal coding is obviously disabling xrandr from performing this particular operation. So.....if you run RedShift, disable it by right-clicking the tray icon IF you want the Brightness Control to work. Bit pointless, I know, given that RedShift has its own brightness control that isn't affected by all this. Conversely, after sunrise (when it's quit doing its thing, and has 'turned off' for the daylight hours), this particular bit of coding has obviously been disabled for the duration by the geo-location stuff.

If, however, you don't run RedShift, there IS no problem!

Talk about 're-inventing the wheel', huh...? How's that for detective work? Laughing Laughing


Mike. Wink

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

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


Joined: 11 Dec 2013
Posts: 3352
Location: holland

PostPosted: Fri 14 Sep 2018, 12:32    Post subject:  

Hi Mike,

Quote:
Conclusion? When RedShift is in normal operation, after sunset its own internal coding is obviously disabling xrandr from performing this particular operation.


So... if I understand well, your brightness slider doesn't work when Redshiftgui is in "night mode" ?
For me it's not the case, brightness slider works well in that case, but... I'm on a laptop Smile
But I do experience something else: when using the brightness slider, the "night" setting from Redshifgui is disabled (again to full "blueish")
Not a big problem though (all I have to do is go in the Redshifgui settings and adjust the night temperature slider a little and it goes back to how it was).
EDIT: But then brightness is set to 100% again, I set it earlier to 70%, oh well..

BTW: I found that redshift (commandline program) can do the same as xrandr, setting the brightness only.
Below only needs xrandr to set the initial brightness value, the actual brightness setting is done by redshift.

Code:
XR=$(xrandr --verbose | grep -i brightness | cut -f2 -d ' ' | head -n1)
BrCur=`awk "BEGIN {print $XR*100}"` # calculate, so e.g. 0.5 gets 50
BrMax="100"
BrMin="10"
yad --undecorated --on-top --geometry=450x70-30-30 --text="                  SCREEN   BRIGHTNESS   CONTROL" --scale --value $BrCur --print-partial --min-value $BrMin --max-value $BrMax --button="Done":1 | while read BrNew; do
redshift -l 00.00:00.00 -o -b $(awk "BEGIN {print $BrNew/100}")
done


Perhaps this doesn't give the problems you described above.

Fred

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


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

PostPosted: Fri 14 Sep 2018, 17:08    Post subject:  

Hi, Fred.

Umm; that doesn't work for me. Doesn't seem to do anything, actually.....not on my desktop, anyway. But I've got round it, by returning to Puppy 'first principles'; K.I.S.S.....what else?

I'm going to do away with RedShift throughout the kennels.....and use this instead:-

"SCT" - (Set Colour Temperature)

Labbe5 actually discovered this around a year ago, though he's just recently re-posted about it:-

http://www.murga-linux.com/puppy/viewtopic.php?t=111450

It's a wee binary, around 8-12k in size, that allows you to set colour temperature directly through the terminal, instead of relying on RedShift's complex geo-location stuff. And since I'm not too concerned about losing all the complex automation that goes with it.... I think I can click a button to change screen temperature if, as & when I need to!

RedShift's ( and, indirectly, f.Lux's) big selling point in all this is that it's all taken care of for you, and implemented totally automatically (without you needing to concern yourself about it). But it does add a big chunk of complexity to the process.

I normally have my lower limit in RedShift set to 3600.....that's a comfortable night screen 'temperature' for my eyes. I vaguely remember you had to compile the binary back then, but it's as simple as YAD to do; even simpler, I seem to recall.....there was an auto-compile script included. Now, it appears to be in the repos.

Anyway; I've got it in most of my Pups already. To implement, I simply enter

Code:
sct 3600


.....in the terminal, and it sets it immediately.

So; I've put a tiny script together to be put in /usr/local/bin, named (appropriately) 'sct.sh'. Like so:-

Code:
#!/bin/sh
#
# Launcher for sct ['Set Color Temperature']
#
sct 3600


Then, /usr/local/bin/EMBC.sh (the Brightness control YAD GUI) calls it via an additional button, like so:-

Code:
#!/bin/bash
#
# Brightness control slider for desktop 'external' monitors - with inspiration from johnywhy, and many thanks to Fredx181
#
# detect monitor
MON=$(xrandr -q | grep " connected" | cut -f1 -d ' ')
# find current xrandr brightness value
XR=$(xrandr --verbose | grep -i brightness | cut -f2 -d ' ' | head -n1)
BrCur=`awk "BEGIN {print $XR*100}"` # calculate, so e.g. 0.5 gets 50
BrMax="100"
BrMin="10"
yad --undecorated --on-top --geometry=450x70-30-30 --text="                  SCREEN   BRIGHTNESS   AND   TINT   CONTROL" --scale --value $BrCur --print-partial --min-value $BrMin --max-value $BrMax --button="Night Tint":sct.sh --button="Done":1 | while read BrNew; do
# division using awk, so xrandr value gets e.g. 0.5 rather than 50
xrandr --output $MON --brightness $(awk "BEGIN {print $BrNew/100}")
done






If I want to use the slider, it auto-disables sct.....but when I have it dimmed, I don't want the red tint on anyway. When I'm finished, I just hit the 'Night Tint' button.....and colour temperature is restored at full brightness, regardless of slider position. Next time you open the Brightness control, the slider is back at 100.

Neat, & simple. To change the value to one that's comfortable for your own eyes, experiment with sct in the terminal, then edit /usr/local/bin/sct.sh to suit.

UPDATED VERSION (below):- The 'Night' button sets it immediately. The 'Day' button returns you to the standard 6500 daytime setting.

Well, it works for me.... (*shrug*) Smile

------------------------------------------
EDIT:- Added a second small sct script & added another button (for the 'daytime' setting - see above); added 'Info' button to explain 'sct' usage; compiled the 64-bit version of sct, and made up .pet packages for both 32- and 64-bit Pups.....with the sct binary included in the package.





Pets attached below.


Mike. Wink
Brightness_and_tint_4_desktop_PCs-v1.2-i686.pet
Description  Tray-based bright/tint control - 32-bit
pet

 Download 
Filename  Brightness_and_tint_4_desktop_PCs-v1.2-i686.pet 
Filesize  29.15 KB 
Downloaded  8 Time(s) 
Brightness_and_tint_4_desktop_PCs-v1.2-amd64.pet
Description  Tray-based bright/tint control - 64-bit
pet

 Download 
Filename  Brightness_and_tint_4_desktop_PCs-v1.2-amd64.pet 
Filesize  29.34 KB 
Downloaded  5 Time(s) 

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

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


Joined: 11 Dec 2013
Posts: 3352
Location: holland

PostPosted: Sat 15 Sep 2018, 15:16    Post subject:  

Mike Walsh wrote:
Umm; that doesn't work for me. Doesn't seem to do anything, actually.....not on my desktop, anyway.


Could be because you don't have redshift installed maybe ? (not to confuse with redshiftgui, redshift is a command line program)
But... nevermind... you made it very nice now with the "Night" and "Day" buttons Smile
Didn't know about sct, btw, nice !

Fred

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


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

PostPosted: Sat 15 Sep 2018, 15:28    Post subject:  

Hi, Fred.

Well, sct is very lightweight (back to Puppy 'first principles', like I said), and, TBH, I'm not so interested in the transition period as I am the end values; the day-time setting, and the night-time setting. It's a good find by labbe5.

Sct pretty much achieves the same end result as RedShift, it's just manual, rather than automatic. So you can get away with 2 buttons, one for each of the two values.

And, er, BTW; I think you're probably right about RedShift not being installed at the time when I tried that script modification. I was in the middle of uninstalling/changing-over from one to t'other last night, across the whole kennels.......I couldn't honestly tell you which Pup I was in, nor what the state of play was at the point when I tried the new script. 'Twas a real case of the left-hand not being at all sure quite what the right-hand was getting up to, at one stage.

Even I was getting confused..! Laughing


Mike. Wink

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

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


Joined: 16 Jul 2013
Posts: 880
Location: Mid-mitten, USA

PostPosted: Sat 15 Sep 2018, 18:28    Post subject:  

This is neat Mike - I feel every desktop environment should include both a GUI brightness and tint control. This seems an excellent candidate for WoofCE inclusion... very lightweight!

Quick question/idea (go ahead and ignore if ya' desire); Why not simply a slider for both? It wouldn't require modifying a text entry for sct, and as an example I own a particular Dell laptop with an awfully "cold"/blue-ish LED-backlit display that can be hit-or-miss when zeroing in on sct/color temp to make it presentable (set a temp, browse/play with apps, still too cold/warm, set again, browse some more, repeat, etc...) - having an already-open, background GUI slider to tweak on the fly would seem to be perfect for that sort of fine-tuning.

(edit to add); I suppose one could even add an "SCT Save" button to save the current tint setting, and then toggle that "nightime" setting on/off with a "Day/Night" button... Question

Just a passing thought(s)! Embarassed

BTW, I've ran across another "modern-but-pleasant" free font today that I'm really enjoying - Lato - thought you might like to give it a peek, too, if you haven't already;

http://www.latofonts.com/lato-free-fonts/

Bob
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3352
Location: holland

PostPosted: Sat 15 Sep 2018, 20:14    Post subject:  

Moat wrote:
This is neat Mike - I feel every desktop environment should include both a GUI brightness and tint control. This seems an excellent candidate for WoofCE inclusion... very lightweight!

Quick question/idea (go ahead and ignore if ya' desire); Why not simply a slider for both? It wouldn't require modifying a text entry for sct, and as an example I own a particular Dell laptop with an awfully "cold"/blue-ish LED-backlit display that can be hit-or-miss when zeroing in on sct/color temp to make it presentable (set a temp, browse/play with apps, still too cold/warm, set again, browse some more, repeat, etc...) - having an already-open, background GUI slider to tweak on the fly would seem to be perfect for that sort of fine-tuning.

(edit to add); I suppose one could even add an "SCT Save" button to save the current tint setting, and then toggle that "nightime" setting on/off with a "Day/Night" button... Question

Just a passing thought(s)! Embarassed

BTW, I've ran across another "modern-but-pleasant" free font today that I'm really enjoying - Lato - thought you might like to give it a peek, too, if you haven't already;

http://www.latofonts.com/lato-free-fonts/

Bob


No idea yet how to combine two sliders for brightness and night-time color, anyway here's what I experimented with slider for changing sct temperature value:
Code:
[ -f /tmp/sct_value ] && SctCur=$(cat /tmp/sct_value) || SctCur=6500
SctMax="6500"
SctMin="2400"
yad --undecorated --on-top --geometry=450x70-30-30 --text="\t\t\t\t\tRedshift Control" --scale --value $SctCur --print-partial --min-value $SctMin --max-value $SctMax --button="Done":1 | while read SctNew; do
sct $SctNew
echo $SctNew > /tmp/sct_value
done


Fred

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


Joined: 23 Jul 2012
Posts: 1160
Location: Vancouver, BC Canada / Entebbe, Uganda Africa!?!

PostPosted: Sun 16 Sep 2018, 00:01    Post subject:  

fredx181 wrote:
No idea yet how to combine two sliders for brightness and night-time color


Code:
yad --form --field="Brightness:scl" --field="Night Color:scl"

_________________
X-slacko-5b1 - X-tahr-2.0 - X-precise-2.4
X-series repo
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 11005
Location: Charleston S.C. USA

PostPosted: Sun 16 Sep 2018, 00:58    Post subject:  

Mike Walsh,

Keep tweaking.
You are going to make something that should be a core feature of any Puppy version.

On a desktop.
I just wonder how often it is going to be needed.
I always set the monitor, using the monitors internal controls. One time setup, and never do it again.
It is in the same place, same room, same lighting, all the time.

Now a laptop.
Those things constantly need to adjust the screen brightness and color temp.

Thanks for working on this!!

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1615
Location: Japan

PostPosted: Sun 16 Sep 2018, 01:56    Post subject:  

@Mike @Fred: Before you move into fancy stuff like tint control here some thoughts about the initial brightness pet:

- The comment in the script reads "Brightness control slider for desktop 'external' monitors". Whatever this is supposed to mean it does not work if the external monitor is attached to a laptop.
In such case 2 monitors are connected but the script takes only the current value of whatever monitor is first in the list and as soon as the slider is moved xrandr produces an error as it can't accept a new value for 2 monitors at the same time. You end up with a nice slider that does nothing.

- As already mentioned Yad is not installed in all Puppies. The newest Yad is even less common. That brings up the question: Is Yad the right tool or wouldn't gtkdialog be the better choice. Apart from the guaranteed availability in all Puppies something like "--close-on-unfocus" is standard in gtkdialog and the a clunky pipe to "while read BrNew; do" would also be unnecessary. And yes, it would allow 2 or more sliders in the same dialog.
Back to top
View user's profile Send private message 
Moat


Joined: 16 Jul 2013
Posts: 880
Location: Mid-mitten, USA

PostPosted: Sun 16 Sep 2018, 02:59    Post subject:  

fredx181 wrote:
... here's what I experimented with slider for changing sct temperature value:


Works!! Smile (although, admittedly, on ETP's Cinnamon remix of your Bionic Dog...)

And also confirming what both of you guys have already found; that adjusting either one on it's own - brightness or tint - automatically negates the other one's previous setting. My half-hearted guess is that both are adjusting the same gamma arguments; brightness = all three colors (red, green, blue) go up and down together, while sct likely targets only green and blue - leaving red to 'shine through' as the dominant, warming color at lower K settings. And touching either initially reverts all three colors to 100%, I'm thinkin' (sure looks that way...).

So it appears as (probably!) only one is useable at a time - either brightness OR tint. An alternative approach that comes to mind would be a brightness control that actually targets the hardware, itself - as in the fn/brightness keys, or tray applets as available in DE's other than JWM. For instance, I just tried that on an Ubuntu Mate install, using Mate's tray brightness slider and Fred's tint slider script - and indeed then, both work - each retaining their respective adjustments. But another half-hearted guess would be that such might entail a considerably greater amount of code (i.e.; detecting the target computer's brightness hardware controller?), and might be beyond what Mike may wish to dig himself into. Laughing

All good, though - great on ya', Mike, for pursuing this little useful utility/idea!! Cool Certainly well beyond my pay scale... Embarassed

Bob
Back to top
View user's profile Send private message 
Mike Walsh


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

PostPosted: Sun 16 Sep 2018, 09:38    Post subject:  

Goodness, gracious me. I had no idea something like this would provoke such debate.....

Before I go any further, I want to re-state heartfelt thanks to two individuals:-

johnywhy - for giving me the idea in the first place.

fredx181 - without whose sterling work none of this, so far, would have been possible.

Once again, I refuse to take credit for other people's work. I'm happy to incorporate it into something in which I've attempted to utilise that effort.....but the credit will always be very clearly stated.

Let me try and respond to various commenters:-

------------------------------------------------------

@ moat:- Glad you like the concept, Bob. It came about through finding out that johnywhy's script wouldn't work for me.....because on my desktop, at least, /syc/class/backlight was empty (and thus nowt to work with!)

Which is why I started digging around for alternatives, as detailed above. The eventual candidates were either already in Puppy, or were so small as to make no difference; I remember you being very enthusiastic about sct when labbe5 first discovered it a while back.

Like you, I, too, feel that something like this is an essential tool for incorporating into Puppy. Although I like RedShiftGUI, I do feel that all that geo-location stuff is not, strictly speaking, really necessary. I'm quite capable of making the adjustment manually when I want to. And, yes, you're quite right; the two do effectively cancel each other out. Which suits me, personally; when I have the screen dimmed, I don't want it 'tinted'. Conversely, when I have the 'red-shift' effect enabled at night, I find I don't need it dimmed as well.

As for your observations about adding the ability to directly address the hardware so that both can work at the same time? Bob, if we do that, it will add further coding.....and no, 'it's not a route I want to pursue. The whole intention of adding sct into the mix was as a lightweight, 'manual' replacement for RedShiftGUI. I have no intention of bloating it up the size of RedShiftGUI; if we do that, I might just as well stick with it, and give up on this wee project altogether!

-----------------------------------------------------

@ MochiMoppel:- I know you've always been a proponent of keeping Puppy (and its code) as small and lightweight as possible.....and of making use of what's already there by default.

I find I'm starting to see the merit in such a policy. Xrandr is already there. Sct, though it isn't, is so small as to be negligible. Okay, yad is a bit bigger, it's true.....but I still don't feel that 180k or so is 'out-of-the-way'. I have experience with yad already. With gtk-dialog, I would be starting from scratch again.....and my personal situation is not such that it permits me endless hours in front of this thing.

Moreover, despite compiling supposedly being kernel-specific, I've found with both yad and sct that it doesn't matter what Puppy they've been compiled in.....they will work across a broad range of Pups of that particular architecture. Maybe not 'optimized' to perfection (and thus not really the 'done' thing), but well enough to be fully functional.

I understand where you're coming from when you deplore those of us who insist on adding GUIs to apps that are essentially command-line in nature. It's more 'bloat', isn't it? The sole reason I have for doing this with various items is that I'm thinking of the 'newbies' and Windoze 'refugees'; I can sympathize with 'em, 'cos I was in their shoes as little as 5 years ago. They're coming from a GUI-centric eco-system, where console work is very much the exception as opposed to the rule.

And it's also why I firmly believe in making as big a choice of apps, etc., available to Puppians as possible.....even if it does duplicate existing items.

I confess, I hadn't considered the scenario of folks connecting external monitors to laptops. It's not something I've ever seen myself doing.....but in that case, johnywhy's brightness control probably would work better, as it makes use of existing laptop 'stuff'. The scenario for this is a monitor as a standard component of an existing desktop tower set-up.

-------------------------------------------------------------------

@ bigpup:- I'm playing around with this. My own case is that my eyeballs were permanently weakened following several years working in the mineral-processing industry. I just cannot handle bright light.....and that's all there is to it.

We'll see how it progresses.

-------------------------------------------------------------------

@ rg66:- RG, thanks for that! I see what's been implemented.....making the scale an 'element' of a field. That hadn't occurred to me.....and I haven't come across mention of that particular trick in the man pages anywhere.

I shall experiment.....and see what I can do with it.


One fact is absolutely inescapable.....and is as true today as it's always been. No matter what any of us 'packagers' do, we 'cannae please all the folk, all of the time'. There will always be someone finding fault with what you do, convinced there's a better (different? alternative?) way that something-or-other should have been done. In that light, it's not hard to see how Redmond's products end up being as bloated as they are; they're attempting to be 'all things to all men'.....and building every last possible bit of a vast choice of different ways of doing the same thing into the base OS itself.

In some ways, they're merely reaping the fruits of all those years of plotting & conniving to ensure Windows was the dominant OS; it's given them a much larger user-base to have to satisfy and keep happy!


Mike. Wink

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

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


Joined: 11 Dec 2013
Posts: 3352
Location: holland

PostPosted: Sun 16 Sep 2018, 09:40    Post subject:  

Another study: Smile EDIT: Mike, just see your post, further discussing and tweaking can also be in another thread if you want. Wink
Code:
#!/bin/bash
#

color_ctrl () {
[ -z "$(cat /tmp/BR_value 2> /dev/null)" ] && echo 100 > /tmp/BR_value
# export BR_VALUE=$(cat /tmp/BR_value 2> /dev/null)
[ "$(cat /tmp/clr_temp 2> /dev/null)" ] && TCur=$(cat /tmp/clr_temp 2> /dev/null) || TCur=6500
TMax="8000"
TMin="2000"
yad --undecorated --on-top --geometry=450x70-30-150 --text="\t\tRedshift Temperature Setting" --scale --value $TCur --print-partial --min-value $TMin --max-value $TMax --button="Done":1 | while read TNew; do
echo $TNew > /tmp/clr_temp
redshift -l : -O $TNew -b $(awk "BEGIN {print $(cat /tmp/BR_value 2> /dev/null)/100}") 1>/dev/null
done
}
export -f color_ctrl

[ -z "$(cat /tmp/clr_temp 2> /dev/null)" ] && echo 6500 > /tmp/clr_temp
[ "$(cat /tmp/BR_value 2> /dev/null)" ] && BrCur=$(cat /tmp/BR_value 2> /dev/null) || BrCur=100
BrMax="100"
BrMin="10"
yad --undecorated --on-top --geometry=450x70-30-30 --text="                  SCREEN   BRIGHTNESS   CONTROL" --scale --value $BrCur --print-partial --min-value $BrMin --max-value $BrMax --button="Tint":'bash -c color_ctrl' --button="Done":1 | while read BrNew; do
echo $BrNew > /tmp/BR_value
redshift -l : -O $(cat /tmp/clr_temp) -b $(awk "BEGIN {print $BrNew/100}") 1>/dev/null
done

This is just using redshift, so it's required to have it installed, not redshiftgui.

Clicking the 'Tint' button shows another slider for setting the temperature.
My goal was that both sliders operate independently, so not -for example- if you adjust the brightness that the value for the tint get reset or vice versa.

rg66 wrote:
fredx181 wrote:
No idea yet how to combine two sliders for brightness and night-time color

Code:
yad --form --field="Brightness:scl" --field="Night Color:scl"


Yes, but you cannot "preview" that way AFAIK.

MochiMoppel wrote:
- The comment in the script reads "Brightness control slider for desktop 'external' monitors". Whatever this is supposed to mean it does not work if the external monitor is attached to a laptop.
In such case 2 monitors are connected but the script takes only the current value of whatever monitor is first in the list and as soon as the slider is moved xrandr produces an error as it can't accept a new value for 2 monitors at the same time. You end up with a nice slider that does nothing.


Perhaps the above script solves that problem (doesn't use xrandr), I cannot test atm.

Fred
2018-09-16-151816_504x284_scrot.png
 Description   
 Filesize   127.13 KB
 Viewed   75 Time(s)

2018-09-16-151816_504x284_scrot.png


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


Joined: 26 Jan 2011
Posts: 1615
Location: Japan

PostPosted: Sun 16 Sep 2018, 10:29    Post subject:  

Mike Walsh wrote:
Xrandr is already there. Sct, though it isn't, is so small as to be negligible. Okay, yad is a bit bigger, it's true.....but I still don't feel that 180k or so is 'out-of-the-way'.
Size is not an issue but availability is. At least for me.
Quote:
I understand where you're coming from when you deplore those of us who insist on adding GUIs to apps that are essentially command-line in nature. It's more 'bloat', isn't it?
It's not more bloat and I never deplored anything. I have no idea what you are referring to
Quote:
I confess, I hadn't considered the scenario of folks connecting external monitors to laptops. It's not something I've ever seen myself doing.
A very common scenario in our company and even for me at home. I seldom use my tower anymore since a laptop is so much quieter. Nevertheless I can't work with a tiny laptop screen and need a big external monitor. And people who do use a tower might use them with 2 monitors Wink

Yad is fine if you are comfortable with it. The script is your baby and can do the job. My only intention was to give feedback and let you know that it fails in a scenario like mine. I leave it to you to fix or ignore it.

fredx181 wrote:
Perhaps the above script solves that problem (doesn't use xrandr), I cannot test atm.
xrandr wouldn't be a problem.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [35 Posts]   Goto page: 1, 2, 3 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.0977s ][ Queries: 12 (0.0060s) ][ GZIP on ]