? src/.nfs0000c77600000006 Index: src/actions.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v retrieving revision 1.19 diff -c -r1.19 actions.c *** src/actions.c 2001/02/14 03:40:37 1.19 --- src/actions.c 2001/02/15 07:18:51 *************** *** 30,40 **** #define S Mod3Mask /* Super */ #define H Mod4Mask /* Hyper */ rp_action key_actions[] = { {XK_t, C, "other", command}, {XK_t, 0, 0, generate_prefix}, {XK_g, C, "abort", command}, ! {XK_c, 0, "exec xterm", command}, {XK_e, 0, "exec emacs", command}, {XK_p, 0, "prev", command}, {XK_n, 0, "next", command}, --- 30,44 ---- #define S Mod3Mask /* Super */ #define H Mod4Mask /* Hyper */ + //BENNO: Changed exec xterm to use a variable from the + //conf.h (Maybe do this with emacs as well, so users only + //have to edit one file to change their editor? + rp_action key_actions[] = { {XK_t, C, "other", command}, {XK_t, 0, 0, generate_prefix}, {XK_g, C, "abort", command}, ! {XK_c, 0, "exec "XTERM, command}, {XK_e, 0, "exec emacs", command}, {XK_p, 0, "prev", command}, {XK_n, 0, "next", command}, *************** *** 42,47 **** --- 46,52 ---- {XK_Return, 0, "next", command}, {XK_colon, 0, "colon", command}, {XK_exclam, 0, "exec", command}, + {XK_exclam, C, "xterm", command}, {XK_w, 0, "windows", command}, {XK_K, 0, "kill", command}, {XK_k, 0, "delete", command}, *************** *** 67,72 **** --- 72,78 ---- {"next", next_window, arg_VOID}, {"prev", prev_window, arg_VOID}, {"exec", shell_command, arg_STRING}, + {"xterm", xterm_command, arg_STRING}, {"number", goto_window_number, arg_NUMBER}, {"select", goto_win_by_name, arg_STRING}, {"colon", command, arg_STRING}, *************** *** 350,355 **** --- 356,377 ---- } wait((int *) 0); PRINT_DEBUG ("spawned %s\n", cmd); + } + + /*BENNO: This could be done a lot neater. I mainly code python so my C string + handling is kinda rusty ;). It seems to work though */ + void + xterm_command (void *data) + { + char cmd[MAX_COMMAND_LENGTH]; + char realcmd[MAX_COMMAND_LENGTH + strlen(XTERM) + 5]; + if (data == NULL) + get_input (get_screen(), XTERM" "MESSAGE_PROMPT_XTERM_COMMAND, cmd, MAX_COMMAND_LENGTH); + else + strncpy (cmd, data, MAX_COMMAND_LENGTH-1); + + sprintf(realcmd, "%s -e %s", XTERM, cmd); + spawn (realcmd); } /* Switch to a different Window Manager. Thanks to Index: src/actions.h =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/actions.h,v retrieving revision 1.10 diff -c -r1.10 actions.h *** src/actions.h 2001/02/14 03:42:09 1.10 --- src/actions.h 2001/02/15 07:18:51 *************** *** 39,44 **** --- 39,45 ---- void abort_keypress (void *data); void goto_window_number (void* data); void spawn(void *data); + void xterm_command (void *data); void shell_command (void *data); void command (void *data); void command (void *data); Index: src/conf.h =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/conf.h,v retrieving revision 1.7 diff -c -r1.7 conf.h *** src/conf.h 2001/02/14 03:53:59 1.7 --- src/conf.h 2001/02/15 07:18:52 *************** *** 20,25 **** --- 20,36 ---- #include "data.h" #include "actions.h" + + // BENNO: Define what your xterm is. Could be xterm, rxvt, eterm etc + // just make sure it support the "-e". + + #define XTERM "rxvt" + + // BENNO: Define this if you want ratpoison to close the X server after + // exiting the last app + + #define AUTO_CLOSE + #define KEY_PREFIX 't' #define MODIFIER_PREFIX ControlMask *************** *** 47,49 **** --- 58,63 ---- jump to them or give them keyboard focus. This has been added mostly for use with hand-helds. */ #define UNMANAGED_WINDOW_LIST "xapm","xclock","xscribble" + + + Index: src/events.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/events.c,v retrieving revision 1.21 diff -c -r1.21 events.c *** src/events.c 2001/02/14 03:51:12 1.21 --- src/events.c 2001/02/15 07:18:53 *************** *** 86,92 **** } update_window_names (s); ! } } void --- 86,98 ---- } update_window_names (s); ! #ifdef AUTO_CLOSE ! if (is_zero_windows()) ! { ! send_kill (); ! } ! #endif ! } } void Index: src/list.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/list.c,v retrieving revision 1.8 diff -c -r1.8 list.c *** src/list.c 2001/02/10 22:56:13 1.8 --- src/list.c 2001/02/15 07:18:54 *************** *** 100,106 **** return NULL; } ! void remove_from_window_list (rp_window *w) { --- 100,116 ---- return NULL; } ! #ifdef AUTO_CLOSE ! // BENNO: This is used by the code which does the auto_close. ! // It could just be left in, but in order to reduce bloat I'll ! // ifdef it aswell ! int ! is_zero_windows () ! { ! return (rp_window_head->next == (rp_window*) NULL && rp_window_head->prev == (rp_window*) NULL); ! } ! #endif ! void remove_from_window_list (rp_window *w) { Index: src/list.h =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/list.h,v retrieving revision 1.4 diff -c -r1.4 list.h *** src/list.h 2001/02/11 05:14:24 1.4 --- src/list.h 2001/02/15 07:18:54 *************** *** 33,36 **** --- 33,39 ---- int goto_window_name (char *name); rp_window *find_last_accessed_window (); rp_window *find_window_by_number (int n); + #ifdef AUTO_CLOSE + int is_zero_windows (); + #endif #endif /* _LIST_H */ Index: src/messages.h =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/messages.h,v retrieving revision 1.2 diff -c -r1.2 messages.h *** src/messages.h 2001/02/14 03:43:35 1.2 --- src/messages.h 2001/02/15 07:18:54 *************** *** 8,13 **** --- 8,14 ---- #define MESSAGE_PROMPT_GOTO_WINDOW_NAME " Switch to window: " #define MESSAGE_PROMPT_NEW_WINDOW_NAME " Set window's title to: " #define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c " + #define MESSAGE_PROMPT_XTERM_COMMAND "-e " #define MESSAGE_PROMPT_COMMAND ":" #define MESSAGE_PROMPT_SWITCH_WM " Switch to wm: " Index: src/ratpoison.h =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/ratpoison.h,v retrieving revision 1.7 diff -c -r1.7 ratpoison.h *** src/ratpoison.h 2001/02/14 03:43:03 1.7 --- src/ratpoison.h 2001/02/15 07:18:55 *************** *** 58,62 **** void clean_up (); screen_info *find_screen (Window w); ! #endif /* _RATPOISON_H */ --- 58,67 ---- void clean_up (); screen_info *find_screen (Window w); ! #ifdef AUTO_CLOSE ! // BENNO: This is used in events.c to close the XServer. Seemed neat ! // to put it here. Rather than #including all of communications.h in events.c ! // probably needs to be changed. ! void send_kill (); ! #endif #endif /* _RATPOISON_H */