Ubuntu – Is that possible to add icons to the login screen top-panel

gnome-paneliconspanel

Is that possible to add icons(other than defaults) to the login screen top-panel?

enter image description here

If yes then which applications icons will be added to the login screen top panel other than the defaults(onboard,sound,network-manager,etc).And how do i add that?

I am running Ubuntu 13.10

Best Answer

  • I'm on 12.04, but this will work on 13.10 also.

    Yes, it is possible to change the indicators for the unity-greeter. We could use GSettings to modify the settings, but because the unity-greeter is only run by the lightdm user, (so it's settings doesn't affect anyone else) it is easiest to just write a .override file.

    1. Check the default indicators

    You can see your default indicators in the dconf-editor or int the /usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.xml file. In the latter file you will see a key similar to this:

     <key name="indicators" type="as">
      <default>['ug-keyboard', 'ug-accessibility', 'session', 'datetime', 'power', 'soundmenu', 'application']</default>
      <summary>Which indicators to load</summary>
    </key>
    

    , those are the defaults for me. Check your's first.

    On 13.10 this key looks like this:

    <key name="indicators" type="as">
      <default>['ug-accessibility', 'com.canonical.indicator.keyboard', 'com.canonical.indicator.session', 'com.canonical.indicator.datetime', 'com.canonical.indicator.power', 'com.canonical.indicator.sound', 'application']</default>
      <summary>Which indicators to load</summary>
    </key>
    

    2 . Check the available indicators

    You can check your available indicators in the /usr/lib/indicators3/7/ directory, or in the /usr/share/unity/indicators/ directory.

    3. Write an override file

    Just write a file with similar contents and save it as /usr/share/glib-2.0/schemas/myoverride.gschema.override

    For 12.04

    [com.canonical.unity-greeter]
    indicators=['ug-keyboard', 'ug-accessibility', 'session', 'datetime', 'power', 'soundmenu', 'application', 'messaging']
    

    For 13.10

    [com.canonical.unity-greeter]
    indicators=['ug-accessibility', 'com.canonical.indicator.keyboard', 'com.canonical.indicator.session', 'com.canonical.indicator.datetime', 'com.canonical.indicator.power', 'com.canonical.indicator.sound', 'application', 'messages']
    

    In the 12.04 version I added the messaging indicator to the default list of 12.04. In the 13.10 version I added the messages indicator to the default listof 13.10. I simply added them to the default list shown in STEP 1, you can do that too, or remove some from the default indicators if you don't want them to show up on the login screen. (Watch out for the apostrophes.) IMPORTANT: On 12.04 you have to keep the 'ug-keyboard' and the 'session' indicator in the list, so DO NOT remove them if you have them in the default line, or lightdm will stuck in an endless loop. (like here )

    Naming conventions in the override file: For files in the /usr/lib/indicators3/7/ directory the filename's preceding "lib" and the ending ".so" are not important, so for a file named libmessaging.so we could use 'libmessaging.so', 'libmessaging' or 'messaging'. For the files in the /usr/share/unity/indicators/ directory the filename's preceding "com.canonical.indicator." is not important, so for the "com.canonical.indicator.bluetooth" file we could use 'com.canonical.indicator.bluetooth' or simply "bluetooth'.

    4. Backup (just in case)

    Make a backup of the /usr/share/glib-2.0/schemas/gschemas.compiled file.

    5. Compile

    After all this run

    sudo glib-compile-schemas /usr/share/glib-2.0/schemas
    

    6. Check the results

    After this try to logout and see if it worked. Or you can also do a test of the login-screen without logging out, if you try from a terminal:

    lightdm --test-mode
    

    or

    unity-greeter --test-mode 
    

    For me on 12.04 the messaging indicator worked, my printersmenu indicator doesn't. On 13.10 I tested with the messages indicator and it didn't show up, but neither produced erros, so I guessed that it is by design not showing up on the greeter-screen, because it is mostly useless there. So I checked the /usr/share/unity/indicators/com.canonical.indicator.messages file and it confirmed that it doesn't have a [desktop_greeter] section like e.g the session indicator has. So If you wan't the messages indicator (or another indicator without the [desktop_greeter] section) to show up on the login screen (even if it is mostly useless there), you will also have to edit its file in the /usr/share/unity/indicators/ directory, and make a copy of the [desktop] section in that file and rename the copy to [desktop_greeter] section. E.g for the messages indicator I ended up with this file for /usr/share/unity/indicators/com.canonical.indicator.messages:

    [Indicator Service]
    Name=indicator-messages
    ObjectPath=/com/canonical/indicator/messages
    Position=50
    
    [desktop]
    ObjectPath=/com/canonical/indicator/messages/desktop
    
    [phone]
    ObjectPath=/com/canonical/indicator/messages/phone
    
    [desktop_greeter]
    ObjectPath=/com/canonical/indicator/messages/desktop
    

    After doing this change in the file, the messages indicator did show up on the login screen for 13.10 also.

    If something goes bad and the login screen doesn't come up, just switch to a virtual console CTRL+ALT+F1 and restore your backup gschemas.compiled file. Or remove your myoverride.gschema.override file and run sudo glib-compile-schemas /usr/share/glib-2.0/schemas again. If the lighdtm stucks in an endless loop, and you can't switch to virtual console, just press the ALT+PrtSc+E magic key combo, this will kill lightdm and after this you can switch to the virtual console and do the repair.

    Which indicators can you use? I don't know, I have only the defaults, but I guess you can try out any which installs itself to those directories listed above. (Or you could write an own indicator as always.)

    Source for all of these? I looked into the code: link and link

  • Related Question