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 😦

How to upgrade to kernel 3.19 LTS Vivid kernel and xorg graphics for Ubuntu 14.04



Long-term Support for Ubuntu 14.04 also means that you can get the latest stable kernel and graphics as well.  Importantly, these remain supported by the kernel and graphics teams and you’ll receive a regular supply of updates for 9 months.

This article covers the following:

  • background with previously installing the utopic HWE
  • installing the vivid HWE with modified wiki instructions
  • fixing bcmwl wireless issues
  • cleaning up remaining utopic HWE obsolete packages

Background:

I did this previously to get the utopic hardware-enablement stack (HWE), so I was interested to tinker with the very latest supported HWE.

Remember – you’ll need to update just before 9 months to get the next LTS kernel and graphics before support is officially withdrawn.  If this sounds like too much hassle – best stick with the 3.13 kernel and graphics – they remain supported for 5 years!


Installing the vivid HWE:

The community wiki page describes how to install the latest kernel and graphics – but you need to be very careful.

The wiki page stated that to upgrade the kernel and graphics you use the following (sub utopic with vivid):

sudo apt-get install --install-recommends linux-generic-lts-vivid xserver-xorg-lts-vivid libgl1-mesa-glx-lts-vivid

Remember the magic “-s” parameter; with “-s” added you can simulate what would happen when you run an install command – for me, it revealed that there was a nasty conflict message.


sudo apt-get install -s --install-recommends linux-generic-lts-vivid xserver-xorg-lts-vivid libgl1-mesa-glx-lts-vivid
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:


The following packages have unmet dependencies.
libgl1-mesa-glx-lts-vivid : Depends: libglapi-mesa-lts-vivid (= 10.5.2-0ubuntu1~trusty1) but it is not going to be installed
xserver-xorg-lts-vivid : Recommends: libegl1-mesa-drivers-lts-vivid but it is not installable
Recommends: libgles2-mesa-lts-vivid but it is not going to be installed
Recommends: libgles1-mesa-lts-vivid but it is not going to be installed
Conflicts: libglapi-mesa (>= 0~)
Conflicts: libgles2-mesa (>= 0~)
E: Unable to correct problems, you have held broken packages.

I fixed this with adding libglapi-mesa-lts-vivid.

sudo apt-get -s install --install-recommends linux-generic-lts-vivid xserver-xorg-lts-vivid libgl1-mesa-glx-lts-vivid libglapi-mesa-lts-vivid | more

N.B. press q to exit the paused display

I checked very closely the packages to be removed. I was happy to see all the utopic xserver packages being removed… however I noticed amongst the packages it would have removed were vital wine packages.

Instead I preserved my wine installation through this simulated command:

sudo apt-get -s install --install-recommends linux-generic-lts-vivid xserver-xorg-lts-vivid libgl1-mesa-glx-lts-vivid libglapi-mesa-lts-vivid libgl1-mesa-glx-lts-vivid:i386 libglapi-mesa-lts-vivid:i386 | more

Try the above and examine which packages would be removed.

Once you are happy – go ahead and remove the “-s” after the apt-get.


Fixing bcmwl wireless issues:

I mentioned in my previous article that upgrading to the utopic HWE my bcmwl wireless could have been left in a broken state because the bcmwl package had not yet been backported; since that report there has been no movement with this bug so I can assume bcmwl wireless would remain broken for anyone upgrading to vivid HWE from stock 14.04.2 kernel and graphics.

Indeed – after installing the vivid HWE above I saw the following:


Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-23-generic /boot/vmlinuz-3.19.0-23-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.19.0-23-generic /boot/vmlinuz-3.19.0-23-generic
Error! Could not locate dkms.conf file.
File: does not exist.
Error! Bad return status for module build on kernel: 3.19.0-23-generic (x86_64)
Consult /var/lib/dkms/bcmwl/6.30.223.248+bdcom/build/make.log for more information.

So BEFORE I rebooted, I downloaded the wily (15.10) bcmwl package ready to install after rebooting.

wget http://mirrors.kernel.org/ubuntu/pool/restricted/b/bcmwl/bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu2_amd64.deb

If you are still using 32bit then the equivalent package for you is:

http://mirrors.kernel.org/ubuntu/pool/restricted/b/bcmwl/bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu2_i386.deb

After rebooting I installed the new wily deb with:

sudo dpkg -i bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu2_amd64.deb

Wireless sprang back into life and all is well.


 

Cleaning up:

Since I previously installed the utopic HWE I’m no longer interested in receiving future kernel updates for this LTS kernel. Thus, to do this remove the utopic kernel metapackage:

sudo apt-get purge linux-generic-lts-utopic

If necessary also remove the following packages:

sudo apt-get purge linux-lts-utopic-tools*

Then remove any obsolete packages

sudo apt-get autoremove

controlling rhythmbox using your android phone


bansheeremoteControlling Rhythmbox via a web-browser is not new.  Indeed, I’ve done this before via rhythmweb.  However I wanted to use my phone as a remote-control…

I thought it was a bit sad to allow rhythmbox-android-remote to suffer from bitrot – so I’ve forked it, converted it to python3 and fixed up some issues with the original source.

My new version of rhythmbox-android-remote is a backend tcp based server for the banshee remote app available through the android playstore.

It allows you to play, pause, forward/reverse, shuffle and repeat tracks.  It displays any coverart you have in your rhythmbox collection.  It also allows you to browse & play by album/track artist and tracks titles as well.  Just hit your phone’s settings button and touch the “sync” icon.

It is GPL-3 open-source based. So feel free to fork and make changes. Banshee-remote is similarly GPL-3 open-source.  So if you are wanting to dip your toes into android programming – grab the source here

Heck – if you want – I am most definitely willing to help with the rhythmbox side of things – I would love add functionality such as to control rhythmbox’s volume and also to “play all” tracks for an album.

So fork banshee-remote – call it something else, work with me to make the rhythmbox changes and publish to android’s playstore.

Installing:

cd ~/.local/share/rhythmbox/plugins
git clone https://github.com/fossfreedom/rhythmbox-android-remote

Activate “rhythmbox-android remote” in the plugins window

Alternatively, install the “rhythmbox-plugin-android-remote” package from my rhythmbox PPA

sudo add-apt-repository ppa:fossfreedom/rhythmbox-plugins
sudo apt-get update
sudo apt-get install rhythmbox-plugin-android-remote