It is currently October 13th, 2024, 8:39 am

HotKey plugin 1.0

Plugins and Addons popular with the Community
WirlyWirly
Posts: 17
Joined: July 15th, 2020, 6:37 am

Re: HotKey plugin 1.0

Post by WirlyWirly »

Alex88 wrote: August 22nd, 2020, 2:13 am Can try this example using OnFocusAction= and OnUnfocusAction=.
Ignore the extraneous -1 Update or UpdateDivider if needed, am just used to placing that.

Code: Select all

[Rainmeter]
 Update=-1
 AccurateText=1
 DynamicWindowSize=1
 OnFocusAction=[!CommandMeasure measureHotkey Start][!SetOption MeterText FontColor 255,255,255][!UpdateMeter *][!Redraw]
 OnUnfocusAction=[!CommandMeasure measureHotkey Stop][!SetOption MeterText FontColor 128,128,128][!UpdateMeter *][!Redraw]

[measureHotkey]
 Measure=Plugin
 Plugin=Hotkey
 Hotkey=1
 ShowAllKeys=1
 KeyDownAction=[!SetOption MeterText SolidColor 0,100,0][!UpdateMeter *][!Redraw]
 KeyUpAction=[!SetOption MeterText SolidColor 0,0,0][!UpdateMeter *][!Redraw]
 UpdateDivider=-1

[MeterText]
 Meter=String
 FontSize=12
 StringAlign=CenterCenter
 FontColor=128,128,128
 SolidColor=0,0,0
 Text=Text

 X=50
 Y=25
 W=100
 H=50
HotkeyFocus.gif
Thanks, that worked great.

I have ~20 meters I want to use hotkeys for, so the Focus/Unfocus line is gonna be HUGE! :Whistle

*** Edit ***
Turned out great, really happy with this! Just gotta write a quick script in AHK to return focus to the previous application so that I could escape the launcher as-well.
Image
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: HotKey plugin 1.0

Post by Alex88 »

WirlyWirly wrote: August 22nd, 2020, 6:57 pm Thanks, that worked great.

I have ~20 meters I want to use hotkeys for, so the Focus/Unfocus line is gonna be HUGE! :Whistle

*** Edit ***
Turned out great, really happy with this! Just gotta write a quick script in AHK to return focus to the previous application so that I could escape the launcher as-well.
Image
Looking good, compact yet describes all that is needed :thumbup:

Yeah thinking it over there doesn't seem to be much downside using the Focus/Unfocus route, and allows hotkeys to be used more freely. I feel it can be used well for setting/configuration skins, of course launchers like you have, and anything that has a similar binary usage: on opening/bringing forth the skin, it will naturally have focus, then when done, can close/unfocus it, and then those hotkeys don't need to apply.

Even just a simple Escape hotkey for such skins fits in the natural action of using Escape to close/dismiss a window:

Code: Select all

[Rainmeter]
 ...
 OnFocusAction=[!CommandMeasure measureHotkey1 Start]
 OnUnfocusAction=[!CommandMeasure measureHotkey1 Stop]
 
[measureHotkey1]
 Measure=Plugin
 Plugin=Hotkey
 Hotkey=ESCAPE
 KeyUpAction=[!DeactivateConfig]
 UpdateDivider=-1
And if the config isn't to be fully closed, can send it to the desktop or hide it, and as mentioned then use AHK or AutoIt to return focus to the previous window.

Edit: Just tried out the simple Send {Alt down}{tab}{Alt up} for AHK and it should send focus back to previous window. One downside is that from an empty desktop, since it's just using Alt-Tab, it will restore the previous window even if minimized, if that's desired or not.
And Disclaimer: Last time I used AHK or AutoIt was years ago, experimenting with simple GUI stuff and window management, so I'm basically re-learning as I go.

If the Rainmeter window is to remove focus from the previous window, can use WinActivate, Program Manager in AutoHotKey (moves focus to the desktop). Or I see from here DllCall("SwitchToThisWindow", "ptr", WinExist("Program Manager"), "int", 1) should work more completely.

Edit 2: If you would want to use hotkeys to switch focus to a different Rainmeter config, there is RainFocus to do so.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: HotKey plugin 1.0

Post by brax64 »

Hi all,

I'm facing a weird issue with the HotKey plugin.
I'm using it quite a bit with no issues, now I've finish a new player skin (part of a suite) in which I've associated an hot key toggle in the main skin to load/unload said player skin.
It's working fine but in one and only case it crash Rainmeter, the details:
The player skin is set to work with iTunes, if ITunes is not running I can toggle the player skin with hot key with no issue at all, it load/unload successfully; the issue arise if iTunes it's already running, with the player skin active, if I stroke the CTRL 4 (the associated hotkey) the player skin deactivate regularly, if I toggle again (to reactivate the player skin) the player skin do not load and Rainmeter, after couple of seconds, crash...
Then it's just enough restart Rainmeter and the player skin show up like it was on when Rainmeter close...

HotKey plugin ver 1.0.0.12
Rainmeter 4.4.0.3404 beta (64-bit)
Language: English (1033)
Build time: 2020-08-25 8:09:50
Commit Hash: a0c762cf
Windows 10 Home 1903 64-bit (build 18362) - English (1033)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\...\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\...\AppData\Roaming\Rainmeter\
IniFile: C:\Users\...\AppData\Roaming\Rainmeter\Rainmeter.ini
User avatar
balala
Rainmeter Sage
Posts: 16651
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

brax64 wrote: September 22nd, 2020, 3:13 am It's working fine but in one and only case it crash Rainmeter, the details:
The player skin is set to work with iTunes, if ITunes is not running I can toggle the player skin with hot key with no issue at all, it load/unload successfully; the issue arise if iTunes it's already running, with the player skin active, if I stroke the CTRL 4 (the associated hotkey) the player skin deactivate regularly, if I toggle again (to reactivate the player skin) the player skin do not load and Rainmeter, after couple of seconds, crash...
Then it's just enough restart Rainmeter and the player skin show up like it was on when Rainmeter close...
Post the code of your skin, please.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: HotKey plugin 1.0

Post by brax64 »

balala wrote: September 22nd, 2020, 11:56 am Post the code of your skin, please.
Here you go, thanks in advamce :welcome:

Forgot to mention, if I toggle the player skin from the context menu, it loads with no issue either way iTunes running or not...
Gruvy_1.8.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16651
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

brax64 wrote: September 22nd, 2020, 5:50 pm Here you go, thanks in advamce :welcome:
Sorry, but posting such a package is useless. It contains more skins and you didn't tell us which is the skin you're having problems with.
I tried to look for the appropriate skin, but there is only one .ini file having HotKey plugin measures (namely Gruvy\Dash\Gruvy.ini), but this one has nothing to do with iTunes. In fact the only file in your package seeming to have something to do with iTunes is Gruvy\Settings\PlayerSettings.ini.

So, whenever are you asking for help, please help us to help you: https://forum.rainmeter.net/viewtopic.php?f=5&t=28421#p148358
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: HotKey plugin 1.0

Post by brax64 »

balala wrote: September 22nd, 2020, 6:40 pm Sorry, but posting such a package is useless. It contains more skins and you didn't tell us which is the skin you're having problems with.
I tried to look for the appropriate skin, but there is only one .ini file having HotKey plugin measures (namely Gruvy\Dash\Gruvy.ini), but this one has nothing to do with iTunes. In fact the only file in your package seeming to have something to do with iTunes is Gruvy\Settings\PlayerSettings.ini.

So, whenever are you asking for help, please help us to help you: https://forum.rainmeter.net/viewtopic.php?f=5&t=28421#p148358
Sorry about that balala... :oops:
Yes the skin that has the problem is the player skin Gruvy\Player\Player.ini
I sent the whole skin so you may see how is working in its complete environment...
Gruvy\Dash\Gruvy.ini is the main skin that has the hotkey and context menu built in to launch the accessories skins...
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: HotKey plugin 1.0

Post by brax64 »

brax64 wrote: September 22nd, 2020, 3:13 am Hi all,

I'm facing a weird issue with the HotKey plugin.
...
Bump...
Anyone could please have a look at this?
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: HotKey plugin 1.0

Post by Alex88 »

I don't have iTunes, but I tried out AIMP: I couldn't get the player to crash when AIMP was already loaded or not.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: HotKey plugin 1.0

Post by brax64 »

Alex88 wrote: September 24th, 2020, 11:51 pm I don't have iTunes, but I tried out AIMP: I couldn't get the player to crash when AIMP was already loaded or not.
Hi Alex88, thanks for your time, appreciated!
It seems that the issue arises only with iTunes... when I try to load the Player.ini skin trough hotkey, is not happening if I load it trough the main skin (Gruvy.ini) context menu... while iTunes its already running.
If iTunes is not running, the Player.ini skin load regularly either way (Gruvy.ini context menu or hotkey)...