It is currently December 10th, 2018, 8:56 pm

Function for sensing taskbar state when in autohide

General topics related to Rainmeter.
User avatar
Slim08
Posts: 22
Joined: October 8th, 2018, 4:38 pm

Function for sensing taskbar state when in autohide

Slim08 » November 4th, 2018, 11:16 pm

Is there any known way for Rainmeter to sense the current state the taskbar is in when the autohide option is turned on (shown/ hidden)? I'm asking because I'm wondering if there is a way for a Rainmeter skin to react to that. Or would that need a specialized plugin that probably doesn't exist atm?
User avatar
kyriakos876
Posts: 849
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Function for sensing taskbar state when in autohide

kyriakos876 » November 4th, 2018, 11:25 pm

Slim08 wrote:
November 4th, 2018, 11:16 pm
Is there any known way for Rainmeter to sense the current state the taskbar is in when the autohide option is turned on (shown/ hidden)? I'm asking because I'm wondering if there is a way for a Rainmeter skin to react to that. Or would that need a specialized plugin that probably doesn't exist atm?
Yes this is possible by reading a specific value from the registry.
I'm not on my computer though so I will post a way tomorrow if nobody does before me.

Have a look here:
https://forum.rainmeter.net/viewtopic.php?f=5&t=29574&p=153240&hilit=Registry#p153240

But instead of the "03" I wanted to check in this thread, you want to check the number after the ....ff,ff,ff which in the thread is 02. This means Auto hide is not activated, if it said 03 after the ff,ff,ff then it would mean that it's activated.
User avatar
Slim08
Posts: 22
Joined: October 8th, 2018, 4:38 pm

Re: Function for sensing taskbar state when in autohide

Slim08 » November 5th, 2018, 5:53 pm

I toyed a bit around with your suggested code from https://forum.rainmeter.net/viewtopic.php?f=5&t=29574&p=153240&hilit=Registry#p153240 and I believe that we both think of something different when talking about a function for sensing taskbar state when in autohide. What I meant was a way to get a value in real time that represents whether or not the taskbar is hidden in that very moment. I believe what your code does is basically telling me if the setting "autohide" is turned on or not but not the actual real time state the taskbar is in at that moment.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Function for sensing taskbar state when in autohide

jsmorley » November 5th, 2018, 6:04 pm

I don't believe this is possible. The only real indication readily available to Rainmeter is the desktop work area, but although that will be the size of the screen less the taskbar when the taskbar is set to always show, it will be the size of the entire screen when the taskbar is set to auto-hide, and won't change based on whether the taskbar is showing at any given moment or not.

There may be something clever I havn't thought of, but I don't see a way right off.
User avatar
Slim08
Posts: 22
Joined: October 8th, 2018, 4:38 pm

Re: Function for sensing taskbar state when in autohide

Slim08 » November 5th, 2018, 6:51 pm

jsmorley wrote:
November 5th, 2018, 6:04 pm
I don't believe this is possible. The only real indication readily available to Rainmeter is the desktop work area, but although that will be the size of the screen less the taskbar when the taskbar is set to always show, it will be the size of the entire screen when the taskbar is set to auto-hide, and won't change based on whether the taskbar is showing at any given moment or not.

There may be something clever I havn't thought of, but I don't see a way right off.
Does any of those functions #WORKAREA# #SCREENAREA# #VSCREENAREA# work in a way that they get affected by a taskbar that is in autohide mode?
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Function for sensing taskbar state when in autohide

jsmorley » November 5th, 2018, 6:52 pm

Slim08 wrote:
November 5th, 2018, 6:51 pm
Does any of those functions #WORKAREA# #SCREENAREA# #VSCREENAREA# work in a way that they get affected by a taskbar that is in autohide mode?
No, they don't.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Function for sensing taskbar state when in autohide

jsmorley » November 5th, 2018, 6:56 pm

It's how Windows deals with it. When the taskbar is always showing, the work area is set to the screen less the taskbar, so applications maximize without trying to cover it up or getting behind it. When the taskbar is set to auto-hide, the assumption is that you want applications to maximize to the entire screen, and when the taskbar is shown, it is just on top of the application(s). So the work area is set smaller when the taskbar is always showing, and set to the entire screen when the taskbar is auto-hide. Makes no difference in that case if it is actually up or down at any given moment.
User avatar
Slim08
Posts: 22
Joined: October 8th, 2018, 4:38 pm

Re: Function for sensing taskbar state when in autohide

Slim08 » November 5th, 2018, 7:10 pm

Anyway, thanks for taking the time guys. I appreciate it.
User avatar
balala
Rainmeter Sage
Posts: 7152
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Function for sensing taskbar state when in autohide

balala » November 5th, 2018, 7:29 pm

Slim08 wrote:
November 5th, 2018, 6:51 pm
Does any of those functions #WORKAREA# #SCREENAREA# #VSCREENAREA# work in a way that they get affected by a taskbar that is in autohide mode?
Despite what jsmorley wrote, maybe there could be one way: you have to calculate the difference between the #SCREENAREAHEIGHT# and #WORKAREAHEIGHT# variables (at least if the taskbar is positioned to bottom / top of screen). If this difference is 0 the taskbar is set to autohide, otherwise it is set to be always visible:

Code: Select all

[Rainmeter]
Update=1000

[MeasureDifference]
Measure=Calc
Formula=( #SCREENAREAHEIGHT# - #WORKAREAHEIGHT# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterDifference Text "Taskbar set to Autohide"][!UpdateMeter "MeterDifference"][!Redraw]
IfFalseAction=[!SetOption MeterDifference Text "Taskbar not set to Autohide"][!UpdateMeter "MeterDifference"][!Redraw]
DynamicVariables=1

[MeterDifference]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
What the skin / the [MeterDifference] meter shows is this setting of taskbar.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Function for sensing taskbar state when in autohide

jsmorley » November 5th, 2018, 7:41 pm

balala wrote:
November 5th, 2018, 7:29 pm
Despite what jsmorley wrote, maybe there could be one way: you have to calculate the difference between the #SCREENAREAHEIGHT# and #WORKAREAHEIGHT# variables (at least if the taskbar is positioned to bottom / top of screen). If this difference is 0 the taskbar is set to autohide, otherwise it is set to be always visible:

Code: Select all

[Rainmeter]
Update=1000

[MeasureDifference]
Measure=Calc
Formula=( #SCREENAREAHEIGHT# - #WORKAREAHEIGHT# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterDifference Text "Taskbar set to Autohide"][!UpdateMeter "MeterDifference"][!Redraw]
IfFalseAction=[!SetOption MeterDifference Text "Taskbar not set to Autohide"][!UpdateMeter "MeterDifference"][!Redraw]
DynamicVariables=1

[MeterDifference]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
What the skin / the [MeterDifference] meter shows is this setting of taskbar.
Yes, but knowing it is set to auto-hide is not his issue. He can get that from the registry. The issue that he is trying to solve is "is it UP or DOWN at this moment, and those variables won't help with that.