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
0
votes
2 answers

Using gio.lookup_by_address

Most of the code is borrowed, JS is not my way, but an extension needs to be created. Can you tell me how to use g_resolver_lookup_by_name() to return IP within the given code? g-resolver-lookup-by-name const Main = imports.ui.main; const St =…
Violet
  • 99
  • 1
  • 5
0
votes
1 answer

How to run GJS (meson) project from terminal?

I'm trying to learn programming in GJS and meson. I've generated GJS project using Gnome Builder. Because Gnome Builder is not suitable for me, I would like to use other IDE like VS Code or IntelliJ IDEA. How can I run the project from terminal?…
Ivan Banha
  • 753
  • 2
  • 12
  • 23
0
votes
1 answer

GObject.ParamFlags.CONSTRUCT_ONLY throws error unless it's also WRITABLE

im trying to learn gjs and having a few questions which i think are basic about ParamFlags. I'm creating a subclass and trying to use GObject.ParamFlags.CONSTRUCT_ONLY | GObject.ParamFlags.READABLE for one of the parameters. The use case being what…
keponk
  • 281
  • 1
  • 3
  • 14
0
votes
0 answers

Get Dash instance when creating GNOME Shell Extension

I'm creating my own extension for GNOME Shell and I run into problem while searching for some documentation of Dash. I need to find width, height, visibility and position of Dash. But I have been unsuccesful to find some doc at…
Payne
  • 456
  • 6
  • 21
0
votes
1 answer

How to add a button to the main menubar in Gjs/Gtk

I've looked all over for documentation on how to add a button to the main menu bar, but all I've found is documentation regarding menu bars for application windows. Can anyone point me in the right direction on what Gtk classes I should be using to…
Xylude Xaalud
  • 388
  • 1
  • 4
  • 11
0
votes
1 answer

Convert String to UTF-16 Byte Array in GJS

In my Gnome Extension I would like to call GLib.convert. Sadly it does not work with strings but wants a ByteArray. Now I wonder how to convert a Javascript String into a UTF-16 Byte Array. Bonus points if this uses some part of the Gnome bindings…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
0
votes
1 answer

GJS Notification - no notification shown

I am working on one project, that will create notification from gjs script. There is no error, but notification is not shown. Any suggestion? Code: #!/usr/bin/gjs const Gio = imports.gi.Gio; var Application = new…
Milan Jurkulak
  • 557
  • 3
  • 6
0
votes
2 answers

How to use Clutter.ShaderEffect.set_uniform_value() properly?

I am trying set a uniform float of a Clutter.ShaderEffect. This works well if floating point Numbers are passed to set_uniform_value(). However, when you pass an integer Number, an OpenGL error (1282, Invalid operation) is thrown. It seems that the…
Simme
  • 565
  • 4
  • 7
0
votes
1 answer

Formatting Gtk.SpinButton's output does not work for single mouse clicks

I'm trying to format the output of Gtk.SpinButton in GJS. The goal for now is to simply prepend a string "prefix" to SpinButton's text. Here's a barebone implementation: #!/usr/bin/gjs imports.gi.versions.Gtk = "3.0"; const { Gtk } =…
0
votes
1 answer

What's wrong with my gjs meson build setup?

I have a Gnome GJS app and would like to package it with Meson. The app source (in ./src) has subfolders lib, object, and ui. Each subfolder has a meson.build file that looks like this (for the ./src/lib folder): app_resource =…
brainstormtrooper
  • 485
  • 2
  • 6
  • 18
0
votes
1 answer

Await on an async lambda function gjs

I'm trying to get make the async calls bellow (they are async because of a external API, not my design) to run sequentially, now I managed to have foo be awaited by it's calling function but I'm having trouble awaiting for foo2 because I get the…
0
votes
1 answer

Connect to swipe signal in GNOME St

Trying to connect a StButton to a swipe signal, I get an error: JS ERROR: Extension screensaver-dashboard@singularities.org: Error: No signal 'swipe' on object 'StButton However, I can see the signal among Clutter Actions…
Antonio Tapiador
  • 4,326
  • 1
  • 15
  • 8
0
votes
1 answer

How to handle gjs error parsing clusterplatform option?

I am using gjs-1.52.5 to split GATE macro for multi-core computation with condor HPC platform. I follow the guide from openGATE instruction of gjs from here: https://opengate.readthedocs.io/en/latest/how_to_use_gate_on_a_cluster.html But there is…
Xinjie Cao
  • 21
  • 6
0
votes
2 answers

How to update widget when new style is applied

I'm making an extension with a list containing a checkbox with a text item (St.label) that change style when toggled. I'm listening to the toggle event, and as the item is toggled, I set a new style for my text using set_style_class_name() on a my…
mhlsf
  • 303
  • 4
  • 14
0
votes
1 answer

Parse XML in GJS?

How can I parse XML in GJS code? Specifically, in a gnome shell extension? I haven't found anything, and there doesn't seem to be a GJS XML library. Also, GJS doesn't appear to be compatible with nodejs, so I can't use xml-js or the like? Am I…
user355252