Mike MacDonagh's Blog

Somewhere in the overlap between software development, process improvement and psychology

Tag Archives: ubuntu

Can’t open links in Firefox on Ubuntu when it’s open – Fixed!

This is a little obscure but there’s a number of people with this problem and too many “simple” answers that just don’t work. There are a number of situations that cause Firefox to respond with an error message when you click on a link from outside of the browser (like Thunderbird or any other application that try to launch a url). You get an error message saying:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system

The normal reasons for this are things like locked profiles etc. which are well covered here. But some users get this error message even when Firefox is open and there aren’t locked profiles 😦 The solution is to edit the way that Ubuntu invokes Firefox.

Grab a terminal and go to ~/.local/share/applications this is Unity stores it’s information for launchers in the unity dock thingy. You should have a Firefox.desktop in here, you might have several in which case the one called “Firefox Web Browser.desktop” is probably the one that Ubuntu is using by default.

Edit the file and have a look at the “Exec=” line about 4 lines down. In my case the problem was caused because this line was referring to an old profile that I’d previously removed trying to fix the problem. If you’re not sure what it should look like set it to “Exec=firefox %u“, save, exit and click links once more 🙂

Woooo Ubuntu Running On Android looks cool

Install single window Lazarus 0.9.30 in Ubuntu 11.10 step by step

I’ve previously blogged on installing lazarus on ubuntu but unfortunately upgrading to ubuntu 11.10 broke my lazarus installation 😦 Here’s how I fixed it all.

1. Totally remove previous Lazarus and fpc installations

sudo apt-get purge lazarus*
sudo apt-get purge fpc*
sudo rm -Rf /usr/lib/fpc
sudo rm -Rf /usr/lib/lazarus
sudo rm -Rf /usr/share/fpcsrc
sudo rm -f ~/.fpc
sudo rm -Rf ~/.lazarus
sudo rm -f /usr/bin/lazarus*
sudo rm -f /usr/bin/lazres*
sudo rm -f /usr/bin/lazbuild*
sudo rm -f ~/.local/share/applications/lazarus*

2. Install fpc so you can use it from the command line

sudo apt-get install fp-compiler-2.4.4

You can see if this has worked properly by writing a hello world command line app, comiling it and running it before you’ve even tried to install lazarus. Save the following in a file called cmdline_helloworld.pas:

begin

writeln('hello world!');

end.

Then compile using

fpc cmdline_helloworld.pas

and run using:

./cmdline_helloworld

Free Pascal Compiler use on the command line

3. Install lazarus

sudo apt-get install lazarus

You probably need to disable overlay scrollbars otherwise you can get problems using menus and dialogs in Lazarus and apps made with lazarus:

export LIBOVERLAY_SCROLLBAR=0

if you don’t want to make such a global change then just make a script to start lazarus like this:

#!/bin/sh
LIBOVERLAY_SCROLLBAR=0 lazarus-ide

4. Change IDE settings to make it easier to use with Unity

Unity is annoying for many reasons, but it doesn’t deal with multi-window apps like Lazarus very well. So here’s some suggestions to make it all behave a bit better.

First, if you use a taskbar plugin like tint you can have Lazarus only show one button rather than loads on the task bar (Environment -> Options -> Window and slect “Show single button in Taskbar” at the top.

Second, I recommend making lazarus use single window mode. This is a little experimental but I think it’s a major improvement over the old-fashioned pre-Delphi 2005 layout.

Normal layout:

Normal multi-window interface for Lazarus

To transform Lazarus into a single window mode application you need to install the AnchorDockingDsgn package which is helpfully installed with Lazarus. On ubuntu in a standard installation it’ll be in /usr/lib/lazarus/0.9.30/examples/anchordocking/design.

Do this as sudo otherwise the recompiling process doesn’t have enough rights to backup packages and wotnot. So start lazarus by doing

sudo lazarus-ide

In Lazarus File -> Open and browse to anchordockingdsgn.lpk

When the package editor comes up select the install button. Lazarus will ask for confirmation and tell you only static packages are supported so you need to rebuild lazarus (that really needs sorting out!), say yes and then sit back and enjoy the compilation process.

Next time you start Lazarus it’ll be in single window mode. For some reason the Object Inspector (F11) isn’t docked by default but you can easily add it yourself.

Lazarus as a single window IDE

Ubuntu 11 Unity: Making it useable with application menus and taskbars

Application Menu

Call me old fashioned, it’s probably true but I can’t get going with unity. Where’s the app menu? I need it! Ok I can just press the “Super” (windows key) and type for whatever I want, and accessing my most popular apps is easy enough but what about the thing I use to edit music meta data, can’t remember it’s name right now….  Or the thing that grabs stuff from the internet and adds it to my build logs, what category is that in again… And what did I download and install from the uber duper super software centre that I thought looked cool…

All these questions and more are normally answered by the Application Menu. I need it back! After upgrading to Ubuntu 11 I got so frustrated with Unity I decided to install Gnome 3 to bring it back, but some evil Unity conspirators have infiltrated the Gnome developer team and persuaded them to kill the app menu too. It’s time to fight back against this conspiracy that’s trying to turn our desktops into smart phones. To do that, just install classicmenu-indicator from Florian Diesch

sudo add-apt-repository ppa:diesch/testing

sudo apt-get update

sudo apt-get install classicmenu-indicator

Once installed, run it: Alt-F2 type classicmenu-indicator and you’re good to go 🙂

 

Taskbar(s)

Again I know that there’s ways of clicking on what’s running from the Unity dock, but for me it’s not very reliable in terms of popping up. In fact the Gnome3 dock is better, it kind of pings out of the top corner but both Unity and Gnome 3 have done away with taskbars for the current running windows. I use a lot of windows when I’m doing stuff, split between multiple workspaces and I just want a simple bunch of buttons to make life simple for me. Thankfully the same solution works for both Unity and Gnome3 and magically supports multiple monitors beautifully: tint2

sudo apt-get install tint2

You’ll also need to get it to auto-run which you can do by running

gnome-session-properties

and adding /usr/bin/tint2 as an startup application, then you’ll need to log out/log in for it to run up 🙂

For me adding these bits are enough to make Unity usable 🙂

Behringer iAxe + JACK + rakarrack = awesomeness

I like to play guitar. Not very well, but I enjoy playing. A while ago I added to my collection a Behringer iAxe which is basically a normal electric guitar with a USB port.  It came with a CD of impossible to setup properly and use Windows software for sound effects. Since moving to Ubuntu I’ve been wondering how I’d be able to still play with it but last weekend I decided to try and search.

1 google search, 1 ubuntu software centre search, no reading of instructions and 20 mins later and I had achieved marvellous noise! I installed QJackCtl which starts and stops the realtime audio driver and also lets you map the input to virtual amps and then speakers (without having to read instructions, it mostly worked out what to do for itself) and then rakarrack which is like a big virtual guitar effects board. Then I just plugged in my guitar and make all sorts of horrible noises 😀

It all just worked and best of all it’s all free – well except for the guitar!

I finally managed to install lazarus 0.9.30 and fpc 2.4.2 on Ubuntu

[Update: this post was from May 2011 for Ubuntu 10, for Ubuntu 11 see here]

I tried updating apt sources with “deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe” but got an error:

Failed to fetch http://www.hu.freepascal.org/lazarus/dists/lazarus-stable/Release  Unable to find expected entry ‘universe/source/Sources’ in Release file (Wrong sources.list entry or malformed file)

I tried checking out the daily source from SVN but couldn’t work out how to make it all build properly. I tried the daily downloads of deb packages but got an error on starting that said “LCLBase 1.0” – “Unit not found: RegisterLCL” error.

I tried downloading various archives full of stuff and either making, installing debs or whatever with a variety of problems. Often there were broken package dependencies around e(.g. “package lcl-units-0.9.30 is not installed”).

Finally I found a way that worked over the weekend so I thought I’d share it for others having these difficulties. First if you’ve got a corrupt/broken installation or an old version installed it’s a good idea to get rid of it. I did this by doing:

1. Delete any existing FPC and Lazarus stuff, conflicts between versions are the source of many of the problems!

sudo apt-get purge fpc lazarus*
sudo rm -Rf /usr/lib/fpc
sudo rm -Rf /usr/lib/lazarus
sudo rm -Rf /usr/share/fpcsrc
sudo rm -f ~/.fpc
sudo rm -Rf ~/.lazarus

2.  Download and extract the fpc packages (although at time of writing the ones packaged with ubuntu 11.10 are good enough – 22/10/11) and the latest lazarus packages. This ends up with two folders full or .deb files. Going into the fpc one first, then the lazarus one and entering:

sudo dpkg -i *

Installs FPC and then Lazarus.

3. Finally run Lazarus from your main menu, weird unity thingy or whatever you use 😀

%d bloggers like this: