Background Research
I am attempting to update the progress bar within the Unity launcher for a simple python/Gtk
application created using Quickly
called test
; however, following the instructions in this video, I have not been able to successfully update the progress bar in the Unity
launcher.
In the Unity Integration video, Quickly
was not used, so the way that the application was structured was slightly different, and the code used in the video does not seem to function properly without modification in a default Quickly ubuntu-application
template application.
Screenshots
Here is a screenshot of the application icon as it is currently displayed in the Unity Launcher.
Here is a screenshot of the kind of Unity launcher progress bar functionality that I would like (overlayed on mail icon: wiki.ubuntu.com).
Project Code
A .zip
file containing the project files can be found here.
Expected Behavior
I would expect the above code to show a progress bar that is 75% full overlayed on the icon for the test application in the Unity Launcher, but the application only runs and displays no progress bar when the command quickly run
is executed.
Problem Investigation
I believe that the problem is that I am not properly getting a reference to the application's main window, however, I am not sure how to properly fix this problem. I also believe that the line: self.launcher = Unity.LauncherEntry.get_for_desktop_id("test.destkop")
may be another source of complication because Quickly
creates .desktop.in
files rather than ordinary .desktop
files, so I am not sure if that might be causing issues as well.
Perhaps, another source of the issue is that I do not entirely understand the difference between .desktop
and .desktop.in
files. Does it possibly make sense to make a copy of the test.desktop.in
file and rename it test.desktop
, and place it in /usr/share/applications
in order for get_for_desktop_id("test,desktop")
to reference the correct .desktop
file?
Related Research Links
Although, I am still not clear on the difference between .desktop and .desktop.in files, I have done some research on .desktop files and I have come across a couple of links:
Edit
After running python setup.py build
and then navigating to /build/share/applications
and moving the built test.desktop
file to ~/.local/share/applications
, and finally executing quickly run
, only a question mark for an icon is being displayed, with no visible progress bar.
Edit 2
After further investigation of the built .desktop
file, it turns out that the line:Icon=/usr/share/test/media/test.svg
within the .desktop
file was pointing to an icon file called test.svg
which did not exist.
In order to resolve this problem, I created a new folder called test
in /usr/share/
using the command sudo mkdir test
and then created another folder inside of the test folder called media
using the command sudo mkdir media
, and then I moved the test.svg
icon file located in my Quickly project directory at test/data/media/test.svg
to /usr/share/test/media/
. The .svg
icon for the application now displays properly in the Unity launcher bar and in the alt-tab view, however there is still no visible progress bar as shown in the screenshot below.
Edit 3
As @dobey, pointed out, there was a typo in the code of the TestWindow.py file at the line:
self.launcher = Unity.LauncherEntry.get_for_desktop_id("test.destkop")
,
where test.destkop
, should be test.desktop
.
I changed this typo and no visible changes occurred when the application was executed using quickly run
. However, after adding the line print('Integrating with launcher')
to add_launcher_integration()
there was no corresponding output in the terminal when the application was run, indicating that the problem seems to be that add_launcher_integration()
does not seem to be called correctly when the application starts.
Edit 4
After further investigation, it turns out that add_launcher_integration()
is in fact called when the application starts. With the addition of the line:
os.system("clear")
prior to the line
print("Integrating with launcher")
the message "Integrating with launcher" now displays in the terminal
.
However, there is still no progress bar visisble in the Unity launcher bar.
Edit 5
After rebuilding the Quickly
project by executing python setup.py build
and moving the built .desktop
file within the Quickly
project located at /build/share/applications/
to ~/.local/share/applications
, the application icon and the progress bar now displays properly in the Unity launcher bar. A screenshot of the launcher integration can be seen below.
The .desktop file has to be installed in the location where the bamf
library knows about it.
You should be able to test by copying the built .desktop file (which should be created from the .desktop.in), into your ~/.local/share/applications
folder, and running update-desktop-database ~/.local/share/applications
, though running this command may not be needed if your application does not handle any MIME types.
The difference between the .desktop and .desktop.in is that the .desktop.in is set up for being translated, and is processed by intltool during build, to have the translations inserted, creating the .desktop file from the .desktop.in file.
Also I just noticed a typo in your code:
self.launcher = Unity.LauncherEntry.get_for_desktop_id("test.destkop")
Notice the "destkop" vs. "desktop" that it should be. Perhaps this is it, if it's not a re-typing error. Assuming your code is actually being run, this is a problem. If it isn't run, then that's the problem. You can add a print('Integrating with launcher')
to the add_launcher_integration function to see. It should appear on the terminal when run.
No comments:
Post a Comment