I want to be able to change my skin Layout with a keyboard shortcut. Is this possible?
I switch between two resolutions (from 4k to 1080p) with a keyboard shortcut using a utility called HRC. When I do this my layout becomes a mangled mess. To fix this I made a layout for both resolutions I would like to be able to switch between them with a keyboard shortcut just like I do with my resolutions.
It is currently April 28th, 2024, 12:25 pm
Help With Layouts
-
- Posts: 2
- Joined: September 10th, 2020, 5:40 am
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Help With Layouts
You can do it, but another external program dll is needed utilising rainmeter. It is called HotKey.
You can also do it with rainmeter with a mouse click using the bang !LoadLayout.
https://docs.rainmeter.net/manual/bangs/#LoadLayout
You can also do it with rainmeter with a mouse click using the bang !LoadLayout.
https://docs.rainmeter.net/manual/bangs/#LoadLayout
Code: Select all
[MeterClicky]
Meter=Image
X=0
Y=0
W=40
H=40
SolidColor=100,100,100,100
LeftMouseUpAction=[!LoadLayout "My Saved Layout"][!Refesh *]
Last edited by CodeCode on September 10th, 2020, 6:31 am, edited 2 times in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Posts: 908
- Joined: December 30th, 2015, 9:47 am
Re: Help With Layouts
Hi BillNoMind
I didn't try actually, but I think it is possible using Hotkey plugin and of course !LoadLayout bang as CodeCode said.
I didn't try actually, but I think it is possible using Hotkey plugin and of course !LoadLayout bang as CodeCode said.
-
- Posts: 2
- Joined: September 10th, 2020, 5:40 am
Re: Help With Layouts
What would the code look like if I wanted to use Ctrl + 1 for layout 1 and Ctrl + 2 for layout 2 as the keyboard shortcut (using the code that "CodeCode" postedmak_kawa wrote: ↑September 10th, 2020, 6:30 am Hi BillNoMind
I didn't try actually, but I think it is possible using Hotkey plugin and of course !LoadLayout bang as CodeCode said.
Edit I figured it out
Code: Select all
[Rainmeter]
Update=1000
[Meter4k]
Meter=image
X=0
Y=0
W=40
H=40
SolidColor=100,100,100,100
LeftMouseUpAction=[!LoadLayout "4k Final"][!Refesh *]
[Meter2k]
Meter=image
X=42
Y=0
W=40
H=40
SolidColor=100,100,100,100
LeftMouseUpAction=[!LoadLayout "2k Final"][!Refesh *]
[4k]
Measure=Plugin
Plugin=HotKey
HotKey=Ctrl 1
KeyDownAction=[!LoadLayout "4k Final"][!Redraw *]
[2k]
Measure=Plugin
Plugin=HotKey
HotKey=Ctrl 2
KeyDownAction=[!LoadLayout "2k Final"][!Redraw *]
Last edited by balala on September 10th, 2020, 11:38 am, edited 1 time in total.
Reason: Please use <code> tags, not <Snippet>, whenever are posting code snippets. It's the </> button.
Reason: Please use <code> tags, not <Snippet>, whenever are posting code snippets. It's the </> button.
-
- Posts: 908
- Joined: December 30th, 2015, 9:47 am
Re: Help With Layouts
Hi BillNoMind
First to say, I have not changed my monitor resolution, so followings is just an idea, not real test result. Please do trial-and-error by yourself, sorry.
When you changed monitor resolution, width and height of the monitor work area are changed, of course. Rainmeter can get these parameters as system variables #WORKAREAWIDTH# and #WORKAREAHEIGHT#.
So, probably you can switch action for single hot key according with whether current monitor is set to 2K or 4K, like as;
** EDIT: sorry, IfCondition expression was reversed... IfCondition=(2K4KDetect > 2000), instead of IfCondition=(2K4KDetect < 2000).
1. Assumed #WORKAREAWIDTH# in 4K monitor is larger than 2000 pixels, right?
2. Possibly, [!UpdateMeasure 2K4KDetect] is needed after [!EnableMeasure 2K4KDetect]...?
As already said, I am not sure this idea in fact works well or not... hope this doesn't break your system.
Ps. Idea background: if you press hotkey (or click button) for 4K layout when current monitor is 2K, wouldn't it cause a mess?
First to say, I have not changed my monitor resolution, so followings is just an idea, not real test result. Please do trial-and-error by yourself, sorry.
When you changed monitor resolution, width and height of the monitor work area are changed, of course. Rainmeter can get these parameters as system variables #WORKAREAWIDTH# and #WORKAREAHEIGHT#.
So, probably you can switch action for single hot key according with whether current monitor is set to 2K or 4K, like as;
Code: Select all
[HotKeyMeasure]
Measure=Plugin
Plugin=HotKey
HotKey=Ctrl 1
KeyDownAction=[!EnableMeasure 2K4KDetect]
[2K4KDetect]
Measure=Calc
Formula=#WORKAREAWIDTH#
IfCondition=(2K4KDetect > 2000)
IfTrueAction=[!LoadLayout "4k Final"][!Redraw][!DisableMeasure 2K4KDetect]
IfFalseAction=[!LoadLayout "2k Final"][!Redraw][!DisableMeasure 2K4KDetect]
DynamicVariables=1
Disabled=1
1. Assumed #WORKAREAWIDTH# in 4K monitor is larger than 2000 pixels, right?
2. Possibly, [!UpdateMeasure 2K4KDetect] is needed after [!EnableMeasure 2K4KDetect]...?
As already said, I am not sure this idea in fact works well or not... hope this doesn't break your system.
Ps. Idea background: if you press hotkey (or click button) for 4K layout when current monitor is 2K, wouldn't it cause a mess?
Last edited by mak_kawa on September 10th, 2020, 11:52 am, edited 3 times in total.
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help With Layouts
If you're loading a layout all skins belongign to that layout are reloaded and all skin not belonging to it, are unloaded. Anyway all skins are reloaded, so there is no need to refresh anything (so the [!Refesh *] bang is useless).CodeCode wrote: ↑September 10th, 2020, 6:27 amCode: Select all
[MeterClicky] Meter=Image X=0 Y=0 W=40 H=40 SolidColor=100,100,100,100 LeftMouseUpAction=[!LoadLayout "My Saved Layout"][!Refesh *]
-
- Posts: 908
- Joined: December 30th, 2015, 9:47 am
Re: Help With Layouts
Hi BillNoMind
Further idea... Maybe, hotkey action in Rainmeter is not necessary? That is, watching #WORKAREAWIDTH#, and when it was changed, automatically !LoadLayout. How about this?
Will this work?? I am not sure, but seems to be worth trying...
Edit: Caution! This code is dangerous, may cause infinite loop of !LoadLayout. Don't try it. Sorry.
Further idea... Maybe, hotkey action in Rainmeter is not necessary? That is, watching #WORKAREAWIDTH#, and when it was changed, automatically !LoadLayout. How about this?
Code: Select all
[2K4KWatch]
Measure=Calc
Formula=#WORKAREAWIDTH#
OnChangeAction=[!EnableMeasure 2K4KSwitch]
DynamicVariables=1
[2K4KSwitch]
Measure=Calc
Formula=1
IfCondition=([2K4KWatch] > 2000)
IfTrueAction=[!LoadLayout "4k Final"][!Redraw][!DisableMeasure 2K4KSwitch]
IfFalseAction=[!LoadLayout "2k Final"][!Redraw][!DisableMeasure 2K4KSwitch]
DynamicVariables=1
Disabled=1
Edit: Caution! This code is dangerous, may cause infinite loop of !LoadLayout. Don't try it. Sorry.
Last edited by mak_kawa on September 10th, 2020, 10:01 pm, edited 1 time in total.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Help With Layouts
Nothing that comes after !LoadLayout is ever going to be executed.
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help With Layouts
Not sure the [2K4KWatch] measure is needed. I think you could replace the Formula option of the [2K4KSwitch] measure with Formula=#WORKAREAWIDTH# and could remove the Disabled=1 option of the [2K4KSwitch] measure, to get directly executed the appropriate !LoadLAyout bang. No need to disable the measure, so the [!Redraw][!DisableMeasure 2K4KSwitch] options are also not needed, I'd remove them as well (see jsmorley's reply above).
-
- Posts: 908
- Joined: December 30th, 2015, 9:47 am
Re: Help With Layouts
Ouch!!...