Align Label text in Button and Tooltip text of Cinnamon Desklet to left

Forum rules
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 2
Joined: Sun Feb 18, 2018 1:21 pm

Align Label text in Button and Tooltip text of Cinnamon Desklet to left

Post by kanchudeep » Fri Mar 30, 2018 1:35 am

I have a Cinnamon Desklet which consists of a Button. The Button has a Label (with some text) and also a Tooltip:

Code: Select all

const Desklet = imports.ui.desklet;
const St =;
const Tooltips = imports.ui.tooltips;

function MyDesklet(metadata, desklet_id) {
    this._init(metadata, desklet_id);

MyDesklet.prototype = {
    __proto__: Desklet.Desklet.prototype,

    _init: function(metadata, desklet_id) {, metadata, desklet_id);


    setupUI: function() {
        // main container for the desklet
        this.boxLayout = new St.BoxLayout({
            vertical: true,
            width: 100,
            height: 40

        let label = new St.Label({text: "Label text"});
        // style does not work
        let button = new St.Button({child: label, style: "text-align: left;"});
        let tooltip = new Tooltips.Tooltip(button,
        // Does not work = "text-align: left;";


function main(metadata, desklet_id) {
    return new MyDesklet(metadata, desklet_id);
The above code results in this Desklet:
desklet.png (13.31 KiB) Viewed 1309 times
How can the Label text inside the Button and the Tooltip text be aligned to left instead of centre?

Post Reply

Return to “Compiz, Conky, Docks, & Widgets”