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
4
votes
1 answer

Can't change dconf-entry with GSettings

I'm currently building a simple application on Gjs, which should change the background-image of my gnome-shell. A solution on how this can be done using the gsettings-tool can be found here. Since I want to build a desktop-application around it, I…
Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
4
votes
1 answer

Sharing code between a GTK/GJS App and a Gnome Shell Extension

I am developing a GTK application in GJS and like to reuse parts of the GTK code inside a Gnome Shell extension. However, I did not find a way to add a Gtk.Widget to the menu of my Gnome Shell panel icon. I tried to use GtkClutter.Actor from…
Juve
  • 10,584
  • 14
  • 63
  • 90
4
votes
2 answers

How do I check that a Gjs class has already been defined?

I am writing the preference view a GNOME shell extension and an facing issues when using the imports.lang function to write the application in an object oriented fashion. const Gtk = imports.gi.Gtk const Lang = imports.lang Gtk.init(null) const…
kiyui
  • 375
  • 3
  • 14
4
votes
1 answer

Should I use JavaScript to develop Linux (GNOME & Gtk) applications?

I've done Python and C apps using Gtk+ and GNOME APIs, and now I see there's support for JavaScript in GNOME 3 thanks to GJS (and I've also heard about seed). So, I have to ask: does it worth it? I just want to know if GJS has gained attention and…
Noe Nieto
  • 2,521
  • 2
  • 17
  • 25
4
votes
2 answers

Unicode file I/O with Javascript and gjs?

Can anybody give any working example of how to read/write Unicode text files using Javascript and Gjs, possibly using Gio and/or Glib? I'm experienced in Javascript, but these APIs are still alien to me and being quite new technologies, googling is…
Mehdi
  • 1,075
  • 1
  • 11
  • 24
3
votes
0 answers

How can I list all files of a directory more simpler in GJS

Now i can use Gio.File.new_for_path Gio.File.enumerate_children Gio.FileEnumerator.next_file to list all files in directory. But It's too heavy to bring out all attributes of all files, I only need put filenames into an array. I want more simpler…
eexpress
  • 386
  • 1
  • 14
3
votes
1 answer

Develop GJS in Visual Studio Code

When working with GJS there does not seem to be any documentation. Is there an integration for Visual Studio Code, at least?
abergmeier
  • 13,224
  • 13
  • 64
  • 120
3
votes
1 answer

Avoid allocation errors with destroy() and async functions

The following is a simple scenario for some GNOME extension: Enable the extension. The extension is a class which extends Clutter.Actor. It creates an actor called myActor and adds it: this.add_child(myActor). Then it calls an…
3
votes
1 answer

Why doesn't a Webkit.WebView display if it's a child of a Gtk.Grid?

In the first gjs tutorial, it shows how to create a Gtk.ApplicationWindow which contains only a WebKit.WebView. The example code given on that page works fine for me. But if I modify that code to create a Gtk.Grid and put the WebView in that, it…
Marnanel Thurman
  • 261
  • 1
  • 10
3
votes
1 answer

GJS/GTK Why can't I replace gtk treeview model (columns)?

I am starting off with an empty table (liststore with one column) I want users to be able to import a CSV file and have the contents displayed. Importing the file works and the CSV data is indeed displayed, but the original column (titled "No…
brainstormtrooper
  • 485
  • 2
  • 6
  • 18
3
votes
1 answer

How can I send and receive a signal when a file loads in my GJS app?

I have an app that needs to open a file and update UI elements accordingly. I can select and open the file (and log the file contents), but I can't tell the UI elements to update. I have tried read that I can create and add signals to just about any…
brainstormtrooper
  • 485
  • 2
  • 6
  • 18
3
votes
1 answer

How can I test my GNOME Shell extension without risk of crashing the shell?

During development, I introduced an error to my extension that causes gnome-shell to crash upon trying to load the extension with the following rather broadly phrased error message: Execution of main.js threw exception: JS_EvaluateScript()…
raphinesse
  • 19,068
  • 6
  • 39
  • 48
3
votes
1 answer

Is it possible to import the Gvc typelib outside of the Gnome Shell environment?

I'd like to use Gvc (libgnome-volume-control) as used in Gnome Shell GIR in GJS, but can't find a way to access it except within the Gnome Shell environment (eg. a Gnome Shell extension). Actually, I can't even figure out where it is. Is this…
3
votes
1 answer

What is the correct way in GJS to define a GObject property for an Array?

I see in the GJS GObject overrides there are definitions for most types that correspond to Javascript types, but how should I define a property for a standard Array of strings? Some options that have occurred to me: use TYPE_OBJECT and a GList, but…
andy.holmes
  • 3,383
  • 17
  • 28
3
votes
1 answer

GNOME Shell Extension Button

I'm trying to write an extension with just using JavaScript. I wrote it with Python through Hello World! code. But, yet in the beginning, my button for menu items is not working. Also, I couldn't add menu item with Hello World! code. I think, I miss…
1
2
3
12 13