Add to menu and launch bar on a pi

How to make them do what you want, not to rant on about. Slashdot is better for rants anyway.

Add to menu and launch bar on a pi

Postby Doug Coulter » Sat Apr 04, 2015 6:23 pm

This works for both model 1 and 2 pi's with the latest distro (and probably all of them, but this is what I've tested with).

I had an "issue" - I wanted screenshots from the pi. Well, there's a nice app for that - Scrot. But it's a command line app - only. It has a nice feature that will delay awhile so you can hide the terminal you have to have to run it, but...hey, that's not stylin'.

So I embarked on how to get it on a menu and on the launch bar. I did some googling (most of what's out there is nearly right...don't install alacarte whatever you do, though - it adds tons of cruft you can't even run on a pi and it's hard to clean up after).
It turns out most of what I found was more or less right, but no warnings about some things - for example, how picky desktop files can be about typos etc.

So, here's the skinny - this should work for any program whatever that you can run, just change the names to match.

First, you have to make a desktop file - somename.desktop
This has to have that .desktop extension and it has to be really right - it's picky as heck about syntax, one typo and you're dead.
Mine looks like this, and is named ScreenShot.desktop: (but when hovering over the thing, it shows "Scrot")

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Scrot
Comment=Take Screenshot
Icon=/usr/share/pixmaps/Cam.png
Exec=/usr/bin/scrot -d 1
Terminal=false
Categories=Preferences;Graphics;

Yes, there is a blank line at the end...
It should be obvious that you'll need an icon. It should be 32x32, png. For mine, I used the pi camera to take a picture of....my normal camera, then did some work in "the gimp" to shrink it, make the contrast more and so on so it would look tolerable at that tiny size (and it's ok for me, but it you blow it back up, it looks terrible). And oh yeah, that icon should be where I put mine - /usr/pixmaps/somename.png.
The rest of the desktop stuff I hope is self-explanatory (else you probably shouldn't attempt this). If you look into other desktop files, they get long if you have translations for every locale and language, but I didn't bother. This is almost as short as one can be. It's a good idea to use the full path to the executable in the .desktop file fwiw - things might not be set up all the way when this is looked at.

Now, to get this sucker on the taskbar (I liked mine on the left) I put it in the file: in: /home/pi/.config/lxpanel/LXDE-pi/panels/panel near the end. Note this is a hidden directory and yes, there are more than one sub dirs with various similar names - and they don't work for a pi.

I added this:

Button {
id=/usr/share/applications/ScreenShot.desktop
}
Near the end of the file, before the part that shows running programs and the clock and stuff on the right. It looks like this:

PanelsFile.png
Screenshot taken with this very thing...heh, ain't bootstrapping cool?
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Return to Operating systems

Who is online

Users browsing this forum: No registered users and 2 guests

cron