#include "pnd_notify.h"
#include "../lib/pnd_pathiter.h"
#include "pnd_discovery.h"
+#include "pnd_locate.h"
static unsigned char g_daemon_mode = 0;
// behaviour
unsigned char scanonlaunch = 1;
unsigned int interval_secs = 20;
+ // pnd runscript
+ char *run_searchpath;
+ char *run_script;
+ char *pndrun;
// misc
int i;
if ( g_daemon_mode ) {
// set a CWD somewhere else
+#if 0
chdir ( "/tmp" );
+#endif
// detach from terminal
if ( ( i = fork() ) < 0 ) {
dotdesktoppath = PND_DOTDESKTOP_DEFAULT;
}
+ // try to locate a runscript
+
+ if ( apph ) {
+ run_searchpath = pnd_conf_get_as_char ( apph, PND_PNDRUN_SEARCHPATH_KEY );
+ run_script = pnd_conf_get_as_char ( apph, PND_PNDRUN_KEY );
+ pndrun = NULL;
+
+ if ( ! run_searchpath ) {
+ run_searchpath = PND_APPS_SEARCHPATH;
+ run_script = PND_PNDRUN_FILENAME;
+ }
+
+ } else {
+ run_searchpath = NULL;
+ run_script = NULL;
+ pndrun = PND_PNDRUN_DEFAULT;
+ }
+
+ if ( ! pndrun ) {
+ pndrun = pnd_locate_filename ( run_searchpath, run_script );
+
+ if ( ! pndrun ) {
+ pndrun = PND_PNDRUN_DEFAULT;
+ }
+
+ }
+
+ if ( ! g_daemon_mode ) {
+ if ( run_searchpath ) printf ( "Locating pnd run in %s\n", run_searchpath );
+ if ( run_script ) printf ( "Locating pnd runscript as %s\n", run_script );
+ if ( pndrun ) printf ( "Default pndrun is %s\n", pndrun );
+ }
+
/* startup
*/
printf ( "Found app: %s\n", pnd_box_get_key ( d ) );
}
+ // attempt to create icon files; if successful, alter the disco struct to contain new
+ // path, otherwise leave it alone (since it could be a generic icon reference..)
+ if ( pnd_emit_icon ( dotdesktoppath, d ) ) {
+ // success; fix up icon path to new one..
+ free ( d -> icon );
+ char buffer [ FILENAME_MAX ];
+ sprintf ( buffer, "%s/%s.png", dotdesktoppath, d -> unique_id );
+ d -> icon = strdup ( buffer );
+ }
+
// create the .desktop file
- if ( pnd_emit_dotdesktop ( dotdesktoppath, d ) ) {
+ if ( pnd_emit_dotdesktop ( dotdesktoppath, pndrun, d ) ) {
// add a watch onto the newly created .desktop?
#if 0
char buffer [ FILENAME_MAX ];