It is currently September 8th, 2024, 2:54 am

HotKey plugin 1.0

Plugins and Addons popular with the Community
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

lmiol wrote: May 9th, 2023, 4:00 pm But if it works with depencies, for example like explorer.exe then it not match to me in that way.
Alright, as you want.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HotKey plugin 1.0

Post by Yincognito »

lmiol wrote: May 9th, 2023, 5:40 pm ah. i thout it will calculated in percentage of resulution screen
because not all desktop resolutions the same =(
Taskbar's height is dependent on screen resolution, but not only on that - it also depends on the scaling applied in Windows (at least that are the dependencies I'm aware about). I don't know the exact formula and, as you know, Windows is closed source so we can't take a look there and have it ready to use, but you can investigate scaling using something similar to this:

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
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
Text=[MonitorScale]
DynamicVariables=1
The drawback here, besides not knowing the exact formula for the taskbar height, is that the registry values are, as you can see, system dependent. For me, for example, if I change the scaling, then the value of the HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI key stays the same, while it's the HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\BOE094A0_11_07E4_61^13B12C29BB6619B6E6B383B11D52D2EC\DpiValue and similar that change their values (where that long monitor ID is found in another place in the registry, see the PowerShell command above). Plus, as if this wasn't enough, the DPI "code" is dependent on the position in the scaling list from Settings and isn't a percentual value like you would expect, hence the need to "decode" it, which is obviously subject to what everyone has in his list from Settings... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
lmiol
Posts: 18
Joined: April 6th, 2022, 5:36 pm

Re: HotKey plugin 1.0

Post by lmiol »

Yincognito and balala

thanks, you gave me a lot food for thought.
next week i will explore all of these
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

lmiol wrote: May 9th, 2023, 7:21 pm next week i will explore all of these
Alright, from my point of view. If you have any question related to what did I posted, feel to come back and ask.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HotKey plugin 1.0

Post by Yincognito »

lmiol wrote: May 9th, 2023, 7:21 pmnext week i will explore all of these
Good luck - hopefully you'll be able to use some of these to get closer to reaching your objective. :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Hazrd
Posts: 9
Joined: August 26th, 2024, 7:59 am
Location: Malaysia

Re: HotKey plugin 1.0

Post by Hazrd »

Hey Brian!

First of all, amazing plugin! :D I'm relatively knew to rainmeter but im learning the ropes quick!

I wanted to know if its possible to restrict keybinds to when the skin is focused only?
User avatar
killall-q
Posts: 307
Joined: August 14th, 2009, 8:04 am

Re: HotKey plugin 1.0

Post by killall-q »

Hazrd wrote: September 1st, 2024, 9:28 amI wanted to know if its possible to restrict keybinds to when the skin is focused only?
Yes, the plugin's functionality can be started/stopped on command. However, each keybind requires a dedicated measure and you have to send the start/stop command to each measure individually (measures do not support group bangs like meters do).

Code: Select all

[Rainmeter]
OnFocusAction=[!CommandMeasure mA Start][!CommandMeasure mB Start][!CommandMeasure mC Start]
OnUnfocusAction=[!CommandMeasure mA Stop][!CommandMeasure mB Stop][!CommandMeasure mC Stop]

[mA]
Measure=Plugin
Plugin=HotKey
HotKey=a
KeyDownAction=!CommandMeasure mScript Input("a")

[mB]
Measure=Plugin
Plugin=HotKey
HotKey=b
KeyDownAction=!CommandMeasure mScript Input("b")

[mC]
Measure=Plugin
Plugin=HotKey
HotKey=c
KeyDownAction=!CommandMeasure mScript Input("c")

[mScript]
Measure=Script
ScriptFile=#@#Script.lua
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HotKey plugin 1.0

Post by Yincognito »

killall-q wrote: September 1st, 2024, 5:11 pmmeasures do not support group bangs like meters do
A minor clarification to an otherwise excellent answer: measures do support group bangs (actually, more group bangs than meters do), just not a hypothetical !CommandMeasureGroup bang.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Hazrd
Posts: 9
Joined: August 26th, 2024, 7:59 am
Location: Malaysia

Re: HotKey plugin 1.0

Post by Hazrd »

Thank you very much Yincognito and killall-q! I also appreciate the relatively quick response! :thumbup:
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HotKey plugin 1.0

Post by Yincognito »

Hazrd wrote: September 2nd, 2024, 9:30 am Thank you very much Yincognito and killall-q! I also appreciate the relatively quick response! :thumbup:
Killall-q deserves all the plaudits here, but you're welcome! :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth