Hmm, well perhaps not the easiest task to jump into for your first ever
extension...(I vaguely remember a "save session" button that there used to
be that would open all your windows etc for you when you logged in; I
assume that's what you're after?)

In terms of UI, there are typically two ways to do it:

* modifying various graphical elements in gnome-shell, like adding buttons
to the status area etc. These typically use the classes in imports.gi.St[1].
* Gtk-type UIs which use imports.gi.Gtk[2]. Each extension's preferences in
the preferences widgets is done using these.

For the sort of thing you have in mind, I recommend using Gtk and doing all
the UI stuff in the preferences widget.
The problem with this though is that the preferences widget and your
extension can't really communicate directly to one another; typically this
is done using Gio.Settings[3] (the prefs widget modifies a setting, and the
extension listens for the setting being changed).
(Note - for getting an idea of preferences widgets and setttings and all
that, I strongly recommend browsing the code of extensions you find that
have preference widgets)

I'm not entirely sure how you would execute the *functionality* of your
widget (I never understood how that save session feature worked), but
perhaps these may help:

You can use `global.get_window_actors` (from within the extension) to get
the Meta.WindowActor for each window the user has open; use
`windowActor.meta_window.get_{title, outer_rect, input_rect, pid}` to get
the window's title, location, pid etc.

You can use `Shell.WindowTracker.get_default().get_window_app(metaWindow)`
to get the Shell.App[4] corresponding to a window and there are various
other functions that the Shell.App has to launch new windows, query about
its windows etc.

As to finer points about saving window state (like if I ran
`chromium-browser http://foobar.com`, what the command-line arguments
were), I'm not sure, but you may be able to get some limited ability to
query such things.

You might also want to listen to log-(out|in) or session (start|end) to
know when to save/restore state; I think there's a way to do this but I
don't know myself (I vaguely remember seeing something in gnome-shell's JS
files about this; perhaps /usr/share/gnome-shell/js/misc/loginManager.js?)

cheers
Amy

[1]: https://developer.gnome.org/st/stable/
[2]: https://developer.gnome.org/gtk3/stable/
[3]: https://developer.gnome.org/gio/stable/GSettings.html
[4]: https://developer.gnome.org/shell/unstable/shell-ShellApp.html

On 19 May 2013 02:34, Jason Satterfield <jnsatterfi...@gmail.com> wrote:

> I want to thank everyone for the warm welcome. I appreciate the expedient
> response, as well.
>
> The idea I have is to add a simple season manager to the shell so that
> users can manage how the open apps and documents are handled after a system
> restart.
>
> The premise can be expanded to allow apps an opportunity to save their
> current state to disk so that they can be restored to those states when the
> system comes back up.
>  On May 18, 2013 2:11 AM, "Emmanuele Bassi" <eba...@gmail.com> wrote:
>
>> hi;
>>
>> On 18 May 2013 02:05, Jason Satterfield <jnsatterfi...@gmail.com> wrote:
>>
>> > So now for the reason of this post.  I've got an idea about a shutdown
>> > option, but after downloading the Gnome-shell source, I immediately
>> realized
>> > that I'm not prepared to create an HTML5/Javascript extension.
>>
>> Shell extensions are not HTML5/JavaScript. while they are written in
>> (a superset of) JS and may use (a subset of) CSS for styling, they are
>> not using HTML for their scene graph.
>>
>> usually asking specific questions helps getting better answers, though.
>>
>> ciao,
>>  Emmanuele.
>>
>> --
>> W: http://www.emmanuelebassi.name
>> B: http://blogs.gnome.org/ebassi/
>>
>
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
>
>
_______________________________________________
gnome-shell-list mailing list
gnome-shell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list

Reply via email to