Re: gnome-shell under Seed (not)
- From: Robert Carr <carrr rpi edu>
- To: Dan Winship <danw gnome org>
- Cc: gnome-shell-list gnome org
- Subject: Re: gnome-shell under Seed (not)
- Date: Mon, 23 Mar 2009 01:07:28 -0400
On Sun, Mar 22, 2009 at 10:02 PM, Dan Winship <danw gnome org> wrote:
>
> Just for fun, I tried making gnome-shell work with Seed instead of
> gjs... (Well, for fun, and with an eye towards eventually sucking
> epiphany into the window-manager-panel-megaprocess as well, for deep
> shell/web integration...)
>
> It turns out to not really be possible (currently?), but I figure
> someone else is going to have this idea at some point, so I should send
> mail with my findings.
Thanks, this is something I've been thinking about doing.
>
> gnome-shell doesn't really depend on anything specific to *gjs*; it
> depends on some of gjs's custom javascript modules (signals, tweener,
> lang, etc), but those are just javascript and we could copy them into
> gnome-shell for Seed to use. It also depends on some Mozilla javascript
> extensions; we could just add the new Array methods (filter, etc) to
> Array's prototype ourselves. For the syntactic things like "const" and
> "let", we could probably change almost all of them to "var" and it would
> all still work. (We'd be unhappy about doing that, but...)
>
const works, let doesn't. They aren't opposed to adding it, it's just
not a priority
> The real trick turns out to be the fact that you can't import a
> javascript file *into a namespace* in Seed the way you can in gjs. That
> is, given a file bar.js that does "var x = 5;", in gjs you can do:
>
> var x = 3;
> const Bar = imports.bar;
>
> and then x is still 3, and Bar.x is 5. But with "Seed.include('bar.js')"
> in Seed, bar.js's x would just overwrite the other x, and there's no way
> to make it work any other way. In fact, I think it's not possible to do
> this at all with JavaScriptCore; JSEvaluateScript() only lets you
> evaluate code in the scope of the global object, and while you could do
> something like:
Seed will support GJS style (compatible) imports as the sole import
mechanism within the last few weeks, I'm a big fan of the mechanism
>
> (function() { Seed.include('bar.js'); })()
>
> and thereby execute the code in its own scope, there's no way to get
> access to that scope and assign it to a variable.
>
> So to make gnome-shell work in Seed, we'd either have to rewrite
> everything to get rid of per-js-file namespaces, or else we'd have to
> rewrite everything to namespace the functions and variables by hand when
> defining them.
>
> That was the point where I gave up. (Well, actually, I tried for a while
> to write a perl script to rewrite the js files to manually namespace
> everything, and maybe that would have eventually worked, but by this
> point it was getting too messy for a quick hack...)
>
> -- Dan
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]