topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:34 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: change f.lux brightness mouse remote (like Volume²)  (Read 14211 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
change f.lux brightness mouse remote (like Volume²)
« on: July 02, 2019, 08:28 AM »
Hello,

I'm using f.lux, which allows you to change the screen brightness with Alt+PgDown/PgUp. I'd like a 'remote' so that I can do those changes by moving the mouse cursor to the left side of the screen and use the mouse scroll wheel (down/up).

I'm using Volume² (http://irzyxa.blogsp...com/p/downloads.html) to change the system volume in that way on the right side of the screen and really like that feature, the same for screen brightness would be great!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #1 on: July 02, 2019, 07:04 PM »
Do you have AutoHotkey installed?  If so, try out this simple script:

Code: Autohotkey [Select]
  1. myEdgePixels := 10
  2.  
  3. ~WheelUp::
  4. ~WheelDown::
  5. {
  6.     MouseGetPos, myX
  7.     If ( ( A_ScreenWidth - myX ) <= myEdgePixels )
  8.     {
  9.         If ( A_ThisHotkey = "~WheelUp" )
  10.         {
  11.             SendInput, !{Up} ; Send Alt+Up.
  12.         }
  13.         If ( A_ThisHotkey = "~WheelDown" )
  14.         {
  15.             SendInput, !{Down} ; Send Alt+Down.
  16.         }
  17.     }
  18. }
  19. Return

If you don't have AutoHotkey installed, let me know, and I'll compile this into an executable.  Also, I don't have f.lux installed, so this is untested.

Akertyna

  • Participant
  • Joined in 2019
  • *
  • Posts: 9
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #2 on: July 03, 2019, 03:51 AM »
I know F.lux thanks to Techgara and it is quite fortunate to see someone mentioning it here. Btw, does anyone know how to change the time of when F.lux switches between daytime and nighttime mode? I search on that site but no anser. Thanks!

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #3 on: July 03, 2019, 05:32 AM »
Do you have AutoHotkey installed?  If so, try out this simple script:
[...]
If you don't have AutoHotkey installed, let me know, and I'll compile this into an executable.  Also, I don't have f.lux installed, so this is untested.
I have AutoHotkey installed, but couldn't get your code to work. No idea why... :(

An executable would be welcome!

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #4 on: July 03, 2019, 05:37 AM »
I know F.lux thanks to Techgara and it is quite fortunate to see someone mentioning it here. Btw, does anyone know how to change the time of when F.lux switches between daytime and nighttime mode? I search on that site but no anser. Thanks!
You set your physical location and your "earliest wake time", and based on that f.lux does its thing. :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #5 on: July 03, 2019, 08:56 AM »
I have AutoHotkey installed, but couldn't get your code to work. No idea why... :(

Did you save out the code to a something.ahk file and then run it?

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #6 on: July 03, 2019, 11:59 AM »
Did you save out the code to a something.ahk file and then run it?
Duh! Of course I did forget to try the simplest approach... ;)

But it still doesn't work.

A logical question:

If I fill
"If ( ( A_ScreenWidth - myX ) <= myEdgePixels )"
with probable values for the left side of the screen:
If ( ( 1920 - 10 ) <= 10 )

doesn't that mean that that line will never be able to trigger the following "If ..."?

I changed it to
"If ( myX <= myEdgePixels )"
and that does trigger the following "If ...".

(15 minutes later)

I also adjusted the Up vs. PgUp (Down vs. PgDn) confusion and added CoordMode so the script would not be triggered on the left border of any window that's smaller than fullscreen size:

Code: Autohotkey [Select]
  1. CoordMode, Mouse, Screen
  2. myEdgePixels := 10
  3.  
  4. ~WheelUp::
  5. ~WheelDown::
  6. {
  7.     MouseGetPos, myX
  8.     If ( myX <= myEdgePixels )
  9.     {
  10.         If ( A_ThisHotkey = "~WheelUp" )
  11.         {
  12.             SendInput, !{PgUp} ; Send Alt+PgUp.
  13.         }
  14.         If ( A_ThisHotkey = "~WheelDown" )
  15.         {
  16.             SendInput, !{PgDn} ; Send Alt+PgDown.
  17.         }
  18.     }
  19. }
  20. Return

It works almost perfectly now, just one issue remains: can I 'mute' the wheel output so that when it successfully sends a command to f.lux, it will not also scroll the browser window up or down or change the volume in the media player?
« Last Edit: July 05, 2019, 07:52 AM by brotherS »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #7 on: July 22, 2019, 03:50 AM »
It works almost perfectly now, just one issue remains: can I 'mute' the wheel output so that when it successfully sends a command to f.lux, it will not also scroll the browser window up or down or change the volume in the media player?
skwire? :)

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #8 on: July 22, 2019, 12:50 PM »
That's quite a nifty workaround.
As to:
...It works almost perfectly now, just one issue remains: can I 'mute' the wheel output so that when it successfully sends a command to f.lux, it will not also scroll the browser window up or down or change the volume in the media player?
- I would be interested to see how that unintended consequence might be addressed.

As to:
Btw, does anyone know how to change the time of when F.lux switches between daytime and nighttime mode? I search on that site but no anser. Thanks!
- I'm not sure whether there is in fact any way to control that, as f.lux seems to automatically take it's day/night switch trigger from calculating where it is on the diurnal/nocturnal cycle depicted in its little chart, which is based on the local timezone. You could try to fudge it by forcing it to a different timezone, I suppose, but that might not seem a very satisfactory approach.

Lintalist

  • Participant
  • Joined in 2015
  • *
  • Posts: 120
    • View Profile
    • Lintalist
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #9 on: July 31, 2019, 03:18 PM »
Btw, does anyone know how to change the time of when F.lux switches between daytime and nighttime mode? I search on that site but no anser. Thanks!
Perhaps this program might be of interest as it has lots of manual and automatic options incl timers to change various settings. Quite a learning curve no doubt but perhaps worth the effort. Per monitor (if I'm not mistaken) and freeware and portable :)

clickmonitorddc @ https://clickmonitorddc.bplaced.net/

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #10 on: October 14, 2019, 07:57 AM »
It works almost perfectly now, just one issue remains: can I 'mute' the wheel output so that when it successfully sends a command to f.lux, it will not also scroll the browser window up or down or change the volume in the media player?

The issue is that the code isn't sending a command directly to f.lux.  Rather, it's just blindly sending the Alt+PgUp/Alt+PgDown commands.  Try this:

Code: Autohotkey [Select]
  1. CoordMode, Mouse, Screen
  2. myEdgePixels := 10
  3.  
  4. WheelUp::
  5. WheelDown::
  6. {
  7.     MouseGetPos, myX
  8.     If ( myX <= myEdgePixels )
  9.     {
  10.         If ( A_ThisHotkey = "WheelUp" )
  11.         {
  12.             SendInput, !{PgUp} ; Send Alt+PgUp.
  13.         }
  14.         If ( A_ThisHotkey = "WheelDown" )
  15.         {
  16.             SendInput, !{PgDn} ; Send Alt+PgDown.
  17.         }
  18.     }
  19.     Else
  20.     {
  21.         SendInput, {%A_ThisHotkey%}
  22.     }
  23. }
  24. Return

Again, I don't have f.lux installed so this is untested with that application.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: change f.lux brightness mouse remote (like Volume²)
« Reply #11 on: October 14, 2019, 08:33 AM »
Thank you very much, skwire, it works even more almost perfectly now! :tellme: :D Just one tiny issue remains: in VLC, when not using fullscreen mode, the script activates and deactivates the menu with each wheelscroll. It's as if VLC recognizes the Alt from !{PgUp} and !{PgDn} as if the Alt key alone is being pressed. Any idea how to avoid that?