It is currently November 29th, 2021, 5:27 am

Automatically change or deactivate skins/saved layouts based on which processes are running?

Get help with installing and using Rainmeter.
User avatar
Shadowcloud
Posts: 5
Joined: January 24th, 2021, 9:46 pm

Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by Shadowcloud »

Hello,
since I found out that Rainmeter causes my FPS to heavily drop in certain games, I wanted to ask if there is a way to automatically disable or change skins based on what process is being active. Such as when csgo.exe starts --> Deactivate skin (or kill Rainmeter, but it should start automatically again after csgo is killed.)
Is there a way or a program that can switch skins, or completely kill Rainmeter and start it once that process is closed?
User avatar
SilverAzide
Rainmeter Sage
Posts: 1666
Joined: March 23rd, 2015, 5:26 pm

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by SilverAzide »

Shadowcloud wrote: January 24th, 2021, 9:49 pm Hello,
since I found out that Rainmeter causes my FPS to heavily drop in certain games, I wanted to ask if there is a way to automatically disable or change skins based on what process is being active. Such as when csgo.exe starts --> Deactivate skin (or kill Rainmeter, but it should start automatically again after csgo is killed.)
Is there a way or a program that can switch skins, or completely kill Rainmeter and start it once that process is closed?
One way to do this is to create an invisible skin that uses the Process plugin to "watch" for your executable to be loaded. Once it is loaded, you can use the !LoadLayout bang to load an empty layout. If the process is not detected, it can load your normal layout. Note that your "empty layout" should include the invisible skin only.
Gadgets Wiki GitHub More Gadgets...
User avatar
Shadowcloud
Posts: 5
Joined: January 24th, 2021, 9:46 pm

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by Shadowcloud »

SilverAzide wrote: January 24th, 2021, 10:11 pm One way to do this is to create an invisible skin that uses the Process plugin to "watch" for your executable to be loaded. Once it is loaded, you can use the !LoadLayout bang to load an empty layout. If the process is not detected, it can load your normal layout. Note that your "empty layout" should include the invisible skin only.
I am sorry, but I don't understand too much of programming your own skins.
But I did create a loaded version of my theme and an empty one, both with the ProcessPlugin and that shows the right condition, when said process is started. What I now can't figure out is how to add this !LoadLayout Bang. I honestly don't even really know where. I tried messing around with it and hoped to get it working, but it turns out I don't understand much of what I am doing apparently :O The wiki sadly doesn't really help me too much with that.

EDIT: Also, is this possible for more than one Process at a time?
User avatar
balala
Rainmeter Sage
Posts: 13497
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by balala »

Shadowcloud wrote: January 24th, 2021, 9:49 pm Is there a way or a program that can switch skins, or completely kill Rainmeter and start it once that process is closed?
Another possibility is to manually enter Rainmeter into Game mode, before you start your game. Unfortunately this does work only by manual activation, but this way it can be a good approach. Just right click Rainmeter icon in the Notification Area and click Game mode. All loaded skins are unloaded. When you close the game (or whatever program) which required starting the Game mode, just relaunch the skin, by right click once again the Rainmeter icon and uncheck Game mode.
User avatar
Shadowcloud
Posts: 5
Joined: January 24th, 2021, 9:46 pm

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by Shadowcloud »

Thank you for the suggestions!

A user on Reddit helped me program a custom button with the !ToggleConfig function for each skin, so it hides the frame consuming skins and shows some less intensive ones in exchange, until I press the button again! That works best for me, I guess. It saves me around 10-13% of frames now, compared to using Game Mode or shutting down Rainmeter completely with around 16% more.

Just for those who should stumble upon the same problem and seek for similar things: https://www.reddit.com/r/RainmeterHelp/comments/l489dt/automatically_change_or_deactivate_skinssaved/
User avatar
balala
Rainmeter Sage
Posts: 13497
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by balala »

Shadowcloud wrote: January 25th, 2021, 4:34 pm A user on Reddit helped me program a custom button with the !ToggleConfig function for each skin, so it hides the frame consuming skins and shows some less intensive ones in exchange, until I press the button again! That works best for me, I guess. It saves me around 10-13% of frames now, compared to using Game Mode or shutting down Rainmeter completely with around 16% more.
O.O I definitely can't follow: if you hide a skin, it still consumes almost the same resources. The only difference is that is it not shown on the screen, but in background it still runs. The measures do all what they have to do: parse information over internet, make the required caluclations, substitutions, condition evaluations and so on. When using Game mode and even more so when you close Rainmeter, all skins are deactivated (unloaded), so they don't consume any resources in such a case. Not sure how hiding skins could save any resources in front of completely unloading skins / Rainmeter itself.
Shadowcloud wrote: January 25th, 2021, 4:34 pm Just for those who should stumble upon the same problem and seek for similar things: https://www.reddit.com/r/RainmeterHelp/comments/l489dt/automatically_change_or_deactivate_skinssaved/
An additional disadvantage of the method is that you have to know which skins are loaded and have to be hidden / shown. If you don't cretate a "perfect" list (containing all loaded and not containing unloaded skins) into the LeftMouseUpAction option of the shown [meter] meter (leftmouseupaction=[!Toggle "Config1"][!Toggle "Config2"]), you either will not be able to hide all skins, or even worse, get error messages in the log.
User avatar
Shadowcloud
Posts: 5
Joined: January 24th, 2021, 9:46 pm

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by Shadowcloud »

balala wrote: January 25th, 2021, 7:49 pm O.O I definitely can't follow: if you hide a skin, it still consumes almost the same resources. The only difference is that is it not shown on the screen, but in background it still runs. The measures do all what they have to do: parse information over internet, make the required caluclations, substitutions, condition evaluations and so on. When using Game mode and even more so when you close Rainmeter, all skins are deactivated (unloaded), so they don't consume any resources in such a case. Not sure how hiding skins could save any resources in front of completely unloading skins / Rainmeter itself.
The Button uses the !ToggleConfig function and the skins definitely reload completely when I click the button a second time, especially seen on my weather skin. Also I measured the FPS and got noticeably better performance with it than without it. It even comes really close to using the Game Mode or shutting Rainmeter off.
So apparently it does turn them off and unloads them. Otherwise I can't really understand the performance gain.

balala wrote: January 25th, 2021, 7:49 pmAn additional disadvantage of the method is that you have to know which skins are loaded and have to be hidden / shown. If you don't cretate a "perfect" list (containing all loaded and not containing unloaded skins) into the LeftMouseUpAction option of the shown [meter] meter (leftmouseupaction=[!Toggle "Config1"][!Toggle "Config2"]), you either will not be able to hide all skins, or even worse, get error messages in the log.
It isn't soooo hard to create that list honestly. You can just click on the rainmeter app and on Active Skins and you basically get a list of all skins you're using. I even managed to switch skins and I didn't have ANY knowledge before about that at all, apart from a slight bit of guessing what a piece of code does here and there.
If you had read the whole conversation, you'd know that it doesn't use leftmouseupaction anymore. It just defines the Meter as a Button and then gives the Button the command of [!ToggleConfig "SkinPathHere" ".iniFileHere"] [!ToggleConfig ... for every loaded (and unloaded, if you want to toggle some other skins on when it switches) skin. (It basically hides my usual layout and toggles another slow updating and less intensive one now.)
I mean I do understand that it can get quite messy if you have a lot of skins loaded, but it's nothing impossible to do.
For me putting some work into it one time is a lot more worth it, than having to click two times to activate a gamemode and two times to leave it again. And it seems it doesn't do much else than my button does, only that it takes a click less and is at a more convenient position than the Game Mode setting. It even still shows me something if I wanted to see something on my screen, other than forgetting to turn the game mode off again in the end, which already happened to me in testing.
It's basically a good compromise to what I was looking for. Other than the Game Mode setting... Of course it would be better if it was automatic, but that might lead to problems in the end. So that button is good for me and it does work like I want it to and does not show any other errors than it usually did in the log.
User avatar
balala
Rainmeter Sage
Posts: 13497
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by balala »

Shadowcloud wrote: January 26th, 2021, 11:24 pm The Button uses the !ToggleConfig function and the skins definitely reload completely when I click the button a second time, especially seen on my weather skin. Also I measured the FPS and got noticeably better performance with it than without it. It even comes really close to using the Game Mode or shutting Rainmeter off.
So apparently it does turn them off and unloads them. Otherwise I can't really understand the performance gain.
As said in my previous reply, there is posted a meter (named [meter]), with the following LeftMouseupAction option: leftmouseupaction=[!Toggle "Config1"][!Toggle "Config2"]. So !Toggle, not !ToggleConfig, which is a completely different thing. !Toggle hides / shows a skin, while !ToggleConfig Activates / deactivates it. If you're using !ToggleConfig then indeed a deactivated skin doesn't consume resources at all.
Make sure not to confuse them.
Shadowcloud wrote: January 26th, 2021, 11:24 pm It isn't soooo hard to create that list honestly. You can just click on the rainmeter app and on Active Skins and you basically get a list of all skins you're using. I even managed to switch skins and I didn't have ANY knowledge before about that at all, apart from a slight bit of guessing what a piece of code does here and there.
I don't say it is a hard thing, just you have to take care to use a proper list, which might change often.
Shadowcloud wrote: January 26th, 2021, 11:24 pm If you had read the whole conversation, you'd know that it doesn't use leftmouseupaction anymore. It just defines the Meter as a Button and then gives the Button the command of [!ToggleConfig "SkinPathHere" ".iniFileHere"] [!ToggleConfig ... for every loaded (and unloaded, if you want to toggle some other skins on when it switches) skin. (It basically hides my usual layout and toggles another slow updating and less intensive one now.)
Actually there is only one single mention about changing from !Toggle to !ToggleConfig. Probably missed it.
However note that [!ToggleConfig "SkinPathHere" ".iniFileHere"] [!ToggleConfig ... is not a feasable way. SkinPathHere doesn't have to include the path of the skin, just the name of the Config.

So finally did you get a solution?
User avatar
Shadowcloud
Posts: 5
Joined: January 24th, 2021, 9:46 pm

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by Shadowcloud »

balala wrote: January 27th, 2021, 7:44 am As said in my previous reply, there is posted a meter (named [meter]), with the following LeftMouseupAction option: leftmouseupaction=[!Toggle "Config1"][!Toggle "Config2"]. So !Toggle, not !ToggleConfig, which is a completely different thing. !Toggle hides / shows a skin, while !ToggleConfig Activates / deactivates it. If you're using !ToggleConfig then indeed a deactivated skin doesn't consume resources at all.
Make sure not to confuse them.
Thank you for the additional advise! I tested the different methods in games measuring my FPS and it definitely shows that just !Toggle has close to no effect, !ToggleConfig does have a big impact, just like turning Rainmeter off, as you said.
balala wrote: January 27th, 2021, 7:44 am I don't say it is a hard thing, just you have to take care to use a proper list, which might change often.
Of course! It might be a long list for some, but I usually don't change much and if I do, I do notice it either on my FPS or if it doesn't hide/deactivates properly. So that isn't a big problem for me.

balala wrote: January 27th, 2021, 7:44 amActually there is only one single mention about changing from !Toggle to !ToggleConfig. Probably missed it.
However note that [!ToggleConfig "SkinPathHere" ".iniFileHere"] [!ToggleConfig ... is not a feasable way. SkinPathHere doesn't have to include the path of the skin, just the name of the Config.

So finally did you get a solution?
[SkinPathHere] is meant to be the one that Rainmeter shows you under Active Skins, like in my case the complete thing looks like this for a single skin:
[!ToggleConfig "ForceX\ForceX System Monitor 3\HDD" "HDD_7.ini"]

So yes I have a reasonable solution for my problem now I guess, as toggling it automatically is maybe a bit overkill for my experience level. So a button like that does fine for me!
User avatar
balala
Rainmeter Sage
Posts: 13497
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatically change or deactivate skins/saved layouts based on which processes are running?

Post by balala »

Shadowcloud wrote: January 27th, 2021, 3:31 pm So yes I have a reasonable solution for my problem now I guess, as toggling it automatically is maybe a bit overkill for my experience level. So a button like that does fine for me!
Great. I'm glad if you got it working well.