Connect('notify::hover-out')

Tooltip worked out, how to get mouse hover out signal ?

const label_tooltip = new St.Label({ text: 'aaa' });
label_tooltip.set_style('background:#222;padding:10px;');
global.stage.add_child(label_tooltip);
label_tooltip.hide();
this._indicator.connect('notify::hover', () => {
    const [x, y] = this._indicator.get_transformed_position();
    label_tooltip.set_position(x, y - label_tooltip.height);
    label_tooltip.show();            
});
this._indicator.connect('notify::hover-out', () => { // Fix Me
    label_tooltip.hide();
});

notify::hover can watch on and out !

this.label_tooltip = new St.Label({ text: '' });
this.label_tooltip.set_style('background:#222;padding:10px;');
global.stage.add_child(this.label_tooltip);
this.label_tooltip.hide();
this._indicator.connect('notify::hover', () => {
    const [x, y] = this._indicator.get_transformed_position();           
    this.label_tooltip.set_position(x, y - this.label_tooltip.height);
    if (this._indicator.hover)
        this.label_tooltip.show();
    else
        this.label_tooltip.hide();
});
1 Like