diff -ru fnfx-0.2/src/fnfxd.c fnfx-0.2m/src/fnfxd.c --- fnfx-0.2/src/fnfxd.c 2003-11-06 14:29:23.000000000 -0800 +++ fnfx-0.2m/src/fnfxd.c 2004-10-28 16:41:39.000000000 -0700 @@ -26,8 +26,9 @@ */ #define PROGRAM "FnFX Daemon" -#define VERSION "v0.2" -#define AUTHOR "Timo Hoenig " +#define VERSION "v0.2m" +#define AUTHOR "Timo Hoenig \n" \ + " script addon Matthias Kattanek " /* * Includes @@ -60,6 +61,7 @@ extern int init_sig_handler(void); extern int init_fnfxd(int *, int *); extern int chk_fnkey(void); +extern int handle_external(void); extern void walk_config(void); /* fnfxd_cmds.c */ @@ -251,6 +253,7 @@ while(1) { chk_fnkey(); + handle_external(); usleep(150000); } diff -ru fnfx-0.2/src/fnfxd_cfg.c fnfx-0.2m/src/fnfxd_cfg.c --- fnfx-0.2/src/fnfxd_cfg.c 2003-11-05 23:34:37.000000000 -0800 +++ fnfx-0.2m/src/fnfxd_cfg.c 2004-10-28 16:43:03.000000000 -0700 @@ -145,6 +145,50 @@ return 0; } +/* + * add_external() + * + * Add (external) action to the configuration (in memory). + * + */ + +int +add_external(int i, char *command) +{ + //strcpy(daemon_cfg->keymap.fnkey[i].client_command, command); + //daemon_cfg->keymap.fnkey[i].state |= FNKEY_ENABLED; + //daemon_cfg->keymap.fnkey[i].state |= FNKEY_EXTERNAL; + strcpy(cfg->keymap.fnkey[i].command, command); + cfg->keymap.fnkey[i].state |= FNKEY_ENABLED; + cfg->keymap.fnkey[i].state |= FNKEY_EXTERNAL; + return 0; +} + +int +handle_external(void) +{ + int i = cfg->acpi.fnkey_pos; + + if((cfg->keymap.fnkey[i].state & FNKEY_ENABLED) && strlen(cfg->keymap.fnkey[i].command)) + { + if(cfg->keymap.fnkey[i].state & FNKEY_EXTERNAL) + { + char command[CMD_SIZE]; + sprintf(command, "%s%1c", cfg->keymap.fnkey[i].command, '&'); + + debug("handle_external() - executing: %s", command); + system(command); + } +//mk else +//mk debug("handle_external() - Nothing to handle. It's a internal command and executed by the daemon."); + } +//mk else +//mk debug("handle_external() - Nothing to do. There is no configuration entry for this key."); + + return 0; +} + + /* * is_action() @@ -212,13 +256,15 @@ { if(strlen(command)) { + //debug("mk: action='%s' command='%s' \n", fnkey_descr, command); if(!(is_action(command))) add_action(i, command); else - debug("Error (non-fatal) while reading config file. " \ + add_external(i, command); + /*debug("Error (non-fatal) while reading config file. " \ "\"%s\" is no valid command.", \ command \ - ); + );*/ } else {