I started learning how to write Cinnamon extensions. Well, I try to ... While I managed to write a first simple desklet, I still didn't find a really good and up to date documentation and introduction.
I have the following questions and would be very glad to get some hints:
What is the best / suggested development workflow?
For now, I do:
- copy the changed files from my project directory to
.local/share/cinnamon/uuid
, - open Melange / Looking Glass,
- search there for the extension and reload it via right click
- switch to the Log tab and check for errors
Compared to vue.js development with automatic hot-reload of changes in the browser, this seems a bit ... well ... time-consuming.
Where do I find an introduction to the available widgets and widget libraries?
I understood that there is Gtk and St and both have JS / GJS / CJS bindings.
The Gnome Dev Docu doesn't mention St
. And I read in another answer here that it seems that shell extensions doesn't use Gtk
, but rather St
instead (and not in addition?).
I didn't find any documentation for CJS
at all, but as far as I understood so far, it seems to be quite similar to GJS
. Seems that the way desklets and applets are defined is different?
But now, I still would enjoy to have a (at least brief) introduction which widgets are available. While in Gtk there seems to be a whole set of different list-like widgets, I didn't find any list widget in St. And it seems that I can't use Gtk widgets as children of St widgets ...? This St documentation lacks any overview of available widgets and classes and what they can be used for.
Documentation about events
I found that there is the St.Entry widget that can be used for single-line text input. I found somewhere that I can bind functions to key press key release events like this:
this.input.connect('key-release-event', (widget, event) => {
const input = widget.get_text();
// ...
return true; // event has been handled
});
I didn't managed to get some information for the event.
When printing with JSON.stringify(event)
It shows an empty object.
This Gtk documentation looks like there should be fields such as keyval
and state
, but these are undefined.
This is really kind of frustrating when it takes ages for every very small step to understand ... so, I would really appreciate any hints and suggestions!