autolume / autolux

auto luminence for nix
MIT License
44 stars 1 forks source link

Brightness doesn't set in 1 go #15

Closed ajkothari13 closed 6 years ago

ajkothari13 commented 6 years ago

Hi, Again :)

When I set brightness using shortcut keys and change screen / page, then return to the page on which brightness was set - the app won't go back to set brightness.

For example, I have opened a page on firefox and it is bright so I use the keyboard shortcut key to reduce the brightness. Then I open another tab for some work. When I get back to previous tab where I had lowered brightness, the level would be high / same as it has not been set.

Please help.

okayzed commented 6 years ago

The brightness is learned over some amount of time, instead of being set immediately. To give an example of what I mean, here is my log:

the events are MODEL (meaning we ask the model for the current brightness we should use), INPUT - a new brightness was detected and LEARN - the anticipated brightness that we will use the next time.

In the below event log, I adjusted my brightness by -10 and the model learns over the next minute or so what my preferred brightness at this time of day is. Instead of immediately taking the value set, autolux averages over the last 7 values set - if you want to burn in a value, leave the window focused for 30 seconds to a minute.

okay@chalk:~/tonka/src/autolux$ autolux
MODEL|TS:1520348217, LUMA:00000, NEW GAMMA:1.00, NEW BRIGHTNESS: 25/100
INPUT|TS:1520348221, LUMA:00000, CUR:15.00, EXP:25 <--- changed brightness by -10 to 15
LEARN|TS:1520348221, LUMA:00000, HOUR: 06:50, PREV:25, NEW:21 <--- learned new brightness of 21 (from 25)
INPUT|TS:1520348223, LUMA:00000, CUR:15.00, EXP:21 <--- brightness is still 15 (didn't change)
LEARN|TS:1520348223, LUMA:00000, HOUR: 06:50, PREV:21, NEW:18 <--- learned 18
INPUT|TS:1520348226, LUMA:00000, CUR:15.00, EXP:18
LEARN|TS:1520348226, LUMA:00000, HOUR: 06:50, PREV:18, NEW:16 <--- learned 16
ajkothari13 commented 6 years ago

I am using Ubuntu 17.10 with 2 DEs.

  1. LXDE
  2. Deepin DE

The issue is coming only on Deepin DE as things were fine till I was using LXDE.

Now, I reduced brightness and waited for more than a minute on this page

Then went to another page. Came back to the above linked page and brightness was back to higher levels.

okayzed commented 6 years ago

ah, I see - I misunderstood what you were saying earlier.

to clarify: it was working in LXDE and not working in Deepin DE?

my current thoughts:

questions:

checking screenshots are captured correctly

run the command:

import -colorspace gray -screen -w root -quality 20 test.png

and verify the contents of test.png look like your screen

checking active window is picked up

in a terminal, can you run:

while true; do xdotool getwindowfocus getwindowpid; sleep 1; done 

and navigate around the tabs to make sure that the active pid is being picked up.

similarly, run:

while true; do xdotool getwindowfocus getwindowname; sleep 1; done 

to verify the active window title is correctly changing when switching tabs.

ajkothari13 commented 6 years ago

I logged into LXDE then came back to Deepin DE. Things are looking much better. But i triple checked: This page never goes back to reduced brightness level after visiting it back.

okayzed commented 6 years ago

ok, i see what you are saying. the same happens for me.

i setup tabs like:

[tab A], [tiddly wiki], [tab B] and set tab A to have low brightness and tab B to have high brightness. tidldly wiki is taking the brightness of whichever tab was last visited. i think this indicates a problem with how autolux is searching for windows by title. this is a good lead!

ajkothari13 commented 6 years ago

I am sorry if I was unable to explain properly. Let me, now:

  1. There are say 5 tabs open
  2. [Tab A], [tiddly wiki], [Tab B], [Tab C], [Tab D]
  3. I reduce brightness of [tiddly wiki] and move to [Tab B]
  4. Come back to [tiddly wiki] and brightness goes back up high
  5. Again reduced brightness of [tiddly wiki]

After spending 15 minutes on a youtube video on [Tab C], just now I came back to [tiddly wiki]. Now, the brightness is still higher but not as high as before.

Should I create a screen recording along with tests? Might help.

okayzed commented 6 years ago

Can you try upgrading your autolux and re-trying?

I adjusted the maximum luminence cap - I think that the tiddly page was accidentally learning from other pages (and vice versa). Now with a raised cap, the tiddly page should hopefully show up with its proper luminence (~52K) instead of being clamped to 45K.

When I looked locally, I saw two pages (tiddly wiki and other page) would both show up as 45K. With adjusted cap to 60K, autolux should be able to differentiate multiple pages better.

ajkothari13 commented 6 years ago

Nice man! it is working again. I did not quite understand what you did, but you understood the issue well. Closing the thread. Big thanks!

okayzed commented 6 years ago

I got your message on IRC about "regarding AutoLux: 1 question - does your tool check time? I just started it now and it dimmed brightness (probably from last evening's session)"

autolux learns over time - it will take a day or two for it to learn. to see what preferences it has learned for you, take a look at: autolux --visualize --plot-luma and autolux --visualize --plot-brightness.

This is what my burned in preferences look like: https://imgur.com/a/cg0oM