I am building a app with quickly, and I wanted to add a daemon that will run in the background. How do you do this?
|
|
From what I can see there is no template to add a daemon in quickly. However, you can contribute by creating a daemon template. How to create your own template is explained in the answer to this question: How to create a new quickly application template You could also join the community templates group at Launchpad, to make your template available for others to use. EDIT: There is also the Unity lens template. It will only work with Ubuntu Unity, so you will be platform dependent (rather significant weakness if you ask me). But it seems to have D-Bus things ready from the start. Kind of like a daemon, but maybe not quite. You could use this as a starting-point to create a platform independent daemon, perhaps... I don't know any details other than what I can link from others, sorry. Just looking at this myself to find out how to use Qt4 with quickly. EDIT2: Just found that there is a D-Bus component to Qt, which would make your daemon platform independent (working on Windows and Linux etc). This discussion forum (http://www.qtcentre.org/threads/38453-Send-and-receive-a-signal-between-2-Qt-applications) has an example (in C++, but still) of how to use it. Or you can google for QDBusConnection and QDBusMessage. |
||||
|
|
|
As far I know there is nothing specific in quickly to prevent or assist you with running daemons, but there is at least two options I know/guess you can do it with python: Option #1: DistutilsNOTE: I didn't tried this one yet :)
Seems a way to go when daemon must be running for all users, e.g. similar how U1 works. Option #2: HardcodeHardcode everything into your app logic, for example initialize ~/.config/autostart/yurapp-launcher.desktop on the first run, e.g. similar to how GmailNotify App does it. Unlike GmailNotify App you can relie on the python-xdg library to access freedesktop.org standards:
Seems good for user managed daemons. |
||||
|
|
|
Python 3.3 will have a daemon module for the management of daemons. |
|||
|
|
|
Looking through the Quickly docs, it seems that Quickly does not natively support creating daemons. Therefore I suggest the Python Daemon Library. Also, go over the following Python tutorials that could be interfaced easily from a Quickly application: Also, this Stack Overflow question addresses Python daemons. |
|||||||||
|