It is currently November 4th, 2024, 7:13 am

Skins: New @Resources folder

Changes made during the Rainmeter 2.5 beta cycle and earlier.
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Skins: New @Resources folder

Post by jsmorley »

As the first step in a re-design of how .rmskins are created and installed in Rainmeter, we are changing how resources like fonts, addons, images, sounds, include files and other things used by your skin are handled by Rainmeter. This change will also completely eliminate the need for the LocalFont setting in skins.

The key to this functionality is support for a new @Resources folder under the root level of the skin suite (e.g. Skins\illustro\@Resources).
  • Any font files found under @Resources\Fonts will automatically be loaded and available in the skin. There will be no need to use LocalFont in [Rainmeter], and there should seldom if ever be any reason to distribute a skin with the .rmskin configured to install the font to the user's system. Just put the font in the correct folder in the skin and you are done.
  • Any files, such as addons, images, sounds, include files or any other resources your skin uses should be kept in this folder, and then can be accessed with a new #@# variable, which expands to #ROOTCONFIGPATH#@Resources\.

    For example, use:

    Code: Select all

    ImageName=#@#Images\MyImage.png
    @Include=#@#Settings.inc
    Instead of:

    Code: Select all

    ImageName=#ROOTCONFIGPATH#@Resources\Images\MyImage.png
    @Include=#ROOTCONFIGPATH#@Resources\Settings.inc
  • The @Resources folder is ignored when scanning for skins. Keeping images and other common files there will speed up the load time of Rainmeter.
In future skins, you should use @Resources in your skins. It is going to be best to store resources (such as images, addons, fonts, etc.) there.
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Re: Skins: New @Resources folder

Post by XANCI »

seems @\ to #ROOTCONFIGPATH#@Resources\ can't be used in !WriteKeyValue to designate target .ini/.inc file
poiru
Developer
Posts: 2873
Joined: April 17th, 2009, 12:18 pm

Re: Skins: New @Resources folder

Post by poiru »

XANCI wrote:seems @\ to #ROOTCONFIGPATH#@Resources\ can't be used in !WriteKeyValue to designate target .ini/.inc file
Fixed it for the next release. Thanks for reporting! :)
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skins: New @Resources folder

Post by jsmorley »

We have changed @\ to #@# be both behave exactly as any variable replacement does, and to make it more consistent. Be sure to get the latest r1395 beta at http://rainmeter.net.
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Re: Skins: New @Resources folder

Post by XANCI »

should or should not Lua files be placed in @Resources?
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skins: New @Resources folder

Post by jsmorley »

XANCI wrote:should or should not Lua files be placed in @Resources?
That is entirely up to you. I don't, so I end up with @Resources folder, SkinName.ini and LuaName.lua in the root of my skin folder. I do it that way mostly as I like to be able to get at the .lua files to edit them without having to dig for them, but it is just personal preference. I think the perfectionist approach would probably be to put just the .ini file in the root, and everything else in @Resources.
User avatar
MarcoPixel
Posts: 42
Joined: June 8th, 2012, 9:43 am
Location: Austria

Re: Skins: New @Resources folder

Post by MarcoPixel »

Im a little bit confused about that new folder. How can i use plugins which NEEDS to be installed in #AddonsPath#?

Can we maybe get an example skin with Variables, Addons and Themes?

Greets,
Marco
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skins: New @Resources folder

Post by jsmorley »

MarcoPixel wrote:Im a little bit confused about that new folder. How can i use plugins which NEEDS to be installed in #AddonsPath#?

Can we maybe get an example skin with Variables, Addons and Themes?

Greets,
Marco
The way this will work from here out is that you should try to make your skins as "self-contained" as possible. The simplest and most reliable way is to use the new @Resources folder to store and access supporting files for your skins.

This is one recommended approach. There is nothing that says you have to do it exactly this way, but in my opinion it makes it easier to distribute your skins, and easier to manage them yourself.

Images, sounds and Lua scripts:

These should be kept in their own folders in the @Resources folder. So you would have YourSkinFolder\@Resources\Images, and access it with ImageName=#@#Images\SomeImage.png in an Image meter.

Fonts:

These should be kept in a folder in your skin specifically called @Resources\Fonts. The folder names above are just a suggestion, but with fonts it needs this specific name. If you put a font .ttf file in this folder, it will automatically be loaded by Rainmeter and available to use with FontFace=MyFont in your skin. Do NOT use LocalFont in the [Rainmeter] section of your skin any more, it just isn't needed.

Addons:

Executable addons should also be kept in the @Resources folder with your skin. I recommend using YourSkinFolder\@Resources\Addons. Then you can call the addon with LeftMouseUpAction=[#@#Addons\MyAddon.exe "Some Parameter"]. Please note that you will want to contain the call to external applications inside square brackets "[]". Please completely avoid the use of #ADDONSPATH# at all. It is no longer needed, and only supported for backwards compatibility with older skins.

If you have an existing adddon written specifically for Rainmeter that REQUIRES that it be in a folder relative to Rainmeter.exe (a few addons baked in "..\..\Rainmeter.exe" assuming that they were in the old C:\Program Files\Rainmeter\Addons\MyAddon\MyAddon.exe location) then you will need to manually move it to C:\Users\YourName\Appdata\Roaming\Rainmeter\Addons and use #ADDONSPATH# to call it. This should be avoided at all costs, as it is then very difficult to distribute your skin. The Addons specific path is no longer available when you create a .rmskin, and only supported at all so older skins don't break.

Custom Plugins:

If you are using or distributing a custom plugin .dll file with your skin, it must be kept in C:\Users\YourName\Appdata\Roaming\Rainmeter\Plugins. Any plugin .dll found in that folder when Rainmeter starts will be loaded and available to use with your skins by simply using Plugin=MyPlugin.dll on your measure. These plugins can be added to a .rmskin when you create it, but be aware that you need both 32bit and 64bit versions of the plugin to add it to a .rmskin. We don't want folks distributing skins that are crippled when used on a different operating system architecture.

Themes:

There is really no change to how themes are managed. You use the Themes tab in the Manage application from the context menu, and save a theme with your current layout. Then when you create a .rmskin you simply add the theme to the file, and it will be installed (and optionally loaded) when the user runs the .rmskin.

I hope this helps.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Skins: New @Resources folder

Post by Seahorse »

jsmorley wrote:Custom Plugins:

If you are using or distributing a custom plugin .dll file with your skin, it must be kept in C:\Users\YourName\Appdata\Roaming\Rainmeter\Plugins. Any plugin .dll found in that folder when Rainmeter starts will be loaded and available to use with your skins by simply using Plugin=MyPlugin.dll on your measure. These plugins can be added to a .rmskin when you create it, but be aware that you need both 32bit and 64bit versions of the plugin to add it to a .rmskin. We don't want folks distributing skins that are crippled when used on a different operating system architecture.
OK, so is this the right location for plugins in the skin folder for plugins?:

YourSkinFolder\@Resources\Plugins\64Bit
&
YourSkinFolder\@Resources\Plugins\32Bit
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skins: New @Resources folder

Post by jsmorley »

Seahorse wrote: OK, so is this the right location for plugins in the skin folder for plugins?:

YourSkinFolder\@Resources\Plugins\64Bit
&
YourSkinFolder\@Resources\Plugins\32Bit
No sir.

Plugins go in:

C:\Users\YourName\AppData\Roaming\Rainmeter\Plugins

When you add them to a .rmskin, they can be added from anywhere. Then when the .rmskin is installed by the user, the correct (32bit or 64bit) version ONLY will be installed to that folder in APPDATA.