MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 209 forks source link

Graphite app appearance ? #118

Closed perfaram closed 10 years ago

perfaram commented 10 years ago

Couldn't we add support for the graphite app appearance ? image

Can be done through putting the following in main.m :

[[NSUserDefaults standardUserDefaults] setVolatileDomain:@{@"AppleAquaColorVariant": @6} forName:NSArgumentDomain];

This works in regular Cocoa apps, but I don't know exactly in which order MacGap loads things... E.g : If MacGap starts looking at JS only after Window creation, then we're screwed

jeff-h commented 10 years ago

Are you saying this code temporarily changes the system appearance setting to graphite, for when this app is active? I had a quick try and it didn't seem to do this, at least not after the window is already drawn.

I did see code around which reads this value so if we added support for that, you could have your app's JS adjust the CSS to a graphite theme.

perfaram commented 10 years ago

When you put the code I gave in main.m : macgapgraphite - copie

The result is : macgap2

I changes the appearance for the app only (e.g, like FCPX)

perfaram commented 10 years ago

Well, looks like it can only be changed before the Window drawing

EDIT : Now I'm sure, it has to be done before drawing I tried putting the following first in the beep function (didn't work), just after drawing (didn't work), and then just before drawing (worked)

NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setVolatileDomain:@{@"AppleAquaColorVariant": @6} forName:NSArgumentDomain];
jeff-h commented 10 years ago

Sounds like an ideal contender for the MacGap 2 way of doing things. MG2 is currently under very early development, but one improvement is the addition of a config.json file which allows the JS developer to specify a bunch of initial settings, currently covering items such as the window size and position, meaning these can be applied before the window is drawn (and before any JS has even run). It would almost certainly be trivial to add your idea above in this scenario.

Can you think of a way to get this working within the current codebase? I guess I would rather not go adding a config.json into MacGap 1 at this point.

perfaram commented 10 years ago

Within the current code, no. But with MacGap 2, yes, and this is great news ! Sounds really good

jeff-h commented 10 years ago

Referenced this issue from the wiki here: https://github.com/maccman/macgap/wiki/MacGap-2-planning

jeff-h commented 10 years ago

Sadly even in MG2 this looks like it's tricky. The issue is always that it seems to have to run so very early in the process. Currently where we load the config.json file in MG2 it's not early enough for this to have any effect.

We'll definitely keep this on the list and see if things come together in MG2 in such a way that this will be possible.