Skip to content

Instantly share code, notes, and snippets.

@rcassani
Last active October 19, 2023 13:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcassani/63bbc282efa9328302b589d3a3e06f75 to your computer and use it in GitHub Desktop.
Save rcassani/63bbc282efa9328302b589d3a3e06f75 to your computer and use it in GitHub Desktop.
Simple desklet for Cinnamon (desktop environment)
const Desklet = imports.ui.desklet;
const St = imports.gi.St;
function MyDesklet(metadata, desklet_id) {
this._init(metadata, desklet_id);
}
MyDesklet.prototype = {
__proto__: Desklet.Desklet.prototype,
_init: function(metadata, desklet_id) {
Desklet.Desklet.prototype._init.call(this, metadata, desklet_id);
this.setupUI();
},
setupUI(){
// creates container for one child
this.window = new St.Bin();
// creates a label with text
this.text = new St.Label({text: "Hello Desktop"});
// adds label to container
this.window.add_actor(this.text);
// Sets the container as content actor of the desklet
this.setContent(this.window);
},
};
function main(metadata, desklet_id) {
return new MyDesklet(metadata, desklet_id);
}
{
"max-instances": "10",
"uuid": "first-desklet@rcassani",
"name": "First Desklet",
"description": "This is my first desklet",
"version": "0.1",
"prevent-decorations": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment