It is currently July 20th, 2019, 8:49 pm

Detecting Skin Distance from Edge of Monitor

Tips and Tricks from the Rainmeter Community
Wallboy
Posts: 62
Joined: October 1st, 2012, 4:53 am

Detecting Skin Distance from Edge of Monitor

Wallboy » September 2nd, 2014, 1:22 pm

If you ever want to know when your skin comes within some distance from a certain side of your screen, the following formulas will calculate just that. They are essentially the exact same as what Rainmeter internally uses to calculate monitor edge snapping.

Left Edge Formula:

Code: Select all

(#CURRENTCONFIGX# < #DistanceFromEdge# + #WORKAREAX#) && (#CURRENTCONFIGX# > #WORKAREAX# - #DistanceFromEdge#)
Right Edge Formula:

Code: Select all

(#CURRENTCONFIGX# < #DistanceFromEdge# + #WORKAREAX# + #WORKAREAWIDTH# - #CURRENTCONFIGWIDTH#) && (#CURRENTCONFIGX# > -#DistanceFromEdge# + #WORKAREAX# + #WORKAREAWIDTH# - #CURRENTCONFIGWIDTH#)
Top Edge Formula:

Code: Select all

(#CURRENTCONFIGY# < #DistanceFromEdge# + #WORKAREAY#) && (#CURRENTCONFIGY# > #WORKAREAY# - #DistanceFromEdge#)
Bottom Edge Formula:

Code: Select all

(#CURRENTCONFIGY# < #DistanceFromEdge# + #WORKAREAY# + #WORKAREAHEIGHT# - #CURRENTCONFIGHEIGHT#) && (#CURRENTCONFIGY# > -#DistanceFromEdge# + #WORKAREAY# + #WORKAREAHEIGHT# - #CURRENTCONFIGHEIGHT#)
The only user variable that you need to change is DistanceFromEdge. This variable is the distance that from your skin to the edge of the work area that will make these formulas return true.

IMPORTANT: In order for this to work across all your monitors and not just your primary monitor, you must set the display position setting to auto-select. Right click your skin, and choose Settings -> Position -> Display Monitor -> Auto-select based on window position.

I have included a simple demonstration skin. Drag the skin to your monitor/s edges (if you have a multi-monitor setup, be sure to make the setting change above). Play with the DistanceFromEdge variable in the skin to have the formulas trigger further/closer to the edge of your screen.
You do not have the required permissions to view the files attached to this post.