Gnome Shell Extension – Add Hostname to Username

This is a fairly simple extension.  It adds the hostname to your username in the top right corner of the gnome 3 panel.

before

after

Download Extension

 extension.js:

const GLib = imports.gi.GLib;
try {
 userMenuName = imports.ui.main.panel.statusArea['userMenu']
 } catch(TypeError) {
 userMenuName = imports.ui.main.panel._statusArea['userMenu'];
 }
_hostName = GLib.get_host_name();
 _thisUserName = GLib.get_user_name();
 _originalName = userMenuName._name.text;
function init() {
 }
function enable() {
 userMenuName._name.text = _thisUserName + "@" + _hostName;
 }
function disable() {
 userMenuName._name.text = _originalName;
 }
This entry was posted in Ubuntu. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *