Hello everyone , I just finished an app that I've been developing for some time now , and I have a very specific problem , that I couldn't solve via googling . I made a launcher for my app , but Unity doesn't handle the app as expected . If I open one instance the app doesn't associate with its icon in the sidebar , and I if I click the icon again I don't focus the application , but get a new instance (whilst the first is still alive , but has no way to get focus except when I move all other windows out of the way) . Is it something allegro related (as in has anyone else experienced the problem) or is it more likely that I haven't made the launcher right ?

Its most-likely that Unity is trash. Ubuntu was great, but Unity introduces a whole can of regression. That said, post the script and I can take a look at it / try to replicate the error. These questions might not be relivent once you post the script / script example.1) Is it a bash-script? Or python, etc?2) Are you using Unity or Unity 2D, and could you post the version.3) How are you assigning the icon to the application? There are a couple of ways of doing this.4) Do you experience this same problem on other windowmanagers, such as xfce, gnome2, etc

When I start the app it has its own separate icon (well , with no icon) captioned "Untitled window" that can focus it's related instance . Are there any parameters of the display that I might have omitted to cause this behaviour (I didn't set a title , which I'll do to see if it causes the problem) .

Ah, well, '.Desktop scripts' are not my thing but I will try to help anyway. I don't think this has anything to do with allegro - its a Unity thing. Make sure its installed correctly.

My understanding is that Unity creates its own launcher, based on the .desktop file. I have no idea if there is a "proper" .desktop way to prevent multiple instances, but you could have your program check for instances at run-time - either every-time or only if a special parameter is passed. For example parse the parameters so if something like -one-instance is passed into main, terminate if another instance already is running. The your .desktop file would look like:

You should try pulling the icon directly from the application. Otherwise, you should use a vector icon, such as SVG. Icon will be an absolute path, or it will be searched for, but the method of handling this attribute is not explicit as some implementations will ignore it. More info on the Icon specification stuff can be found at: http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

While I am not positive, .desktop files are GNOME/ GNOME-Compatible (really freedesktop.org standard compatible) only. There are several ways of launching applications, each with their own nuances. This should not be a problem if your target is Unity, and there is a relevant tutorial at https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles. That said, the sidebar of Unity is weird. You may also want to ask over at http://www.linuxquestions.org/ and see what they say.

Thank you for the extensive reply , I gave all the resources a look , and I tried a few more things but not much luck . When I hover the icon in the launcher (of a launched instance of my app - that no icon, no title thing that focuses the window correctly) - I get an "Untitled window" caption , even though the window has a title now (and it gets displayed correctly on the window itself) . So there is some gap in the communication between unity and allegro (I assume that some passing of arguments doesn't happen correctly ) . Do you know what arguments the passed between the window manager and the program to correctly associate everything ? (I'll continue reading myself ,and again thank you for all the help , I'm just throwing the question out there , since that's the page I'm on now) .

While what I said before is generally correct and is so for older Unity versions, some things may have improved since the last time I gave up on Unity. That said, I think there may be a bug you found and it may be in both. Here's why: Non-Allegro5 programs (single icon) or allegro5 programs started through terminal (terminal gets a `?` icon and the allegro program gets the icon correctly) seems to appropriately associate the icon assuming they are configured in the script correctly. The presence of a .desktop icon parameter in the script should override that of the binary, especially if no proper icon is found. This may need to filed as such the Unity tracker - but check with the other allegro-ites as they know much more about this than I. The same problem occurs with EX_ICON packaged with Allegro5 itself, so A5 might have issues too as Thomas Fjellstrom suggested. I am not sure how to make the .desktop change the working directory so relative references ("./data/image.png" for example) will work.

First, just make sure you script is correct by ensure your permissions are correct and that the image is not referenced as an absolute location. ./my_image.jpg Will NOT work. So make sure you spell the image and location correctly.

Note this is only the freedesktop.org standard specification loading script, and that the icon is not pulled in this case from the program. In allegro5 I think you can use voidal_set_display_icon(ALLEGRO_DISPLAY*display, ALLEGRO_BITMAP*icon) but I can't make it work even using the example program for it ex_icon.c.

I have installed a clean Ubuntu 12.04lts with Unity, and used the following script:

Note I have mc installed and the PATH is configured (I can type "mc" to run the program from terminal no matter the directory I am in.).I named "mysupamcscript.desktop" and set as executable. This can be done from GUI, by right clicking -> "Properties" -> goto tab "Permissions"-> Check "Allow executing file as a program".

This runs, loads the jpg icon I made by saving the Alex.gif as a single frame using gimp, and will only load one instance. Since the script is not really 'installed' (you can learn how in one of the links from earlier), right click it and click "lock to Launcher". It should say and work now, even after the program has terminated. Please note that This is specific to Unity.

To make a universal method of ensuring single instance, you will want to check using your own code.

I made a new .desktop by your model and here's what I noted :- If terminal is enabled the icon loads correctly - but for the terminal window . The Allegro window still has neither title nor icon.-If terminal is disabled (set to false) the program runs ,again with no title/icon,in a single instance , but if you try to lock it to the launcher you will get a dysfunctional launcher -There are problems with closing the program (the display close signal delays in some cases) and in these (as far as I've seen) cases Ubuntu returns an "Internal error" message (but the program still closes , just with a delay) .-I think there was one more , but I forgot

So as the Title appears on the actual window (somebody that tried it can say if the icon appeared on the window) I make the conclusion that the communication with the display manager is OK , but for some reason Unity can't handle the allegro displays .

Alehbeer, if you haven't wiped your Ubuntu setup, can you see if the game (MC) runs correctly without being run through the terminal (there's still some chance that something in my code causes the problem). As in - do you have an icon and a working locked launcher with Terminal=false in the .desktop file ?

On the Unity IRC channel they directed me to file a bug against the library that handles binding windows to their according processes in Unity- BAMF ( https://launchpad.net/bamf ) . So I guess that's what I'll do . Again - thanks for the help guys , I'll update the thread if some kind of solution comes up .

mc is a terminal program, but I suspect the terminal only icon thing is allegros inability to overcome Unity's errors. I tired the .Desktop with Jamestown, the commercial indie videogame, and ended up with the same problem. Jamestown was written with SDL and not allegro, and this version was bought through humblebundle - if that makes any difference. The fact that SDL and allegro5 share this same error under unity points to unity being the common denominator.

Edit!: Another interesting point is that Unity will call programs "Untitled window" often, even if the window has a title right on the window's titlebar.