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

Creating a new window in a GNOME extension

tl;dr How do I create an empty window in a GNOME extension? Context I'm working on an extension that will manage several windows within one. One of the first things I'm trying to achieve is to create a new empty window. What I've Tried I've found an…
Tom Klino
  • 2,358
  • 5
  • 35
  • 60
0
votes
0 answers

GtkFileChooserDialog CSS to change backgound color of Selected item

I am using GJS to create a new FileChooserDialog and want to style it. I have most of the style sorted but cannot seem to find the CSS that contols the background of the highlighted item. . My code is: let picker = new Gtk.FileChooserDialog({ …
Steve
  • 21
  • 1
0
votes
1 answer

absolute fixed positioning in GTK.Fixed

For learning, I've written a toolframe class (gtk 3.24.20), the toolframes are moveable and expandable. All toolframes are appended to a Gtk.Fixed widget. documentation about Gtk.Fixed "The GtkFixed widget is a container which can place child…
0
votes
0 answers

Can an extension dynamically change Gnome Shell Styles?

I'm working on a simple extension to color the Top Panel using a color specified in a local config file. I know that you can override Gnome Shell Styles by adding rules to stylesheet.css, however this seems to be for rules that are statically known…
bmspates
  • 11
  • 1
  • 4
0
votes
1 answer

Is it possible to create API bindings for GJS in other languages?

What I mean specifically is if it's possible to have some code written, say in C (or some other compiled language), and then expose it and use from within a GJS runtime.
ncpa0cpl
  • 192
  • 1
  • 13
0
votes
1 answer

Styling GTK widget with CssProvider ... set_name doesnt work

I set the name of buttonA to "ButtonA" but cant reach it in the css file with css selector: #buttonA, whats wrong=? and i cant set the border of a button, only for label, and for label i cant set the background-color inside the button, i only can…
0
votes
1 answer

Show svg logo on Clutter.Canvas or St.DrawingArea using cairo

I want to draw logo or image using cairo on Clutter.Canvas or on St.DrawingArea, I have tried using GdkPixbuf to load image and drawing it using cr.paint() but its not showing desired result. draw_stuff(canvas, cr, width, height) { this.lineW =…
0
votes
0 answers

How to create a screenshot on Gnome Wayland using c++?

The code using org.gnome.Shell.Screenshot does not work anymore, because GNOME Shell screenshot API no longer allowed. I receive "AccessDenied: Screenshot is not allowed." Can my desktop application get any permission to create a screenshot? Should…
vvkatwss vvkatwss
  • 3,345
  • 1
  • 21
  • 24
0
votes
1 answer

Webkit2 with gjs - get response headers

I'm experimenting with gjs and webkit2, how can i get the http headers of a request made with load_uri i have the following code const Gtk = imports.gi.Gtk, WebKit=imports.gi.WebKit2, contentManager=new WebKit.UserContentManager, view =…
0
votes
0 answers

Gnome Extension - Disable keyboard input

I'm trying to make my first ever extension for GNOME, and after watching a video with a guy having the ability to turn off his keyboard i wanted to try make an extension that did just that. By now i have made it so that the extension shows a toggle…
fLcky98
  • 13
  • 4
0
votes
0 answers

GJS: Using filter or search in TextBuffer in GJS

I've tried buffer.forward_search(), but GJS doesn't seem to support it yet. I want to be able to search a string in a TextBuffer, and get the match, and its location (start, end). Went through the wiki, GJS 3 doesn't have anything similar yet, it…
0
votes
0 answers

The websocket connection is disconnected after 6 seconds

I am using the following code to connect to the websocket, but the connection is disconnected after 6/5 seconds: const Soup = imports.gi.Soup; const GLib = imports.gi.GLib; const byteArray = imports.byteArray; const loop = GLib.MainLoop.new(null,…
Behzad
  • 23
  • 3
0
votes
1 answer

How to add custom soup message headers in gjs?

I can't find any method in Soup.Message that would allow me to add custom headers. I tried adding headers using Message.requset_headers but that field is read only. How can I add custom header to my message?
ilmix
  • 151
  • 3
  • 11
0
votes
1 answer

g_object_get_property: can't retrieve property '....' of type 'gchararray' as value of type 'GValue'

I try to understand the whole GObject stuff and tried a class with three properties, where two properties have getter and setters: 'example-property-a', 'example-property-b' Each emit the notify signal different. 'example-property-a' emits, whenever…
0
votes
1 answer

What is the role of underscore in gjs?

In gjs docs I found that underscore is used to denote private variables, but what does it do when creating objects with new or calling methods? For example in default code that gets generated when creating extension: ... let item = new…
ilmix
  • 151
  • 3
  • 11