Q:

How do I display username on the GNOME menu bar on Ubuntu 19.10?

In Ubuntu 19.10 and the GNOME Shell version 3.34.3, I want my username to be shown on the top right corner. I tried the following GNOME Shell extensions but nothing changed.

Simple Name
Add Username to Top Panel

Please let me know if you've any solution.

A:

Workaround
This Extension should work even in Ubuntu 19.10 which uses Gnome Shell Version 3.34.X https://extensions.gnome.org/extension/1108/add-username-to-top-panel/
I have tested it. However I have made a script, taken source from above link..

open gedit.
copy paste below content and save the file in your home directory with name username.sh

Content:
#!/bin/bash

file1=$HOME/.local/share/gnome-shell/extensions/add-username-toppanel@brendaw.com/extension.js
file2=$HOME/.local/share/gnome-shell/extensions/add-username-toppanel@brendaw.com/metadata.json
file3=$HOME/.local/share/gnome-shell/extensions/add-username-toppanel@brendaw.com/stylesheet.css

install -Dv /dev/null $file1
install -Dv /dev/null $file2
install -Dv /dev/null $file3

echo 'const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Main = imports.ui.main;
const GLib = imports.gi.GLib;

let label;
let aggregateMenu;
let children;

function init() {
  label = new St.Label({ text: GLib.get_real_name(), y_align: Clutter.ActorAlign.CENTER, style_class: "username-label" });
  aggregateMenu = Main.panel.statusArea["aggregateMenu"];
  powerIndicator = aggregateMenu._power.indicators;
}

function enable() {
  powerIndicator.add_child(label);
}

function disable() {
  powerIndicator.remove_child(label);
}
' >> $file1

echo '{
"name": "Add Username to Top Panel",
"description": "Simply add your username to topbar panel aggregate menu",
"uuid": "add-username-toppanel@brendaw.com",
"shell-version": ["3.34"]
}' >> $file2

echo ".username-label {
  margin-left: 7px;
  margin-right: 5px;
  vertical-align: middle;
}" >> $file3

gnome-extensions enable add-username-toppanel@brendaw.com

Open terminal and run the below

Command:
/bin/bash $HOME/username.sh

Refresh the gnome-shell with "Alt+F2 'r' Enter" Method.

When you want to delete the extension, run the below
Command:
rm -r $HOME/.local/share/gnome-shell/extensions/add-username-toppanel@brendaw.com

and refresh the gnome-shell with "Alt+F2 'r' Enter" Method

