6

Answer to a similar question suggests that I cannot import Shell stuff in a standalone mode. However, as I understand it, St is a separate library written in C. Yet I still cannot import it in gjs...

I.e.

$ gjs -c "imports.gi.Gtk"

works (i.e. no output). But

$ gjs -c "imports.gi.St"

fails with

Error: Requiring St, version none: Typelib file for namespace 'St' (any version) not found

Is there any way to import St library from a standalone (not GNOME Shell extension) gjs?

Community
  • 1
  • 1

2 Answers2

8

Some of them are not there (e.g. Meta, Shell, St) because they are considered "private". Read more here on how to import them: http://mathematicalcoffee.blogspot.ca/2012/09/developing-gnome-shell-extensions_6.html?m=1

St Lib would really (!!!) help in writing apps with custom interfaces due to the use of CSS. If we could use the library with Clutter and gjs it would really attract developers due the easy of use of St and Shell libraries.

artonio
  • 141
  • 1
  • 5
  • But I don't see how to import them in that post. As I understand it, it mostly covers documentation. –  Jan 05 '13 at 18:39
  • Hmm, yes I tried to copy the St-1.0.typelib to /usr/lib64/girepository-1.0, after that I can do: imports.gi.St but after creating any St objects I get an error – artonio Jan 05 '13 at 23:09
  • I'm accepting the answer on the basis of "because they are considered 'private'". –  Jan 06 '13 at 12:56
0

Please try:

#!/usr/bin/gjs

const res = imports.gi.GIRepository.Repository

res.prepend_search_path('/usr/lib/x86_64-linux-gnu/mutter-11')
res.prepend_search_path('/usr/lib/gnome-shell')

const St = imports.gi.St;

Depending on your setup, the libraries can be on different location. Please also check https://gist.github.com/buzztaiki/1492431 and Could not find Meta, Shell & St in Python's GTK bindings which gjs has

Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87