It is currently April 25th, 2024, 10:32 am

Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Get help with creating, editing & fixing problems with skins
BloodyHell619
Posts: 4
Joined: May 14th, 2021, 10:26 pm

Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by BloodyHell619 »

So I am trying to make tinny Rainmeter widgets that stay over the taskbar and for these to work I needed a code to make them always stay on top except for when I open VLC, else they would be over the video when VLC is in full-screen. So, after some searching, I landed on this post
https://forum.rainmeter.net/viewtopic.php?f=103&t=7643&sid=1adebf19197bf214600c8bb3c23fea5d
which gave me this code

Code: Select all

[MeasureVLC]
Measure=Plugin
Plugin=Perfmon.dll
PerfMonObject="Process"
PerfMonCounter="ID Process"
PerfMonInstance="VLC"
PerfMonDifference=0
IfEqualValue=0
IfEqualAction=!RainmeterZPos 2
IfAboveValue=0
IfAboveAction=!RainmeterZPos -2
for making the skin stay on top of the taskbar all the time except for when I open VLC.
The code does exactly what I want, but I am experiencing an annoying issue with it and that is that it causes Rainmeter to lag heavily. Can anyone tell me why this code is causing lag and help me fix it or give me an alternate code ?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by eclectic-tech »

Use IfCondition rather than IfEqual/IfAbove; the lag is due to those tests setting the Z-position on every skin update, whereas the IfCondition will only execute the bang once and not fire again until the condition changes.

Code: Select all

[MeasureVLC]
Measure=Plugin
Plugin=Perfmon.dll
PerfMonObject="Process"
PerfMonCounter="ID Process"
PerfMonInstance="VLC"
PerfMonDifference=0
IfCondition=(#CurrentSection#=0)
IfTrueAction=!ZPos 2
IfFalseAction=!ZPos -2
Note: !Rainmeter{bangaction} was deprecated long ago, just use !{bangaction}; e.g. !ZPos 2
BloodyHell619
Posts: 4
Joined: May 14th, 2021, 10:26 pm

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by BloodyHell619 »

eclectic-tech wrote: May 14th, 2021, 11:41 pm Use IfCondition rather than IfEqual/IfAbove; the lag is due to those tests setting the Z-position on every skin update, whereas the IfCondition will only execute the bang once and not fire again until the condition changes.

Code: Select all

[MeasureVLC]
Measure=Plugin
Plugin=Perfmon.dll
PerfMonObject="Process"
PerfMonCounter="ID Process"
PerfMonInstance="VLC"
PerfMonDifference=0
IfCondition=(#CurrentSection#=0)
IfTrueAction=!ZPos 2
IfFalseAction=!ZPos -2
Note: !Rainmeter{bangaction} was deprecated long ago, just use !{bangaction}; e.g. !ZPos 2
:( Weird. Still lags with the IfCondition too.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by jsmorley »

Just an aside, it's not actually accurate that IfActions behave differently than IfConditions as far as how efficient they are. Both will only "fire" once when the test changes from false to true. There are advantages to IfConditon over IfAction, but they are more functional in nature.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by eclectic-tech »

jsmorley wrote: May 15th, 2021, 11:03 am Just an aside, it's not actually accurate that IfActions behave differently than IfConditions as far as how efficient they are. Both will only "fire" once when the test changes from false to true. There are advantages to IfConditon over IfAction, but they are more functional in nature.
Yeah, I thought that might be true (after I posted), so thanks for clarifying :oops:
BloodyHell619
Posts: 4
Joined: May 14th, 2021, 10:26 pm

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by BloodyHell619 »

jsmorley wrote: May 15th, 2021, 11:03 am Just an aside, it's not actually accurate that IfActions behave differently than IfConditions as far as how efficient they are. Both will only "fire" once when the test changes from false to true. There are advantages to IfConditon over IfAction, but they are more functional in nature.
To think of it, this code also has another issue and that is that it will not help me when I wanna watch a full-screen video in Firefox (say for example a YouTube video in full-screen)
So I was wondering would this plugin you made help with this in any way ?

https://forum.rainmeter.net/viewtopic.php?f=127&t=28305
BloodyHell619
Posts: 4
Joined: May 14th, 2021, 10:26 pm

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by BloodyHell619 »

BloodyHell619 wrote: May 15th, 2021, 3:34 pm To think of it, this code also has another issue and that is that it will not help me when I wanna watch a full-screen video in Firefox (say for example a YouTube video in full-screen)
So I was wondering would this plugin you made help with this in any way ?

https://forum.rainmeter.net/viewtopic.php?f=127&t=28305
Oh sweeeeett!!! It actually did !!! It solved both my issues!! Thanxxxx!!

So for anyone that wants to have a skin stay on top all the time unless an app goes into full-screen this is the code they need to use;

Code: Select all

[MeasureIsFullScreen]
Measure=Plugin
Plugin=IsFullScreen
IfCondition=MeasureIsFullScreen=1
IfTrueAction=!Zpos -2
IfFalseAction=!Zpos 2
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with a code for making a Rainmeter skin always stay on top except when playing fullscreen videos

Post by balala »

jsmorley wrote: May 15th, 2021, 11:03 am Just an aside, it's not actually accurate that IfActions behave differently than IfConditions as far as how efficient they are. Both will only "fire" once when the test changes from false to true. There are advantages to IfConditon over IfAction, but they are more functional in nature.
Don't contest this is true, it definitely is. However a great advantage of IfCondition in front of IfAction is that it can extremely easily be set to execute on each update of the skin, regardless if the condition just became true / false or it's continuously on the appropriate state, by setting the IfConditionMode=1 option. This is impossible with IfActions.