menu_apps 1 # search the pnd standard menu searchpath for apps
aux_searchpath /media/*/pandora/mmenu # if something here, also search this path; can be used for mmenu-only apps?
+[utility]
+terminal /usr/bin/Terminal # could also be /usr/bin/xterm, or a sh-script, or whatever
+
[display]
fullscreen 1 # 0 for windowed, >0 for fullscreen
screen_width 800 # for some calculations
menu_apps 1 # search the pnd standard menu searchpath for apps
aux_searchpath /media/*/pandora/mmenu # if something here, also search this path; can be used for mmenu-only apps?
+[utility]
+terminal /usr/bin/Terminal # could also be /usr/bin/xterm, or a sh-script, or whatever
+
[display]
fullscreen 0 # 0 for windowed, >0 for fullscreen
screen_width 800 # for some calculations
// battery
if ( 1 ) {
- static last_battlevel = 0;
+ static int last_battlevel = 0;
static unsigned char batterylevel = 0;
char buffer [ 100 ];
"Shutdown Pandora",
"Rescan for Applications",
"Run xfce4 from Minimenu",
+ "Run a terminal/console",
"Exit and run xfce4",
"Exit and run pmenu",
"Quit (<- beware)",
"About Minimenu"
};
- int sel = ui_modal_single_menu ( opts, 8, "Minimenu", "Enter to select; other to return." );
+ int sel = ui_modal_single_menu ( opts, 9, "Minimenu", "Enter to select; other to return." );
char buffer [ 100 ];
if ( sel == 0 ) {
sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/bin/startxfce4" );
emit_and_quit ( buffer );
} else if ( sel == 4 ) {
+ // run terminal
+ char *argv[5];
+ argv [ 0 ] = pnd_conf_get_as_char ( g_conf, "utility.terminal" );
+ argv [ 1 ] = NULL;
+
+ if ( argv [ 0 ] ) {
+ ui_forkexec ( argv );
+ }
+
+ } else if ( sel == 5 ) {
// set env to xfce
sprintf ( buffer, "echo startxfce4 > /tmp/gui.load" );
system ( buffer );
//sprintf ( buffer, "sudo poweroff" );
//system ( buffer );
exit ( 0 );
- } else if ( sel == 5 ) {
+ } else if ( sel == 6 ) {
// set env to pmenu
sprintf ( buffer, "echo pmenu > /tmp/gui.load" );
system ( buffer );
//sprintf ( buffer, "sudo poweroff" );
//system ( buffer );
exit ( 0 );
- } else if ( sel == 6 ) {
- emit_and_quit ( MM_QUIT );
} else if ( sel == 7 ) {
+ emit_and_quit ( MM_QUIT );
+ } else if ( sel == 8 ) {
// about
}
return;
}
+
+unsigned char ui_forkexec ( char *argv[] ) {
+ char *fooby = argv[0];
+ int x;
+
+ if ( ( x = fork() ) < 0 ) {
+ pnd_log ( pndn_error, "ERROR: Couldn't fork() for '%s'\n", fooby );
+ return ( 0 );
+ }
+
+ if ( x == 0 ) { // child
+ execv ( fooby, argv );
+ pnd_log ( pndn_error, "ERROR: Couldn't exec(%s)\n", fooby );
+ return ( 0 );
+ }
+
+ // parent, success
+ return ( 1 );
+}
// show a menu, return when selection made; -1 means no selection. Enter is pick.
int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *footer );
+// run a forked app (ie: not wait for it to return)
+unsigned char ui_forkexec ( char *argv[] ); // argv[0] is proggy to exec; argv last entry must be NULLptr
+
/* internal functions follow
*/