Questions tagged [gjs]

Gjs is a JavaScript binding for GNOME. It allows to create desktop-applications with JavaScript.

Gjs is mainly based on the Spidermonkey javascript engine (by Mozilla) and the GObject introspection framework. It uses Gtk-bindings to enable the user to create real desktop-applications.

Gjs is part of and is also used to create gnome-shell-extensions.

Useful links

193 questions
90
votes
6 answers

How to define setter/getter on prototype

EDIT Oct 2016: Please note this question was asked in 2012. Every month or so someone adds a new answer or comment that refutes an answer, but doesn't really make sense to do so as the question is probably out of date (remember, it was for Gnome…
mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194
17
votes
0 answers

Use Eclipse as GNOME Extension IDE

I am trying to develop my own GNOME Extension. I have read several articles: gnome-shell-extensions-getting-started gnome-whiteboards-hello-ide and the official one. StepByStepTutorial#fromScratch-settingUpEclipse From wiki.gnome.org: It is…
Zic0
  • 181
  • 4
14
votes
1 answer

bwrap: execvp application: No such file or directory (GNOME Builder Flatpak)

When I try to run the GJS GNOME Example application from GNOME Builder 3.32.4 (Flatpak'ed), I get the error: bwrap: execvp : No such file or directory I tried "Clean" and "Rebuild" the project, but with no help. This only happens…
Bastian
  • 620
  • 5
  • 14
14
votes
2 answers

What is imported using the Gjs imports statement?

If I'm looking at Gjs code and see this line near the beginning: const Gio = imports.gi.Gio; How can I know what methods, constants, events, etc. are on 'Gio' (without doing a Google search)? Is there a file somewhere on my installation that…
Marcel Lamothe
  • 12,452
  • 9
  • 34
  • 44
11
votes
1 answer

Using gjs, how can you make an async http request to download a file in chunks?

I'm starting on my first javascript GTK app and I want to download a file and track it's progress with a Gtk.ProgressBar. The only docs I can find about http requests are some example code…
micah
  • 353
  • 2
  • 10
10
votes
1 answer

GJS: Gtk.TextView key-press-event does not work

I am trying to create simple gtk application for gnome-shell using gjs. Its window contains Gtk.TextView only and I want to process events when user is typing. Here is my code: #!/usr/bin/gjs var Gtk = imports.gi.Gtk; function MainWindow () { …
9
votes
1 answer

GNOME Shell Extension Install possible without Restart?

I have written a small GNOME Shell extension, that I want to distribute to some collegues. For this I created a RPM. After the installation a restart of GNOME-Shell is needed to make the extension visible, so it can be enabled. Either by using…
Ralf
  • 1,773
  • 8
  • 17
8
votes
2 answers

How to set a including path in the Gjs code?

As i could see, the Gjs imports, loads only /usr/share/gjs-1.0 and /usr/lib/gjs-1.0 by default. I want to modularize an application, like we can do with node, but i must find modules relative to the script file. I found this two ways to add include…
Aurium
  • 599
  • 5
  • 12
7
votes
1 answer

Call Gnome Shell Shortcuts programmatically

Gnome Shell has great shortcuts, however, I don't find a way to call them programmingly Assume that I want to use a GJS script to start Google Chrome, move it to workspace 1, and maximize it, then start Emacs, move it to workspace 2, and maximize…
Zeno Zeng
  • 301
  • 3
  • 7
7
votes
2 answers

Calling DBus methods in Gjs / Gnome Shell

If I have a bus name, an object path, and an interface, how do I call DBus methods from Gjs (in a gnome-shell extension)? I'm looking for the equivalent of the following python code: import dbus bus = dbus.SessionBus() obj =…
jdm
  • 9,470
  • 12
  • 58
  • 110
6
votes
2 answers

How to import St library in gjs

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…
user319799
5
votes
2 answers

Gnome Extensions - Run shell command

I am writing a simple extension to open browser by clicking the extension button. I would like to know if there is a function which can execute passed shell command as argument. Also, it'd be really helpful if anyone can suggest a good simple…
Sam Fischer
  • 51
  • 1
  • 6
5
votes
1 answer

Extension event loop in Gnome 3.10 vs 3.14

I wrote this accessibility extension: https://extensions.gnome.org/extension/975/keyboard-modifiers-status/ https://github.com/sneetsher/Keyboard-Modifiers-Status Which works as supposed in Gnome Shell v3.14 & v3.16 but not in v3.10. It shows the…
user.dz
  • 962
  • 2
  • 19
  • 39
5
votes
2 answers

How to use C libraries to create GNOME app in JavaScript

I am a beginner in GNOME desktop application development so I am trying to learn about it as much as possible. I have read various tutorials present on developer.gnome.org written for JavaScript. I know that through GObject Introspection I can…
prolific
  • 765
  • 1
  • 6
  • 23
5
votes
4 answers

GJS read file synchronously

I'm trying to use GJS and more precisely to read a text file in a synchronous way. Here is an example an the asynchronous function for file reading gio-cat.js I found how to proceed with seed using the next function: function readFile(filename) { …
1
2 3
12 13