Writing Python Applets for the budgie-desktop


Well here is my first budgie-desktop applet:

ubuntu xenial [Running] - Oracle VM VirtualBox : 1_027

Seen this before?  Well yes – this is the Indicator SysMonitor app-indicator which has been updated to support budgie-desktop.

In-fact … it works much better under budgie because you don’t have to fiddle with applet ordering to stop applets jumping around with the SysMonitor label values grow/shrink in size. Just use Raven to order the applet correctly.

This is just a workout – to see what changes I need to do to get an existing python based app-indicator to natively work under budgie-desktop.

The changes were remarkably small.

Lets dive in.

First grab the source-code and install

sudo apt-get install python3-psutil curl git
mkdir -p ~/.local/share/budgie-desktop/modules
cd ~/.local/share/budgie-desktop/modules
git clone https://github.com/fossfreedom/indicator-sysmonitor.git budgiesysmonitor
nohup budgie-panel --replace &

Then use Raven to add the “Panel Sys Monitor” applet


Ok – so what did I do to convert the existing app-indicator to work under budgie?

All local installed applets need to be installed into a subfolder of ~/.local/share/budgie-desktop/modules.  An applet basically consists of two key files – “.plugin” which is the control file containing the description & Icon you see in Raven together with the name of the python module where budgie & Peas (the library that does all the clever stuff for the display of the applet) has the entry point to “run with”.

TIP: make the module name in the .plugin name the same as the folder name – its case-sensitive.  So in this case the python module is “budgiesysmonitor.py” – so the module name is “budgiesysmonitor” and the folder name containing all the source is also “budgiesysmonitor”

TIP: make the .plugin filename the same as the Class entry point in budgiesysmonitor – so the filename is “BudgieSysMonitor.plugin” and the class entrypoint is “class BudgieSysMonitor(GObject.GObject, Budgie.Plugin):

First comment out/delete the AppIndicator specifics – the gi.repository import AppIndicator statement etc.

Replace a line like “appindicator.Indicator.new(…)” with a Gtk container equivalent such as a button e.g. “button = Gtk.Button.new()

Connect the signals that updates the Button Icon and/or label – for this applet sysmonitor just changes the label – there is no icon to display.

Add a test application wrapper :

# testing
win = Gtk.Window()

...
# setup an instance with config
win.add( button )
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

Run your new python app and make sure it works as you expect – click stuff, menu’s, display etc.

Then when you are happy, comment out the test app portion and just top and tail with the Applet specifics for Budgie i.e. the correct import:

import gi
gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject

The magic is this bit – two classes – the Peas entry point “BudgieSysMonitor” and the Panel Applet – our button is created here:

class BudgieSysMonitor(GObject.Object, Budgie.Plugin):
    """ This is simply an entry point into the SysMonitor applet
    Note you must always override Object, and implement Plugin.
    """

    # Good manners, make sure we have unique name in GObject type system
    __gtype_name__ = "BudgieSysMonitor"

    def __init__(self):
        """ Initialisation is important.
        """
        GObject.Object.__init__(self)

    def do_get_panel_widget(self, uuid):
        """ This is where the real fun happens. Return a new Budgie.Applet
        instance with the given UUID. The UUID is determined by the
        BudgiePanelManager, and is used for lifetime tracking.
        """
        return BudgieSysMonitorApplet(uuid)

class BudgieSysMonitorApplet(Budgie.Applet):
    """ Budgie.Applet is in fact a Gtk.Bin """

    button = None

    def __init__(self, uuid):
        Budgie.Applet.__init__(self)

        # Add a button to our UI
        self.button = Gtk.Button.new()
        self.button.set_relief(Gtk.ReliefStyle.NONE)
        self.add(self.button)
        self.show_all()

Test your new applet – you’ll need to shout at budgie-panel to make it recognise your new applet:

budgie-panel --replace &

See – easy!

P.S. before you complain – yes I should be using a Popover to display the menu when clicking the applet but that’s for another day.

Source – Ikey’s plugin examples – for C and Vala hackers there are similar example plugins in the linked github repo

 

budgie-remix … the apps


Choosing the default applications for a distro is contentious – you can never please everyone.  Fortunately with Ubuntu as its base – you can change/add/delete anything with ease.

For those testing an installed version of tech-preview beta 2 (keep updating!)  these are the current default applications budgie-remix probably (emphasis on probably) ship with.  Let me know your thoughts.

This slideshow requires JavaScript.

Themes:

By default budgie-remix ships with Arc-Theme from Horst3180 – this includes firefox styled with Arc theme .  Also available is Horst3180 Vertex Theme which is equally impressive with the budgie-desktop

Accessories:

  • Files (Nautilus) is shipping with v3.18 not v3.14 as in base Ubuntu.  This is combined with GNOME Sushi – nice piece of software to view the contents of what you have highlighted – just press the Space bar
  • GNOME calculator
  • Gnote – note taking software EDIT: GNote has removed system tray capabilities so does not integrate with budgie-desktop
  • Main Menu (Alacarte EDIT: MenuLibre) – allows customisation of the menu
  • GNOME Photos
  • Gedit Text Editor
  • EDITL GNOME Calendar

Games:

  • Solitaire
  • Mahjongg
  • Mines
  • Sudoku

Installing the package gnome-games has two dozen games to choose from – the chosen four are those that Ubuntu has selected as the default.

Graphics:

  • Simple Scan
  • EDIT: GThumb image viewer

Internet:

  • Chromium Webbrowser EDIT: Now removed
  • Firefox Web-browser customised with the Arc Darker firefox theme
  • Transmission BitTorrent client

Not decided yet (but leaning toward firefox) on the default browser … ship with both?

Office:

  • Libreoffice with sifr as the default toolbar style

Sound & Video:

  • Rhythmbox customised with Alternative Toolbar and Tray-icon for controlling via the panel
  • Video Player (Totem)

Sundry:

  • Orca Screen Reader
  • Power Statistics

System Tools:

  • GNOME Control Centre Settings
  • GNOME Software Centre

Administration:

  • Ubuntu Software Updater

Preferences:

  • Startup Applications
  • Additional Drivers
  • GNOME Disks
  • GNOME Online Accounts

Utilities:

  • Archive Manager (file-roller)
  • Evince PDF Document Viewer
  • Image Viewer (eog)
  • GNOME Screenshot
  • GNOME Terminal

EDIT: TLP is included by default – this will enhance the battery life for laptop uses.

EDIT:… and xfdashboard is available as an optional install (sudo apt install budgie-xfdashboard) – press CTRL+TAB – this gives a gnome-shell like dashboard

ubuntu budgie [Running] - Oracle VM VirtualBox_139

displaying the appmenu in budgie


Quick tip for budgie-desktop PPA users who maybe wondering where GNOME based apps display their AppMenu.

Untitled7

There is a bug upstream with 10.2.4 of budgie-desktop that does not display the GNOME AppMenu for applications like Rhythmbox, Totem, Nautilus etc.

Until this is fixed correctly in the source, here is a quick terminal command to get those pesky AppMenus displaying again:

gsettings set  org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/ShellShowsAppMenu': <0>, 'Gtk/ShellShowsMenubar': <1>, 'Gtk/DecorationLayout': <'menu:minimize,maximize,close'>}"

 

I’ve tried to add an override file in /usr/share/glib-2.0/schemas but the override doesn’t appear to update for the user.  If anyone has a suggested fix please shout so I can include the fix within the PPA itself.

budgie-remix preview 2 is available


budgie-remix tech-preview 2 is now available for download to test, get feedback etc.

Please DO read the README.  This is labeled a tech-preview – it is not production ready and should not be installed if you want to use budgie in the long-term.

Next up will be beta 1 at the end of March – this will be production ready.

So what is different from tech-preview 1?

Well this has been correctly engineered – the previous effort was all hand-cranked.  Tech-preview 2  is all been debianized – built by launchpad and most importantly – can be reproducibly built for now and the long-term.

ubuntu budgie [Running] - Oracle VM VirtualBox_135

For this tech-preview budgie-remix is using lightdm as the login-manager.  The picture shows what budgie-remix could look like.

Help needed – we need a logo for the login box

The previous tech-preview could not  be installed.  Tech-preview 2 can be – please refer to the README on how you can do this.

ubuntu budgie [Running] - Oracle VM VirtualBox_136

On logging in by default the wallpaper is the same as the login screen:

Help-needed – we need public domain/ cc attribution licensed wallpaper (that allows distribution) – guidance (taken from Ubuntu Flickr):

We’re looking for photographic wallpapers: lovely backgrounds that greet the user on budgie-remix welcome screen and at login, and complements the arc-theme. Like Ubuntu call for action – We’re also looking for an illustrative wallpaper that plays off the theme “xenial xerus”.

* Images shouldn’t be too busy and filled with too many shapes and colors, a similar tone throughout is a good rule of thumb.
* A single point of focus, a single area that draws the eye into the image, can also help you avoid something too cluttered.
* Try your image at different aspect ratios to make sure something important isn’t cropped out on smaller/ larger screens at different resolutions.
* Take a look at the wallpapers guidance on the Ubuntu Wiki regarding the size of images. Our target resolution is 3840 x 2400.

Break all the rules except the resolution one! 😀

Network Monitor applet now appears correctly:

ubuntu budgie [Running] - Oracle VM VirtualBox_138

As this is a tech-preview budgie-remix has included with the live cd the gnome-shell like dashboard xfdashboard

ubuntu budgie [Running] - Oracle VM VirtualBox_139

You can see all your apps running very easily…

ubuntu budgie [Running] - Oracle VM VirtualBox_140

… and you can switch between workspaces simply – dragging apps from the main pane to the workspace as well.

Help-needed: Somone who can help out integrating xfdashboard i.e. theme it, set the key-combination on first logon)

Look at the README how to hook this up to a keyboard combination e.g. CTRL+TAB.  If there is sufficient good feedback, budgie-remix will include this as default in the upcoming beta correctly integrated.

Plymouth is the default boot loader: Help needed – we need someone who can change “Ubuntu 16.04” to “budgie-remix 16.04”

Hidden in the background is printer support – hplip dependency has been added.

Help-needed: testing this

We also want feedback as to what other back-end software should be included out of the box

The next article will describe where the project is hiding on the interweb, how you can contribute.

random disappearing letters


If you are suffering from random letters dropping off your screen then a short post here on how to workaround this.

Screenshot from 2015-04-22 00:09:46

This particular annoyance occurs for me after a few minutes of boot up – especially if waking up from being suspended.

I’m using Intel graphics – vivid (15.04) HWE on Ubuntu 14.04.  This occurred also when I was using utopic (14.10) HWE.

sudo nano /etc/X11/xorg.conf

copy and paste (CTRL + INS) the following

Section "Device"
Identifier    "Intel Graphics"
Driver         "intel"
Option         "AccelMethod" "uxa"
EndSection

CTRL+X and answer yes to save and exit.  Finally reboot.

If this happens for you – click the “this affects me” option on this bug-report.

So what does this do? Well, it tells the Intel graphics driver not to use the default SNA code path but instead use the older UXA code-path. The older code-path is a kind of fall-back and isn’t as efficient as the newer SNA graphics.

To go back to the newer graphics either remove the xorg.conf file you created above – or just rename it followed by a reboot i.e.

sudo rm /etc/X11/xorg.conf

or

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

N.B. I’ve seen other suggested workarounds such as tweaking the DPI settings and antialiasing changes but these do not work for me 😦