brenard
(Benjamin Renard)
July 7, 2023, 12:44pm
1
Hello,
I’m looking for a way to add a tooltip on a St.Bin
element in an extension indicator (in status bar), but I did not find a solution for this. Do you have any idea for that ?
Just in case, the code of the extension (focus on the related St.Bin
element):
this.rebuildTray();
this.buildTempSensorStats();
this.buildPanelSensorEntities();
}
});
// Add tray icon
let icon_path = this._settings.get_string('default-panel-icon');
// Make sure the path is valid
icon_path = icon_path.startsWith("/") ? icon_path : "/" + icon_path;
let icon = new St.Icon({
gicon : Gio.icon_new_for_string( Me.dir.get_path() + icon_path),
style_class : 'system-status-icon',
});
this.add_child(icon);
this.needsRebuild();
this.rebuildTray();
// Build the temperature/humidity sensor statistics (if needed)
this.buildTempSensorStats();
You can create a widget and add it to Main.layoutManager.uiGroup
, then place it one the screen appropriately:
let label = new St.Label({ text: 'Tooltip' });
Main.layoutManager.uiGroup.add_child(label);
Main.layoutManager.uiGroup.set_child_above_sibling(label, null);
let [x, y] = someParentActor.get_transformed_position();
label.set_position(x, y);
Generally I’d avoid tooltips, since they aren’t very accessible and there’s other UX concerns, but that’s more or less how you would do it.
brenard
(Benjamin Renard)
July 13, 2023, 8:17am
4
Thanks @andyholmes ! It’s works great !
1 Like
system
(system)
Closed
August 27, 2023, 8:17am
5
This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.