It is currently March 28th, 2024, 8:32 pm

A way to deactivate updates on hidden skins?

Get help with creating, editing & fixing problems with skins
DromaTheRyn
Posts: 9
Joined: March 11th, 2018, 7:47 pm

Re: A way to deactivate updates on hidden skins?

Post by DromaTheRyn »

Should I even update the skin with the standard update rate even when hidden?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: A way to deactivate updates on hidden skins?

Post by balala »

DromaTheRyn wrote:Should I even update the skin with the standard update rate even when hidden?
That's why I say that first you should have to decide if you want to just hide the second skin, or want to unload it. In first case, the skin indeed can be set to not update at all, but if instead of hiding, you unload it, then there is no need to change its update, because an unload skin, doesn't uses resources at all. At least now, this second possibility seem better for me.
DromaTheRyn
Posts: 9
Joined: March 11th, 2018, 7:47 pm

Re: A way to deactivate updates on hidden skins?

Post by DromaTheRyn »

Is there a way to load/ unload the skin upon pressing the button in the top bar?
If so, what would be the most elegant way?
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: A way to deactivate updates on hidden skins?

Post by fonpaolo »

DromaTheRyn wrote:Should I even update the skin with the standard update rate even when hidden?
Take this as a suggestion on how to use your skins:
- if your skin is used to display graphics or other informations, which changes, more or less constantly, you must run it, even if it's hidden, if you unload it or you stop his updating, you'll lose all the informations when hidden/unloaded.
- if your skin is a launcher or something that is static and doesn't change, you can set it to Update=-1.

You can also reduce the resources used simply adding UpdateDivider=-1 to anything static (images, buttons, background and so on) and leave the update only for measures and meters that are changing often.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: A way to deactivate updates on hidden skins?

Post by balala »

DromaTheRyn wrote:Is there a way to load/ unload the skin upon pressing the button in the top bar?
If so, what would be the most elegant way?
If despite fonpaolo's suggestion, you still decide to load / unload the appropriate skin, there is. First add the following variable to the [Variable] section of your skin (create this section, because I think it's not yet created):

Code: Select all

[Variables]
Show=0
Add the following String meter to the TopBar.ini skin, immediately after the [Taskbar] meter:

Code: Select all

[MeterButton]
Meter=STRING
X=(#CURRENTCONFIGWIDTH#-160)
Y=(#CURRENTCONFIGHEIGHT#/2)
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CenterCenter
AntiAlias=1
LeftMouseUpaction=[!setVariable Show (1-#Show#)][!UpdateMeasure "MeasureShow"]
DynamicVariables=1
Note that this String meter doesn't have a Text option. This option will be set by the following Calc measure.
Now modify a bit the [MeasureShow] Calc measure and add it to your code:

Code: Select all

[MeasureShow]
Measure=Calc
Formula=#Show#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterButton Text "Load"][!DeactivateConfig "TopBar\PerformanceTab"][!UpdateMeter "MeterButton"][!Redraw]
IfFalseAction=[!SetOption MeterButton Text "Unload"][!ActivateConfig "TopBar\PerformanceTab" "CPU.ini"][!UpdateMeter "MeterButton"][!Redraw]
DynamicVariables=1
Initially (when TopBar.ini is loaded or refreshed), the CPU.ini isn't loaded, due to the value of the Show variable. If however you want to have it loaded at the very first moment, just replace the value of the Show variable with Show=1 (within the [Variables] section).
DromaTheRyn
Posts: 9
Joined: March 11th, 2018, 7:47 pm

Re: A way to deactivate updates on hidden skins?

Post by DromaTheRyn »

Thanks for all the answers. Didn't have time in the last few weeks, but now I'm ready to continue. I think I'll try the normal refresh one first. Is there a way to sync up the TopBar.ini and CPU.ini? Right now, there is around 200ms delay.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: A way to deactivate updates on hidden skins?

Post by fonpaolo »

If what you noticed is a small visual delay between each skin, when normally updated, keep in mind that every time Rainmeter updates the skins (considering the usual Update=1000), this means that the program in this second has to read all the measures of all the loaded skins, reload, change images (when needed) and redraw everything.
It can't be executed everything at once, but there's a small delay from skin to skin.