It is currently June 17th, 2024, 3:17 pm

OnCloseAction not applied

Report bugs with the Rainmeter application and suggest features.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

OnCloseAction not applied

Post by moshi »

i have this setting in a skin:

Code: Select all

OnCloseAction=[!KeepOnScreen 0 "Sphynx\DailyPhoto\FWAPhoto"]
when i exit the skin, there is this error message:
!KeepOnScreen: Skin "Sphynx\DailyPhoto\FWAPhoto" not found (Sphynx\DailyPhoto\FWAPhoto\regular.ini)

i am aware that such an action does not really make sense as OnRefreshAction would be the way to apply such settings. still i somehow would expect that this setting would be applied. not to a no longer running skin of course, but to Rainmeter.ini.
User avatar
sa3er
Posts: 152
Joined: March 2nd, 2013, 7:18 am
Location: Tehran

Re: OnCloseAction not applied

Post by sa3er »

Try this instead:

Code: Select all

OnCloseAction=[!WriteKeyValue "Sphynx\DailyPhoto\FWAPhoto" "KeepOnScreen" "0" "#SETTINGSPATH#Rainmeter.ini"]
You can't use !KeepOnScreen on a config that is unloaded!
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: OnCloseAction not applied

Post by moshi »

moshi wrote: i am aware that such an action does not really make sense as OnRefreshAction would be the way to apply such settings. still i somehow would expect that this setting would be applied. not to a no longer running skin of course, but to Rainmeter.ini.
User avatar
sa3er
Posts: 152
Joined: March 2nd, 2013, 7:18 am
Location: Tehran

Re: OnCloseAction not applied

Post by sa3er »

I already provided you with a working solution regarding Rainmeter.ini.
Sorry but what you are asking is simply meaningless. ;)
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: OnCloseAction not applied

Post by moshi »

i am quite familiar with Rainmeter, so your "solution" is nothing i am particularly excited about. i even posted a "solution" using OnRefreshAction myself. i really don't think this part of the forums is about finding workarounds though.

i think there should be either a small note in the docs about Rainmeter.ini skin settings related bangs need to have the skin running to be applied. or (even better) make applying such settings independent of whether the skin is running or not.
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: OnCloseAction not applied

Post by ~Faradey~ »

i'm assuming this action is set in Sphynx\DailyPhoto\FWAPhoto, in the skin what is closing, if so then do so
OnCloseAction=!KeepOnScreen 0
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: OnCloseAction not applied

Post by moshi »

while i am not really looking for a workaround or "solution", this is an interesting observation.
so at least when the skin to apply the setting is the current skin, it works when no config parameter is used. personally, i don't think this is ideal.
User avatar
jsmorley
Developer
Posts: 22637
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: OnCloseAction not applied

Post by jsmorley »

moshi wrote:while i am not really looking for a workaround or "solution", this is an interesting observation.
so at least when the skin to apply the setting is the current skin, it works when no config parameter is used. personally, i don't think this is ideal.
While this behavior (that it works on the current skin with no config name supplied, while not working when the same config is specified) is probably a bit inconsistent, I'm not sure there is an easy change we can or should make.

The way bangs that end up impacting settings in Rainmeter.ini work is that the change is applied to the actual skin in running memory, in the code that actually controls the behavior. It isn't that the change is applied to Rainmeter.ini, and Rainmeter is constantly reading Rainmeter.ini to see how the skin should behave. Rainmeter.ini is only read when the skin is loaded or refreshed.

The change to the skin setting is then reflected out to Rainmeter.ini during the normal update cycle of the skin, or when the skin is refreshed, unloaded, or when Rainmeter is exited.

The way Rainmeter works today, it really can't apply a change to an unloaded skin, as the skin doesn't exist as far as the running code is concerned. The very first thing it asks when a bang references a "config" in a parameter is "is that skin running?". If the answer is "no", we are done. There is no such skin to make the change to.

It should not be misunderstood that using !KeepOnScreen is the same as using !WriteKeyValue on Rainmeter.ini to set the "KeepOnScreen" option.

Now, having said that, the behavior with the "current config" vs "specific config" is probably not ideal indeed. It is internally logical, but is a bit non-intuitive.

The difference in logic kind of makes sense when you consider that OnCloseAction is reacting to the current running skin being asked to close. It is logical, and sort of the entire point, that the action would take place before the skin is unloaded. OnCloseAction is not however something that "causes" as skin to close, nor can it be expected to know up front if any other skin, specified in the "config" parameter, is actually running without asking... We can't design it so an OnCloseAction in ANY skin stops the unloading of ALL skins while we check to see if some action has been requested on some other skin.

Don't forget as well, that when you have a "config" as a parameter on a bang, Rainmeter has absolutely no way to know that the parameter refers to the skin the bang is in. It doesn't care. When you don't specify a "config", you are in effect saying "me", which is a given.

There may be some change we can make to get more consistent behavior, however I warn that any change is very unlikely to ever allow setting options on unloaded skins. The current behavior is very fundamental to how Rainmeter operates internally, and I would be opposed to just changing bangs like !KeepOnScreen or !Draggable to behave as if they were just a simple version of !WriteKeyValue with a !Refresh tacked on. That would actually be a massive change to the underlying logic of Rainmeter.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: OnCloseAction not applied

Post by moshi »

thanks for the detailed explanation.
as i said, i'm not really looking for this to be changed as pretty much every scenario i can imagine, can also be done with OnRefreshAction, but maybe a note in the docs might be useful.
User avatar
jsmorley
Developer
Posts: 22637
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: OnCloseAction not applied

Post by jsmorley »

moshi wrote:thanks for the detailed explanation.
as i said, i'm not really looking for this to be changed as pretty much every scenario i can imagine, can also be done with OnRefreshAction, but maybe a note in the docs might be useful.
Fair enough.