Skin Editor

To discuss development of addons / skins / customization of MediaMonkey.

Moderator: jiri

malkierian
Posts: 101
Joined: Wed May 10, 2017 1:38 pm

Skin Editor

Post by malkierian » Mon Jun 04, 2018 10:51 pm

Hey, I was thinking it might be nice to have an in-app skin editor (for small edits, like colors and fonts and such), and am even willing to build it, but I couldn't find anything in the API that had anything to do with CSS, LESS, or skins at all. Even if there was just a way of finding out which skin the user currently has running, I could probably figure it out, but it would more likely require access to LESS processing, file I/O, skin reloading, etc. Would this be something you guys might be willing to consider putting in, so I could make it, or is this a pipe dream?

jiri
Posts: 5364
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Skin Editor

Post by jiri » Tue Jun 05, 2018 7:30 am

Hi, yes, looks like a useful tool. As for the api, you might need app.currentSkin() and app.currentLayout() to know what to edit and window.doReload() to apply the skin changes. This currently performs a complete window re-load, in order to properly apply any possible changes in JS (a skin can contain any custom JS code). We'll also try to add another api function to just reload CSS, in order to be able to perform quick hacks.

Jiri

malkierian
Posts: 101
Joined: Wed May 10, 2017 1:38 pm

Re: Skin Editor

Post by malkierian » Tue Jun 05, 2018 3:17 pm

I'm still not seeing currentSkin or currentLayout in App in the API reference (I'm using the one linked to in the announcement). Am I looking at an outdated reference? Also, are scripts/addons currently capable of loading and saving files on the filesystem?

jiri
Posts: 5364
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Skin Editor

Post by jiri » Wed Jun 06, 2018 7:20 am

Sorry about this, the docs missed some newer stuff, it's updated now (including new filesystem methods).

Jiri

malkierian
Posts: 101
Joined: Wed May 10, 2017 1:38 pm

Re: Skin Editor

Post by malkierian » Wed Jun 06, 2018 3:18 pm

Cool, I can see them now. May I request adding a Skin class to the system that will contain info like what's in the info.json, as well as the skin's system file path? Right now there's no way to guarantee you're getting the right skin path just based off of the string that App.currentSkin() returns. Access to the CSS and LESS engines would be helpful, too, but not necessary.

PetrCBR
Posts: 1448
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Skin Editor

Post by PetrCBR » Wed Jun 06, 2018 3:35 pm

Skin's are located always in 'Skins' subfolder where MM is installed.

malkierian
Posts: 101
Joined: Wed May 10, 2017 1:38 pm

Re: Skin Editor

Post by malkierian » Wed Jun 06, 2018 4:16 pm

Yes, but the name registered through info.json can't be guaranteed to correspond to the name of the folder in which that skin resides in.

PetrCBR
Posts: 1448
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Skin Editor

Post by PetrCBR » Thu Jun 07, 2018 4:54 am

For a next build i've updated skin API. Using app.getSkins() (and app.getLayouts()) you will receive list of objects with these properties: title, id, description, version, author, path, isCurrent. For skin/layout load you can use methods uitools.activateSkin(skin) or uitools.activateLayout(layout).

malkierian
Posts: 101
Joined: Wed May 10, 2017 1:38 pm

Re: Skin Editor

Post by malkierian » Thu Jun 07, 2018 11:14 am

Awesome, thanks PetrCBR. I look forward to trying them out.

Post Reply