It is currently April 30th, 2024, 5:51 pm

Skin Height Dynamic Adjustment as per Taskbar Visibility

Get help with creating, editing & fixing problems with skins
User avatar
BlackChadhar
Posts: 35
Joined: March 4th, 2023, 8:16 am

Skin Height Dynamic Adjustment as per Taskbar Visibility

Post by BlackChadhar »

I found this recycle bin skin from mond and I wanna use it in my bottom right corner of the screen. I use adaptive hide taskbar so taskbar hides whenever hot hovered over. The issue is this is causing my skin to overlap with the taskbar until focused on taskbar by clicking on it once. So, I was wondering if there is a way I could detect when the taskbar is visible and adjust the height of the skin dynamically. Here is the skin code:

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 

[Variables]
@include=#@#Variables.inc
@include2=#@#Language\#Language#.inc
Scale=0.3

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureRecycleBin]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=COUNT

[MeasureRecycleBinSize]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=SIZE

[MeasureRecycleBinAction]
Measure=Calc
Formula=MeasureRecycleBin
IfAboveAction=[!RainmeterHideMeter MeterIconEmpty][!RainmeterShowMeter MeterIconFull]
IfAboveValue=0
IfEqualAction=[!RainmeterHideMeter MeterIconFull][!RainmeterShowMeter MeterIconEmpty]
IfEqualValue=0

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterRecycleBinText]
Meter=String
StringAlign=Right
StringCase=Upper
FontFace=Quicksand
FontColor=#TextColor#
FontSize=(40*#Scale#)
X=(650*#Scale#)
Y=(0*#Scale#)
Text="#Recycle Bin#"
AntiAlias=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterRecycleBinInfoText]
Meter=String
MeasureName=MeasureRecycleBin
MeasureName2=MeasureRecycleBinSize
StringAlign=Right
StringCase=Upper
FontFace=Aquatico
FontColor=#TextColor#
FontSize=(27*#Scale#)
X=(650*#Scale#)
Y=(0*#Scale#)R
Text="#Files# %1 #CRLF# #Size# %2B"
AntiAlias=1
Autoscale=1
Percentual=0 
NumOfDecimals=0

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterIconEmpty]
Meter=Image
ImageName=#@#Empty.png
X=(650*#Scale#)
Y=(0*#Scale#)
W=(180*#Scale#)
AntiAlias=1
ImageTint=143, 151, 121
LeftMouseDownAction=[!HideMeter MeterIconEmpty][!ShowMeter MeterIconEmptyActive][!Redraw]
RightMouseDownAction=[!HideMeter MeterIconEmpty][!ShowMeter MeterIconEmptyActive][!Redraw]

[MeterIconEmptyActive]
Meter=Image
ImageName=#@#Empty.png
X=(650*#Scale#)
Y=(0*#Scale#)r
W=(180*#Scale#)
AntiAlias=1
Hidden=1
ImageTint=#ButtonColor#
LeftMouseUpAction=[!PluginBang "MeasureRecycleBin OpenBin"][!HideMeter MeterIconEmptyActive][!ShowMeter MeterIconEmpty][!Redraw]
RightMouseUpAction=[!PluginBang "MeasureRecycleBin EmptyBin"][!HideMeter MeterIconEmptyActive][!ShowMeter MeterIconEmpty][!Redraw]

[MeterIconFull]
Meter=Image
ImageName=#@#Full.png
X=(650*#Scale#)
Y=(0*#Scale#)r
W=(180*#Scale#)
AntiAlias=1
Hidden=1
ImageTint=#ButtonColor#
LeftMouseDownAction=[!HideMeter MeterIconFull][!ShowMeter MeterIconFullActive][!Redraw]
RightMouseDownAction=[!HideMeter MeterIconFull][!ShowMeter MeterIconFullActive][!Redraw]

[MeterIconFullActive]
Meter=Image
ImageName=#@#Full.png
X=(650*#Scale#)
Y=(0*#Scale#)r
W=(180*#Scale#)
AntiAlias=1
Hidden=1
ImageTint=#ButtonColor#
LeftMouseUpAction=[!PluginBang "MeasureRecycleBin OpenBin"][!HideMeter MeterIconFullActive][!ShowMeter MeterIconFull][!Redraw]
RightMouseUpAction=[!PluginBang "MeasureRecycleBin EmptyBin"][!HideMeter MeterIconFullActive][!ShowMeter MeterIconFull][!Redraw]

This is what I mean when I say overlapping of skin and taskbar


Do I need to install separate plugins and stuff or are there in built commands in Rainmeter for taskbar visibility detection ?
:)
User avatar
balala
Rainmeter Sage
Posts: 16190
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin Height Dynamic Adjustment as per Taskbar Visibility

Post by balala »

BlackChadhar wrote: April 8th, 2024, 6:59 pm Do I need to install separate plugins and stuff or are there in built commands in Rainmeter for taskbar visibility detection ?
No, no need for plugins or other stuffs. But how are you placing your skin? Because this is not clear from your description, might be a manual dragging. In any case you maight want to add something like this to the [Rainmeter] section of your code: OnRefreshAction=[!SetWindowPosition "99%" "95%" "100%" "100%"]. On this option, the first two parameters (99% and 95% in this case) are representing the horizontal and the vertical position of the skin. The last two parameters (both set to 100% above) are the horizontal and vertical anchor points of the skin. By setting these to 100%, you ensure that the right bottom corner of your skin is set to the position given by the first two parameters. By setting the second parameter to 95%, the right bottom corner of your skin is placed to 95% of the height of your screen, which ensures you the skin not be hidden when the taskbar is shown.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Skin Height Dynamic Adjustment as per Taskbar Visibility

Post by Yincognito »

BlackChadhar wrote: April 8th, 2024, 6:59 pm Do I need to install separate plugins and stuff or are there in built commands in Rainmeter for taskbar visibility detection ?
:)
No and no. However, Rainmeter does have its built-in monitor variables, with the WORKAREA ones typically excluding the taskbar:
https://docs.rainmeter.net/manual/variables/built-in-variables/#MonitorVariables

The only question is whether Windows itself (from which the said variables take their values) adjusts its work area coordinates already on hovering to show the taskbar, or rather waits for a click on it to do it (as it appears from your feedback).

If the former, then you can use a method like balala recommended, except that doing it in an OnUpdateAction rather than in an OnRefreshAction would be more suited for a "dynamic" reaction. By the way, note that using percents or relative positioning relate to SCREENAREA which might not be exactly what you need since it includes the taskbar, while using WORKAREA based values or formulas doesn't include it. Also, given the fact that the [Rainmeter] section doesn't support dynamic variables, using either the nested syntax like [#WORKAREAHEIGHT] instead of #WORKAREAHEIGHT# in the [Rainmeter] section, or moving the option in a measure where you can use DynamicVariables=1 would be preferable.

If the latter, then it would be more difficult to achieve what you want using Rainmeter only capabilities, though not impossible. In such a case, positioning the skin statically, accounting for the possible taskbar height would be the easy way out, albeit not dynamic in nature.

So, again, it can be done, but will depend on when the work area variables are adjusted: on hover or on focus. I can't test code atm, so that will be up to you or others to find out.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth