9

I want to add some text to the GNOME panel in GNOME Classic.

I got a suggestion from this blog but it dates back to 2008 and doesn't seem applicable now.

In Ubuntu 12.10 and GNOME classic, the option of /apps/panel/applets/clock_screen0/prefs/custom_format in gconf-editor is missing.

So is there any way I can add custom text to the clock in GNOME classic?

Also is there any other applet/extension available which allows us to add a text to the GNOME panel?

6
  • Those instructions no longer work in 12.10 as it uses Gnome 3.5/3.6. You can change how the clock displays the time from the Gnome Control Center>Clock. Feb 21, 2013 at 9:21
  • But the clock stetting under Gnome Control center does not allows me to add some custom text.
    – Shambo
    Feb 21, 2013 at 9:41
  • No that only changes the format of the clock as per your question: So is there any way I can change the format of the clock in gnome classic?. You can try with Gnome Shell, use extensions to make it look like the Classic session and find one extension that changes the Clock though that seems too much for just the text in the clock. Feb 21, 2013 at 9:48
  • That blog linked to a Ubuntu Forums thread which in turn linked to an external image that doesn't seem available anymore. So what exactly do you want? I have a digital clock set up like this: Thu 21 Feb 03 : 41. Is it correct that you want to add some text before Thu or after 41 (in this example)?
    – user25656
    Feb 21, 2013 at 10:13
  • @vasa1 There is custom text next to the clock it says tango, that's what the OP wants though I'm most certain that it can't be done. Feb 21, 2013 at 10:25

3 Answers 3

11

Simple Gnome extension may be worth to try. (I'm not sure about naming, in Ubuntu 14.04: Gnome classic uses same Gnome shell extensions, Where old classic renamed to Gnome Fallback)


Gnome Classic & Mate

  1. Download panel-applet-generator
  2. Generate a new applet:

    python panel-applet-generator.py -n mylabel -d "my custom label"
    
  3. Modify mylabelApplet.py

    try:
        from gi.repository import Gtk
    except: # Can't use ImportError, as gi.repository isn't quite that nice...
        import gtk as Gtk
    
    def applet_factory(applet, iid, data = None):
        button = Gtk.Button("It works!")
        label = Gtk.Label("It works!")
        applet.add(label)
        applet.show_all()
        return True
    

    I added label = Gtk.Label("It works!") and modified applet.add(label) (It was applet.add(button))

  4. Compress mylabel folder as tar.gz then rename it to mylabel_1.0.orig.tar.gz

  5. Build Debian package

    cd mylabel/
    debuild -us -uc
    
  6. Install package

    sudo dpkg -i ../*.deb
    
  7. Alt+Right Click or Super+Alt+Right Click on panel, then add to panel

  8. Look for mylabel applet, then add

enter image description here

References:

Note:

  • If for any reason unable to install, It is possible to do it manually:

    sudo cp org.gnome.applets.mylabel.panel-applet /usr/share/gnome-panel/4.0/applets/
    sudo cp org.gnome.panel.applet.mylabel.service /usr/share/dbus-1/services/
    sudo cp *.py /usr/lib/gnome-applets/
    

    32bit system:

    sudo cp mylabel.server /usr/lib/bonobo/servers/ 
    

    64bit system:

    sudo cp mylabel.server /usr/lib/x86_64-linux-gnu/bonobo/servers/
    

Gnome Shell

I have tested it with Gnome 3.10:

  1. Install Gnome tweak tool

    sudo apt-get install gnome-tweak-tool
    
  2. Create new extension:

    gnome-shell-extension-tool --create-extension
    
  3. Enter requested info: name My Label, description Extension shows my custom text, uuid mylabel@yourname or leave as default mylabel@hostname

    Extension created in /home/username/.local/share/gnome-shell/extensions/mylabel@hostname

  4. extension.js is auto opened. Replace Icon with your custom label. As below:

    function init() {
        button = new St.Bin({ style_class: 'panel-button',
                              reactive: true,
                              can_focus: true,
                              x_fill: true,
                              y_fill: false,
                              track_hover: true });
        let icon = new St.Icon({ icon_name: 'system-run-symbolic',
                                 style_class: 'system-status-icon' });
    
        let label = new St.Label({ text: "Hello, world!" });
        button.set_child(label);
        button.connect('button-press-event', _showHello);
    }
    

    I added let label = new St.Label({ text: "Hello, world!" }); and modified 'button.set_child(label); (It was button.set_child(icon);)

  5. Save, Restart Gnome-Shell using Alt+F2, enter r then Enter

  6. Launch Gnome Tweak Tool → Extensions → Enable My Label extension.

  7. Restart Gnome-Shell again.

    enter image description here

References:

6
  • 1
    Great Solution!! I have been looking for something like this. But unfortunately I could not install it in my Gnome Classic. So I was wondering if you have any solution for creating such "Hello World" applet in Gnome Classic.
    – Shambo
    Mar 13, 2014 at 23:33
  • 1
    I would like ask you to add your Gnome Classic version to the question, just to confirm. I may give it a try later. I couldn't give you any promise.
    – user.dz
    Mar 14, 2014 at 10:53
  • 1
    Great work, and effort. Thanks. Really a life saver when I am compulsively using the internet.
    – Shambo
    Mar 16, 2014 at 7:15
  • There is interest in this for version 18.04 but reportedly doesn't work here: Is there a way to show external IP in top bar using GNOME 3.28.2 in Ubuntu 18.04 Dec 28, 2019 at 22:18
  • 1
    @user.dz If I had a dollar for every Gnome Shell & Wayland complaint I'd be a millionaire. I've used Unity / Xorg throughout 14.04, 16.04, 18.04 and 19.04 so all my time consuming written works still work. I'll probably do the same in 20.04 because I'm not a big fan of reinventing the wheel. I do hope Canonical does take new developments in Gnome world and port them to Unity though... Dec 28, 2019 at 23:00
0

on 20.04, there is this working extension that can use dbus to set the text:
https://extensions.gnome.org/extension/2826/generic-monitor/?c=78316

and here the readme:
http://indefero.soutade.fr/p/genericmonitor/source/tree/master/README.md
and this is what I use (a 1min loop), as I can't find another way to cfg datetime the way I want:

while true;do
  strDate="`date +"%A, %Hh%Mm - %d %B (%m/%Y)"`";
  gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.notify \
    '{"group":"new","items":[{"name":"first","text":"'"$strDate"'","style":"color:white"}]}'
  sleep 60
done
0

If anyone's (still) looking for it, here's a much easier solution. A gnome extension called One Thing (named after a similar app for Mac)

https://extensions.gnome.org/extension/5072/one-thing/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .