Last active
October 19, 2023 13:52
-
-
Save rcassani/63bbc282efa9328302b589d3a3e06f75 to your computer and use it in GitHub Desktop.
Simple desklet for Cinnamon (desktop environment)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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