Looks good to me, using auto selecting the screen and duplicating for the monitor you need - I don't think there's a better way of doing this, since manually specifying the number of the screen using @N requires changing the code accordingly, while this approach doesn't. Personally, I don't have multiple monitors, so I can't test, but if it works for you then it should work for anyone having multiple monitors.SubjunctiveQuaver wrote: ↑April 19th, 2022, 9:38 am Ooh I've now tried that. Is there a way to get the DPI of each monitor (so I can adjust the corner radius accordingly?) Below are the improved snippets; they work for any screen as long as you set the right display monitor in settings!! (Just duplicate for each screen; is there a better way to do this?) Also the settings for click through/draggable etc. can be changed, but the !AutoSelectScreen is really important to keep as 1, which is the reason why it all works, and !ZPos is 2 to stay topmost.
Would also be good to update the metadata which right now is [...] but I'm not experienced with this stuff (not usually a coder lol, and I've lost track of who's contributed hahah)
Regarding the metadata, I guess adding istir (for the related idea of splitting one 'job' into more), myself (for adjusting it and implementing it) and yourself (for adding the multiple monitor part) should be enough, if you think so. I'm neutral on this, I don't mind either way, my intention was only to help in achieving the goal.
On the DPI thing, you probably didn't notice the EDIT in my previous reply here. While using such a Registry measure is trivial, the problem is figuring out how the names of those per monitor subfolders are constructed, since they might be different for each user (for me, the 1st "monitor" subfolfder is called BOE094A0_11_07E4_61^13B12C29BB6619B6E6B383B11D52D2EC, i.e. a construct involving other registry key names). This is further complicated by the fact that we don't know what DPI scaling values (expressed as percents or something humanly readable) correspond to Windows "codes" for each entry in the Start / Settings / System / Scale combobox list. That being said, the OP in this reddit wrote a PowerShell script that can be used in this case, with the proper adjustments, like:
Code: Select all
$activemonitorsregpath = 'HKCU:\Control Panel\Desktop\PerMonitorSettings';
$genericmonitorslist = Get-ChildItem 'HKLM:\System\CurrentControlSet\Control\GraphicsDrivers\ScaleFactors';
$dpicode = New-Object PSObject -Property @{'4294967295' = '100%'; '4294967294' = '100%'; '0' = '125%'; '1' = '150%'; '2' = '175%';};
$monitors = @(); $monitorindex = 0;
foreach ($genericmonitor in $genericmonitorslist)
{
$regpath = $activemonitorsregpath + '\' + $genericmonitor.PsChildname;
if (Test-Path -Path $regpath) {$dpivalue = (Get-ItemProperty -Path $regpath -Name 'DpiValue').'DpiValue'; $monitors += New-Object PSObject -Property @{'Index' = $monitorindex; 'Place' = $regpath; 'Scale' = $dpicode.$dpivalue}; $monitorindex++;}
}
$monitors | format-list;
After that, the script can be used in a RunCommand measure like this - sample code:
Code: Select all
[Variables]
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MonitorScale "Run"]
[MonitorScale]
Measure=Plugin
Plugin=RunCommand
Program=powershell
Parameter=-command $activemonitorsregpath = 'HKCU:\Control Panel\Desktop\PerMonitorSettings'; $genericmonitorslist = Get-ChildItem 'HKLM:\System\CurrentControlSet\Control\GraphicsDrivers\ScaleFactors'; $dpicode = New-Object PSObject -Property @{'4294967295' = '100%'; '4294967294' = '100%'; '0' = '125%'; '1' = '150%'; '2' = '175%';}; $monitors = @(); $monitorindex = 0; foreach ($genericmonitor in $genericmonitorslist) {$regpath = $activemonitorsregpath + '\' + $genericmonitor.PsChildname; if (Test-Path -Path $regpath) {$dpivalue = (Get-ItemProperty -Path $regpath -Name 'DpiValue').'DpiValue'; $monitors += New-Object PSObject -Property @{'Index' = $monitorindex; 'Place' = $regpath; 'Scale' = $dpicode.$dpivalue}; $monitorindex++;}} $monitors | format-list;
State=Hide
OutputType=ANSI
Timeout=10000
;RegExpSubstitute=1
;Substitute="":""
DynamicVariables=1
[Result]
Meter=String
FontColor=255,255,255,255
FontSize=10
AntiAlias=1
Text=[MonitorScale]
DynamicVariables=1
Eventually, an example applied to the current scenario would look like (your top skin used as a basis):
Code: Select all
[Variables]
CornerRadius=8
CornerColor=0,0,0
[Rainmeter]
Update=1000
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure MonitorScale "Run"][!AutoSelectScreen 1][!ClickThrough 1][!Draggable 0][!KeepOnScreen 1][!SnapEdges 1][!ZPos 2]
[MonitorScale]
Measure=Plugin
Plugin=RunCommand
Program=powershell
Parameter=-command $activemonitorsregpath = 'HKCU:\Control Panel\Desktop\PerMonitorSettings'; $genericmonitorslist = Get-ChildItem 'HKLM:\System\CurrentControlSet\Control\GraphicsDrivers\ScaleFactors'; $dpicode = New-Object PSObject -Property @{'4294967295' = '100%'; '4294967294' = '100%'; '0' = '125%'; '1' = '150%'; '2' = '175%';}; $monitors = @(); $monitorindex = 0; foreach ($genericmonitor in $genericmonitorslist) {$regpath = $activemonitorsregpath + '\' + $genericmonitor.PsChildname; if (Test-Path -Path $regpath) {$dpivalue = (Get-ItemProperty -Path $regpath -Name 'DpiValue').'DpiValue'; $monitors += New-Object PSObject -Property @{'Index' = $monitorindex; 'Place' = $regpath; 'Scale' = $dpicode.$dpivalue}; $monitorindex++;}} $monitors[0].Scale | format-list;
State=Hide
OutputType=ANSI
Timeout=10000
RegExpSubstitute=1
Substitute="%":""
FinishAction=[!SetVariable CornerRadius ([MonitorScale]/2)][!Update]
DynamicVariables=1
[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move (#ScreenAreaX#) (#ScreenAreaY#)]
DynamicVariables=1
That's about it. It's not great, but not bad either - things can be detected and done, but not in an entirely automatic way.