- a fix to invokers of the pnd_locate_filename function; you must strdup() the result .. otherwise multiple invocations will
return the same buffer, and thus all references will change simultaneously
- nohup is only put into Exec= line .desktop if it is also a no-x11 app (most apps should be x11 I imagine, using SDL?)
- Icons for .desktops can be placed anywhere; path is configured .. 'iconpath' key; nolonger assumed to be same location
as .desktop's go to
- updated config files to include iconpath (test goes to testdata/dotdesktop for now); production goes to /tmp for now
- updated config files so .desktop goes to ~/Desktop for production
- updated config files to comment out pnd_hup script, as xfce appears not to need it. (it may be re-enabled should we switch WMs)
// daemon stuff
char *searchpath = NULL;
char *dotdesktoppath = NULL;
// daemon stuff
char *searchpath = NULL;
char *dotdesktoppath = NULL;
char *notifypath = NULL;
// pnd runscript
char *run_searchpath; // searchpath to find pnd_run.sh
char *notifypath = NULL;
// pnd runscript
char *run_searchpath; // searchpath to find pnd_run.sh
printf ( "Apps searchpath is '%s'\n", appspath );
printf ( "PXML overrides searchpath is '%s'\n", overridespath );
printf ( ".desktop files emit to '%s'\n", dotdesktoppath );
printf ( "Apps searchpath is '%s'\n", appspath );
printf ( "PXML overrides searchpath is '%s'\n", overridespath );
printf ( ".desktop files emit to '%s'\n", dotdesktoppath );
+ printf ( ".desktop icon files emit to '%s'\n", iconpath );
printf ( "Notify searchpath is '%s'\n", notifypath );
}
printf ( "Notify searchpath is '%s'\n", notifypath );
}
// check if icon already exists (from a previous extraction say); if so, we needn't
// do it again
char existingpath [ FILENAME_MAX ];
// check if icon already exists (from a previous extraction say); if so, we needn't
// do it again
char existingpath [ FILENAME_MAX ];
- sprintf ( existingpath, "%s/%s.png", dotdesktoppath, d -> unique_id );
+ sprintf ( existingpath, "%s/%s.png", iconpath, d -> unique_id );
struct stat dirs;
if ( stat ( existingpath, &dirs ) == 0 ) {
struct stat dirs;
if ( stat ( existingpath, &dirs ) == 0 ) {
// 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..)
// 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 ) ) {
+ if ( pnd_emit_icon ( iconpath, d ) ) {
// success; fix up icon path to new one..
if ( d -> icon ) {
free ( d -> icon );
}
d -> icon = strdup ( existingpath );
// success; fix up icon path to new one..
if ( d -> icon ) {
free ( d -> icon );
}
d -> icon = strdup ( existingpath );
+ } else {
+ if ( ! g_daemon_mode ) {
+ printf ( " WARN: Couldn't write out icon %s\n", existingpath );
+ }
}
} // icon already exists?
}
} // icon already exists?
dotdesktoppath = PND_DOTDESKTOP_DEFAULT;
}
dotdesktoppath = PND_DOTDESKTOP_DEFAULT;
}
+ iconpath = pnd_conf_get_as_char ( desktoph, PND_DOTDESKTOPICONS_KEY );
+
+ if ( ! iconpath ) {
+ iconpath = PND_DOTDESKTOPICONS_DEFAULT;
+ }
+
- dotdesktoppath = PND_DOTDESKTOP_DEFAULT;
+ dotdesktoppath = PND_DOTDESKTOPICONS_DEFAULT;
}
// try to locate a runscript and optional hupscript
}
// try to locate a runscript and optional hupscript
if ( ! pndrun ) {
pndrun = pnd_locate_filename ( run_searchpath, run_script );
if ( ! pndrun ) {
pndrun = pnd_locate_filename ( run_searchpath, run_script );
+ if ( pndrun ) {
+ pndrun = strdup ( pndrun ); // so we don't just use the built in buffer; next locate will overwrite it
+ } else {
pndrun = PND_PNDRUN_DEFAULT;
}
pndrun = PND_PNDRUN_DEFAULT;
}
if ( ( t = pnd_conf_get_as_char ( desktoph, PND_PNDHUP_KEY ) ) ) {
pndhup = pnd_locate_filename ( run_searchpath, t );
if ( ( t = pnd_conf_get_as_char ( desktoph, PND_PNDHUP_KEY ) ) ) {
pndhup = pnd_locate_filename ( run_searchpath, t );
+
+ if ( pndhup ) {
+ pndhup = strdup ( pndhup ); // so we don't just use the built in buffer; next locate will overwrite it
+ }
+
#if 0 // don't enable this; if no key in config, we don't want to bother hupping
} else {
pndhup = pnd_locate_filename ( run_searchpath, PND_PNDHUP_FILENAME );
#if 0 // don't enable this; if no key in config, we don't want to bother hupping
} else {
pndhup = pnd_locate_filename ( run_searchpath, PND_PNDHUP_FILENAME );
/* handle globbing or variable substitution
*/
dotdesktoppath = pnd_expand_tilde ( strdup ( dotdesktoppath ) );
/* handle globbing or variable substitution
*/
dotdesktoppath = pnd_expand_tilde ( strdup ( dotdesktoppath ) );
+ iconpath = pnd_expand_tilde ( strdup ( iconpath ) );
/* validate paths
*/
mkdir ( dotdesktoppath, 0777 );
/* validate paths
*/
mkdir ( dotdesktoppath, 0777 );
+ mkdir ( iconpath, 0777 );
# Desktop configuration
[dotfiles]
# Desktop configuration
[dotfiles]
-dotdesktoppath /usr/share/applications/ # path for pndnotifyd to spit .desktop files into (run as root)
-#dotdesktoppath ~/.applications/ # path for pndnotifyd to spit .desktop files into (run as a user)
+#(~/Desktop for xfce, /usr/share/applications for WMs that actually follow spec)
+dotdesktoppath ~/Desktop/ # path for pndnotifyd to spit .desktop files into (run as root)
+iconpath /tmp # path for pndnotifyd to drop icons into (can be same as .desktop if WM permits)
+# if hupscript is commented out entirely, pndnotifyd will not try to find/run the hup
+# if it is uncommented, pndnotifyd will attempt to invoke the hupscript after emitting .desktop files
+# (the hupscript exists to hup the WMs to redisplay .desktop apps)
+#hupscript pnd_hup.sh
// .desktop support
#define PND_DOTDESKTOP_KEY "dotfiles.dotdesktoppath"
// .desktop support
#define PND_DOTDESKTOP_KEY "dotfiles.dotdesktoppath"
+#define PND_DOTDESKTOPICONS_KEY "dotfiles.iconpath"
#define PND_DOTDESKTOP_DEFAULT "~/.applications"
#define PND_DOTDESKTOP_DEFAULT "~/.applications"
+#define PND_DOTDESKTOPICONS_DEFAULT "~/.applications"
// apps
#define PND_DEFAULT_WORKDIR "./"
// apps
#define PND_DEFAULT_WORKDIR "./"
#endif
if ( p -> exec ) {
#endif
if ( p -> exec ) {
+ char *nohup;
+
+ if ( p -> option_no_x11 ) {
+ nohup = "/usr/bin/nohup ";
+ } else {
+ nohup = "";
+ }
// basics
if ( p -> object_type == pnd_object_type_directory ) {
// basics
if ( p -> object_type == pnd_object_type_directory ) {
- snprintf ( buffer, 1020, "Exec=/usr/bin/nohup %s -p %s -e %s -b %s",
- pndrun, p -> object_path, p -> exec, p -> unique_id );
+ snprintf ( buffer, 1020, "Exec=%s%s -p %s -e %s -b %s",
+ nohup, pndrun, p -> object_path, p -> exec, p -> unique_id );
} else if ( p -> object_type == pnd_object_type_pnd ) {
} else if ( p -> object_type == pnd_object_type_pnd ) {
- snprintf ( buffer, 1020, "Exec=/usr/bin/nohup %s -p %s/%s -e %s -b %s",
- pndrun, p -> object_path, p -> object_filename, p -> exec, p -> unique_id );
+ snprintf ( buffer, 1020, "Exec=%s%s -p %s/%s -e %s -b %s",
+ nohup, pndrun, p -> object_path, p -> object_filename, p -> exec, p -> unique_id );
[dotfiles]
#dotdesktoppath ./testdata/dotdesktop # path for pndnotifyd to spit .desktop files into
dotdesktoppath ~/.applications # path for pndnotifyd to spit .desktop files into
[dotfiles]
#dotdesktoppath ./testdata/dotdesktop # path for pndnotifyd to spit .desktop files into
dotdesktoppath ~/.applications # path for pndnotifyd to spit .desktop files into
+iconpath ./testdata/dotdesktop # path for pndnotifyd to drop icons into (can be same as .desktop if WM permits)
[launcher]
hupscript pnd_hup.sh
[launcher]
hupscript pnd_hup.sh