Raspberry Pi: Adding a PIXEL Desktop Launcher

The Raspberry Pi’s Raspbian PIXEL Desktop UI (not to be confused with the Google Pixel phone) descends from LXDE, with all the advantages & disadvantages that entails. One nuisance seems to be the inability to create a launcher for a non-standard program.

The stock task bar (or whatever it’s called) has a few useful launchers and you can add a launcher for a program installed through the usual Add/Remove Software function, as shown by the VLC icon:

LXDE launcher icons
LXDE launcher icons

Adding a bCNC launcher requires a bit of legerdemain, because it’s not found in the RPi repositories. Instead, install bCNC according to its directions:

… install various pre-requisites as needed …
pip2 install --upgrade git+https://github.com/vlachoudis/bCNC 

Which is also how you upgrade to the latest & greatest version, as needed.

You then launch bCNC from inside a terminal:

python2 -m bCNC

The installation includes all the bits & pieces required to create a launcher; they’re just not in the right places.

So put them there:

sudo cp ./.local/lib/python2.7/site-packages/bCNC/bCNC.png /usr/share/icons/
sudo cp .local/lib/python2.7/site-packages/bCNC/bCNC.desktop /usr/share/applications/bCNC.desktop

The bCNC.desktop file looks like this:

[Desktop Entry]
Version=1.0
Type=Application
Name=bCNC
Comment=bCNC Controller
Exec=bCNC
Icon=bCNC.png
Path=
Terminal=true
StartupNotify=false
Name[en_US]=bCNC

Set Terminal=false if you don’t want a separate terminal window and don’t care about any of the messages bCNC writes to the console during its execution. However, those messages may provide the only hint about happened as bCNC falls off the rails.

With all that in place, it turns out LXDE creates a user-specific panel configuration file only when you change the default system panel configuration. Add a VLC launcher to create the local ~/.config/lxpanel/LXDE-pi/panels/panel file.

With that ball rolled, then add the bCNC launcher:

nano .config/lxpanel/LXDE-pi/panels/panel
… add this stanza …
Plugin {
  type=launchbar
  Config {
    Button {
      id=bCNC.desktop
    }
  }
}

Log out, log back in again, and the bCNC icon should appear:

LXDE launcher icons - additions
LXDE launcher icons – additions

Click it and away you go:

bCNC - Running from LXDE Launcher
bCNC – Running from LXDE Launcher

At least you (and I) will start closer to the goal when something else changes …

4 thoughts on “Raspberry Pi: Adding a PIXEL Desktop Launcher

  1. It’s not called PIXEL any more. They stopped a couple of years ago.It’s now called “Raspbian with Desktop”: https://www.raspberrypi.org/downloads/raspbian/

    So bCNC is going to auto-EOL in about two hours since it hasn’t done the Python3 thing. Good to know.

    The right and portable way to get Desktop files to work is to use the xdg-desktop-icon. xdg-desktop-menu, xdg-icon-resource and xdg-mime commands. Unfortunately, I can never remember how to call these, so have to resort to grepping the Arduino install script which uses them extensively

    1. It does say “Welcome to Raspberry Pi Desktop” on the way up, so they came to their senses; all the clever names have been burned long ago. Everything I think I know is becoming more obsolete every year and, hey, it’s a whole New Year today!

      The bCNC doc says “most of it seems to work” with Python3, so the next time I fix a worn-out MicroSD card, maybe it’ll “almost completely” work. Figuring out what’s busted seems a task better suited to someone more familiar with the nuances.

      And, hey, as far as xdg-whatever goes, I’ll try to remember to remember to try those the next time around. Perhaps, by then, the Python3-compatible bCNC installation will automagically handle such details?

      Thanks for the tip …

      1. My package updater is annoyed that I have pyserial for Python 2.7 as well as one for P-3.

        I’ve run into a couple of packages that insist on Python 3, though I don’t recall which.

Comments are closed.