It is currently September 29th, 2024, 9:26 pm

Auto-detect monitors?

General topics related to Rainmeter.
Yerginsnurf
Posts: 1
Joined: December 25th, 2012, 4:38 am

Auto-detect monitors?

Post by Yerginsnurf »

I primarily compute on my laptop, and at my desk I have a second monitor hooked up to my computer. I would like to be able to use rainmeter with that screen as well, but it is too much of a hassle for me to be dragging skins around whenever I switch from one to two monitors and vice versa. I know that you can save layouts, but I was wondering if there was a way for rainmeter to auto-detect how many monitors your computer is using to display, and choose what layout is uses from there. So when I'm using my laptop by itself, it will use the "single monitor" layout. When I have another monitor plugged in, it will automatically change to the "dual monitor" layout. Is this possible, and if so, how would I do it?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Auto-detect monitors?

Post by smurfier »

Try something like this:

Code: Select all

[Variables]
Dual=0

[DualTest]
Measure=Calc
Formula=(#SCREENAREAWIDTH@2#>0)&&(#Dual#<1)
IfAboveValue=0
IfAboveAction=[!WriteKeyValue Variables Dual 1][!LoadLayout DualLayout]

[SingleTest]
Measure=Calc
Formula=(#SCREENAREAWIDTH@2#<1)&&(#Dual#>0)
IfAboveValue=0
IfAboveAction=[!WriteKeyValue Variables Dual 0][!LoadLayout SingleLayout]
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Oneiros42
Posts: 9
Joined: February 5th, 2012, 5:29 am

Re: Auto-detect monitors?

Post by Oneiros42 »

I don't know anything about programming Rainmeter but I need this solution as I switch monitors frequently. Any chance you could explain how I use that bit of code? Do insert it into an .ini somewhere?