I'm looking for a way to bring my skin(s) to the front when I press ctrl+space, and then return them to the desktop after a single click, be it on or off a skin.
If not, then maybe a "while ctrl+space" method that keeps the skins on-top until I release the defined keys. A toggle would be last on the preference, but I wouldn't rule it out.
I'm essentially trying to get more use out of my skins, which won't happen if I have to minimize all my windows to get to them. I also don't want to be accidentally activating them when I hover my mouse to predefined areas, so anything on-screen is out.
I'm fairly new to rainmeter, but after modifying a skin, I'm more comfortable with the syntax. I'm thinking I'll have to use the !ZPos bang to get this to work, but I can't figure out how to have rainmeter monitor for keystrokes. I'd prefer not to use any external programs such as AutoHotKey, since I'm trying to keep the whole skin portable, but if that's necessary then let me know.
It is currently April 18th, 2024, 5:25 am
[SOLVED] How to bring skin(s) to front with keyboard shortcut?
-
- Posts: 17
- Joined: July 15th, 2020, 6:37 am
[SOLVED] How to bring skin(s) to front with keyboard shortcut?
Last edited by WirlyWirly on July 15th, 2020, 10:16 pm, edited 3 times in total.
-
- Posts: 327
- Joined: September 3rd, 2018, 11:18 am
Re: How to bring skin(s) to front with keyboard shortcut?
HotKey Plugin
Obviously you'll modify what position it goes to, if you want the action to be done when you hold the keys down or release them, or if you want the skin to go back when you click a meter instead of anywhere on the skin (that's why the [Rainmeter] section there), etc. Just have fun.
Code: Select all
[Rainmeter]
LeftMouseUpAction=!ZPos "-2"
[HotKey]
Measure=Plugin
Plugin=HotKey
HotKey=CTRL SPACE
KeyDownAction=!ZPos "2"
-
- Posts: 17
- Joined: July 15th, 2020, 6:37 am
Re: How to bring skin(s) to front with keyboard shortcut?
Thanks for the code snippet! I was able to get the main functionality working, just trying to buffer out a couple quality of life issues...
Here's how my code is looking on one of my skins...
- triggering [!Zpos "-2"] when clicking outside of a skin: At the moment, I have to click either on a meter or a part of the skin to activate the [!ZPos "-2"] action.
- Triggering [!Zpos "-2"] on all skins simultaneously: I currently have 2 skins (A and B). When I make a selection on skin A, [!Zpos "-2"] is triggerd. However, skin B remains and I have to also make a selection on it for the ZPos action. Looking for a way to have them all hide at once. Perhaps with some type of global variable that gets updated across skins?
Here's how my code is looking on one of my skins...
Code: Select all
[RainMeter]
Update = 1000
AccurateText = 1
BackgroundMode = 2
SolidColor = 0,0,0,1
DynamicWindowSize = 1
LeftMouseUpAction = [!ZPos "-2"]
--- snip ---
[DisplayFront]
Measure = Plugin
Plugin = HotKey
HotKey = CTRL SPACE
KeyUpAction = [!ZPos "1"]
--- snip ---
[MeterGitBash]
Meter = Image
...
LeftMouseUpAction = ["#PROGRAMDRIVE#\#portableapps_apps#\PortableGit\git-bash.exe"][!ZPos "-2"]
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How to bring skin(s) to front with keyboard shortcut?
To get when you click outside of a skin, you can add an OnUnfocusAction option to its [Rainmeter] section. The bangs of this option are executed when the skin which has this option, looses the focus.WirlyWirly wrote: ↑July 15th, 2020, 4:38 pm
- triggering [!Zpos "-2"] when clicking outside of a skin: At the moment, I have to click either on a meter or a part of the skin to activate the [!ZPos "-2"] action.
I'd add two variables to any of the two skins, which are registering when one or the other skin is focused or lost the focus. For instance add the following two variables to Skin A:WirlyWirly wrote: ↑July 15th, 2020, 4:38 pm
- Triggering [!Zpos "-2"] on all skins simultaneously: I currently have 2 skins (A and B). When I make a selection on skin A, [!Zpos "-2"] is triggerd. However, skin B remains and I have to also make a selection on it for the ZPos action. Looking for a way to have them all hide at once. Perhaps with some type of global variable that gets updated across skins?
Code: Select all
[Variables]
...
ZPosSkinA=1
ZPosSkinB=1
Now add the following options to the [Rainmeter] section of both skins:
- Skin A:
Code: Select all
[Rainmeter] ... OnUnfocusAction=[!SetVariable ZPosSkinA "0"][!UpdateMeasure "MeasureZPos"]
- Skin B:
Code: Select all
[Rainmeter] ... OnUnfocusAction=[!SetVariable ZPosSkinB "0" "ConfigOfSkinA"][!UpdateMeasure "MeasureZPos" "ConfigOfSkinA"]
Add the following measure to Skin A:
Code: Select all
[MeasureZPos]
Measure=Calc
Formula=( #ZPosSkinA# + #ZPosSkinB# )
IfCondition=(#CURRENTSECTION#=2)
IfTrueAction=[!ZPos "2"][!ZPos "2" "ConfigOfSkinB"]
IfFalseAction=[!ZPos "0"][!ZPos "0" "ConfigOfSkinB"]
DynamicVariables=1
Finally you have to modify the KeyDownAction option of the [HotKey] measure: KeyDownAction=[!SetVariable ZPosSkinA "1"][!SetVariable ZPosSkinB "1"][!UpdateMeasure "MeasureZPos"] (here I supposed the [MeasureZPos] measure is added to Skin A, not to Skin B - if it's on Skin B, move it to Skin A).
-
- Posts: 17
- Joined: July 15th, 2020, 6:37 am
Re: How to bring skin(s) to front with keyboard shortcut?
Thanks a bunch balala! I didn't expect there to be built-in way to change change variables, z-positions, and call functions across .ini files. Lots of very neat and useful trick in your code snippet.
One thing though is that !ZPos does not seem to give focus, it only brings skins to the front while focus remains on the previous window. Therefore the OnUnfocusAction= options weren't working since the skin never had focus to begin with.
I was able to utilize StealFocus.exe to bring skin A into focus, which allowed me to get the rest of your code working. I found no built-in way of giving a skin focus, but if there is I'd love to hear about it.
After seeing how your code works, I simplified it somewhat and I believe I have all the functionality I was looking for; Toggle all skins to the the front with ctrl+Space, then returns all skins to the desktop after clicking on a meter, skin, or outside of a skin.
I use portableapps, which has a very basic launcher. Using rainmeter as my main launcher is going to be life-changing. The base skin is StickyBar by ninjaki8, but I've modified it heavily to fit my preferences.
Here's my code for anyone that is also interested in setting up something like this.
One thing though is that !ZPos does not seem to give focus, it only brings skins to the front while focus remains on the previous window. Therefore the OnUnfocusAction= options weren't working since the skin never had focus to begin with.
I was able to utilize StealFocus.exe to bring skin A into focus, which allowed me to get the rest of your code working. I found no built-in way of giving a skin focus, but if there is I'd love to hear about it.
After seeing how your code works, I simplified it somewhat and I believe I have all the functionality I was looking for; Toggle all skins to the the front with ctrl+Space, then returns all skins to the desktop after clicking on a meter, skin, or outside of a skin.
I use portableapps, which has a very basic launcher. Using rainmeter as my main launcher is going to be life-changing. The base skin is StickyBar by ninjaki8, but I've modified it heavily to fit my preferences.
Here's my code for anyone that is also interested in setting up something like this.
Code: Select all
[RainMeter]
...
LeftMouseUpAction = "#skins_bottom#"
OnUnfocusAction = "#skins_bottom#"
[Variables]
...
skins_top = [!ZPos "1"][!ZPos "1" "StickyBar\Recycle"][!ZPos "1" "StickyBar\Date"]["#@#StealFocus.exe" "#CURRENTPATH##CURRENTFILE#"]
skins_bottom = [!ZPos "-2"][!ZPos "-2" "StickyBar\Date"][!ZPos "0" "StickyBar\Recycle"]
[DisplayFront]
Measure = Plugin
Plugin = HotKey
HotKey = CTRL SPACE
KeyUpAction = "#skins_top#"
--- snip ---
[MeterGitBash]
...
LeftMouseUpAction = ["#PROGRAMPATH#..\PortableGit\git-bash.exe"]["#skins_bottom#"]
--- snip ---
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How to bring skin(s) to front with keyboard shortcut?
Thank you.WirlyWirly wrote: ↑July 15th, 2020, 8:52 pm Lots of very neat and useful trick in your code snippet.
Right. !ZPos doesn't give focus.WirlyWirly wrote: ↑July 15th, 2020, 8:52 pm One thing though is that !ZPos does not seem to give focus, it only brings skins to the front while focus remains on the previous window. Therefore the OnUnfocusAction= options weren't working since the skin never had focus to begin with.
Right, there is no such built-in way. Beside jsmorley's StealFocus, a while ago another similar app has been posted by ~Faradey~. I didn't try RainFocus, but maybe it worth a try, if you are interested.WirlyWirly wrote: ↑July 15th, 2020, 8:52 pm I was able to utilize StealFocus.exe to bring skin A into focus, which allowed me to get the rest of your code working. I found no built-in way of giving a skin focus, but if there is I'd love to hear about it.