A tiling window manager

ratpoison -> sdorfehs

Keep rp_* prefixes as an homage to ratpoison.

Take this opportunity to move the default config file path from
~/.ratpoisonrc to $XDG_CONFIG_HOME/sdorfehs/config and the bar fifo
path to $XDG_CONFIG_HOME/sdorfehs/bar

+214 -268
+1 -1
.gitignore
··· 1 1 *.o 2 - ratpoison 2 + sdorfehs
+7 -13
Makefile
··· 34 34 linkedlist.o \ 35 35 manage.o \ 36 36 number.o \ 37 - ratpoison.o \ 38 37 sbuf.o \ 39 38 screen.o \ 39 + sdorfehs.o \ 40 40 split.o \ 41 41 utf8.o \ 42 42 util.o \ ··· 63 63 manage.h \ 64 64 messages.h \ 65 65 number.h \ 66 - ratpoison.h \ 67 66 sbuf.h \ 68 67 screen.h \ 68 + sdorfehs.h \ 69 69 split.h \ 70 70 utf8.h \ 71 71 util.h \ ··· 73 73 window.h \ 74 74 xrandr.h 75 75 76 - BIN= ratpoison 76 + BIN= sdorfehs 77 77 78 - MAN= ratpoison.1 78 + MAN= sdorfehs.1 79 79 80 80 %.o: %.c $(DEPS) 81 81 $(CC) $(CFLAGS) -c -o $@ $< 82 82 83 - ratpoison: $(OBJ) 83 + sdorfehs: $(OBJ) 84 84 $(CC) $(LDFLAGS) -o $@ $^ 85 85 86 - all: ratpoison 86 + all: sdorfehs 87 87 88 88 install: all 89 - $(eval TMPDIR := $(shell mktemp -d)) 90 89 mkdir -p $(BINDIR) $(MANDIR) 91 90 install -s $(BIN) $(BINDIR) 92 - for i in $(MAN); do \ 93 - sed 's,%%sysconfdir%%,${SYSCONFDIR},g' $$i > $(TMPDIR)/$$i; \ 94 - install -m 644 $(TMPDIR)/$$i $(MANDIR); \ 95 - rm $(TMPDIR)/$$i; \ 96 - done 97 - rmdir $(TMPDIR) 91 + install -m 644 $(MAN) $(MANDIR) 98 92 99 93 clean: 100 94 rm -f $(BIN) $(OBJ)
+2 -2
actions.c
··· 29 29 #include <X11/extensions/XTest.h> 30 30 #include <sys/ioctl.h> 31 31 32 - #include "ratpoison.h" 32 + #include "sdorfehs.h" 33 33 34 34 /* arg_REST and arg_SHELLCMD eat the rest of the input. */ 35 35 enum argtype { ··· 3194 3194 show_frame_message(defaults.resize_fmt); 3195 3195 read_key(&c, &mod, buffer, sizeof(buffer)); 3196 3196 3197 - /* Convert the mask to be compatible with ratpoison. */ 3197 + /* Convert the mask to be compatible with us. */ 3198 3198 mod = x11_mask_to_rp_mask(mod); 3199 3199 3200 3200 for (binding = resize_bindings; binding->action; binding++) {
+4 -4
actions.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_ACTIONS_H 21 - #define _RATPOISON_ACTIONS_H 1 20 + #ifndef _SDORFEHS_ACTIONS_H 21 + #define _SDORFEHS_ACTIONS_H 1 22 22 23 - #include "ratpoison.h" 23 + #include "sdorfehs.h" 24 24 25 25 /* The structure returned by a command. */ 26 26 typedef struct cmdret { ··· 44 44 rp_action *find_keybinding(KeySym keysym, unsigned int state, rp_keymap *map); 45 45 rp_action *find_keybinding_by_action(char *action, rp_keymap *map); 46 46 47 - #endif /* ! _RATPOISON_ACTIONS_H */ 47 + #endif /* ! _SDORFEHS_ACTIONS_H */
+3 -3
bar.c
··· 28 28 #include <unistd.h> 29 29 #include <errno.h> 30 30 31 - #include "ratpoison.h" 31 + #include "sdorfehs.h" 32 32 33 33 /* Possible values for bar_is_raised status. */ 34 34 #define BAR_IS_HIDDEN 0 ··· 745 745 PRINT_ERROR(("failed opening newly-created bar FIFO at %s: %s\n", 746 746 rp_glob_screen.bar_fifo_path, strerror(errno))); 747 747 rp_glob_screen.bar_fifo_fd = -1; 748 - return 0; 748 + return -1; 749 749 } 750 750 751 - return 1; 751 + return 0; 752 752 } 753 753 754 754 void
+3 -3
bar.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_BAR_H 21 - #define _RATPOISON_BAR_H 1 20 + #ifndef _SDORFEHS_BAR_H 21 + #define _SDORFEHS_BAR_H 1 22 22 23 23 void redraw_sticky_bar_text(rp_screen *s); 24 24 void update_window_names(rp_screen *s, char *fmt); ··· 41 41 int bar_open_fifo(void); 42 42 void bar_read_fifo(void); 43 43 44 - #endif /* ! _RATPOISON_BAR_H */ 44 + #endif /* ! _SDORFEHS_BAR_H */
+3 -3
communications.c
··· 1 1 /* 2 - * communications.c -- Send commands to a running copy of ratpoison. 2 + * communications.c -- Send commands to a running copy of sdorfehs. 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 25 25 26 26 #include <string.h> 27 27 28 - #include "ratpoison.h" 28 + #include "sdorfehs.h" 29 29 30 - /* Sending commands to ratpoison */ 30 + /* Sending commands to us from another process */ 31 31 static int 32 32 receive_command_result(Window w) 33 33 {
+4 -4
communications.h
··· 1 1 /* 2 - * communications.h -- Send commands to a running copy of ratpoison. 2 + * communications.h -- Send commands to a running copy of sdorfehs. 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_COMMUNICATIONS_H 21 - #define _RATPOISON_COMMUNICATIONS_H 1 20 + #ifndef _SDORFEHS_COMMUNICATIONS_H 21 + #define _SDORFEHS_COMMUNICATIONS_H 1 22 22 23 23 int send_command(unsigned char interactive, unsigned char *cmd); 24 24 25 - #endif /* ! _RATPOISON_COMMUNICATIONS_H */ 25 + #endif /* ! _SDORFEHS_COMMUNICATIONS_H */
+1 -2
completions.c
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #define _GNU_SOURCE 20 19 #include <string.h> 21 20 22 - #include "ratpoison.h" 21 + #include "sdorfehs.h" 23 22 #include "completions.h" 24 23 25 24 rp_completions *
+3 -3
completions.h
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #ifndef _RATPOISON_COMPLETIONS_H 20 - #define _RATPOISON_COMPLETIONS_H 1 19 + #ifndef _SDORFEHS_COMPLETIONS_H 20 + #define _SDORFEHS_COMPLETIONS_H 1 21 21 22 22 char *completions_complete(rp_completions * c, char *partial, int direction); 23 23 rp_completions *completions_new(completion_fn list_fn, 24 24 enum completion_styles style); 25 25 void completions_free(rp_completions * c); 26 26 27 - #endif /* ! _RATPOISON_COMPLETIONS_H */ 27 + #endif /* ! _SDORFEHS_COMPLETIONS_H */
+9 -9
config.h
··· 1 1 /* 2 - * Config file for ratpoison. Edit these values and recompile. 2 + * Config file. Edit these values and recompile. 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_CONF_H 21 - #define _RATPOISON_CONF_H 1 20 + #ifndef _SDORFEHS_CONF_H 21 + #define _SDORFEHS_CONF_H 1 22 22 23 23 #include "data.h" 24 24 #include "actions.h" 25 25 26 - #define PROGNAME "ratpoison" 27 - #define VERSION "20190816" 26 + #define PROGNAME "sdorfehs" 27 + #define VERSION "20190822" 28 28 29 29 /* Enter command mode with Control+T by default. */ 30 30 #define KEY_PREFIX XK_t ··· 94 94 #define MAX_LINK_DEPTH 16 95 95 96 96 /* 97 - * Bad window messages can be safely ignored now that ratpoison has become 98 - * stable enough. Comment this line if you wish to be notified about bad window 97 + * Bad window messages can be safely ignored now that we have become stable 98 + * enough. Comment this line if you wish to be notified about bad window 99 99 * messages. 100 100 */ 101 101 #define IGNORE_BADWINDOW 1 ··· 107 107 #define MAX_HISTORY_SIZE 100 108 108 109 109 /* The default filename in which to store the history */ 110 - #define HISTORY_FILE ".ratpoison_history" 110 + #define HISTORY_FILE "history" 111 111 112 112 /* The name of the root keymap */ 113 113 #define ROOT_KEYMAP "root" ··· 118 118 /* The default font */ 119 119 #define DEFAULT_XFT_FONT "monospace:size=12" 120 120 121 - #endif /* !_ _RATPOISON_CONF_H */ 121 + #endif /* !_ _SDORFEHS_CONF_H */
+3 -3
data.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_DATA_H 21 - #define _RATPOISON_DATA_H 20 + #ifndef _SDORFEHS_DATA_H 21 + #define _SDORFEHS_DATA_H 22 22 23 23 #include "linkedlist.h" 24 24 #include "number.h" ··· 476 476 int len; 477 477 }; 478 478 479 - #endif /* _RATPOISON_DATA_H */ 479 + #endif /* _SDORFEHS_DATA_H */
+1 -1
editor.c
··· 26 26 #include <X11/Xutil.h> 27 27 #include <X11/Xatom.h> 28 28 29 - #include "ratpoison.h" 29 + #include "sdorfehs.h" 30 30 31 31 /* bind functions */ 32 32 static edit_status editor_forward_char(rp_input_line *line);
+3 -3
editor.h
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #ifndef _RATPOISON_EDITOR_H 20 - #define _RATPOISON_EDITOR_H 1 19 + #ifndef _SDORFEHS_EDITOR_H 20 + #define _SDORFEHS_EDITOR_H 1 21 21 22 22 #include "utf8.h" 23 23 ··· 39 39 edit_status execute_edit_action(rp_input_line *line, KeySym ch, 40 40 unsigned int modifier, char *keysym_buf); 41 41 42 - #endif /* ! _RATPOISON_EDITOR_H */ 42 + #endif /* ! _SDORFEHS_EDITOR_H */
+2 -2
events.c
··· 1 1 /* 2 - * Ratpoison X events 2 + * X events 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 35 35 #include <sys/time.h> 36 36 #include <sys/wait.h> 37 37 38 - #include "ratpoison.h" 38 + #include "sdorfehs.h" 39 39 40 40 /* 41 41 * The event currently being processed. Mostly used in functions from action.c
+3 -3
events.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_EVENTS_H 21 - #define _RATPOISON_EVENTS_H 1 20 + #ifndef _SDORFEHS_EVENTS_H 21 + #define _SDORFEHS_EVENTS_H 1 22 22 23 23 void listen_for_events(void); 24 24 void show_rudeness_msg(rp_window *win, int raised); 25 25 26 - #endif /* _RATPOISON_EVENTS_H */ 26 + #endif /* _SDORFEHS_EVENTS_H */
+1 -1
format.c
··· 20 20 #include <stdio.h> 21 21 #include <stdlib.h> 22 22 #include <string.h> 23 - #include "ratpoison.h" 23 + #include "sdorfehs.h" 24 24 25 25 /* Function prototypes for format char expanders. */ 26 26 #define RP_FMT(fn) static void fmt_ ## fn (rp_window_elem *elem, struct sbuf *buf)
+3 -3
format.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_FORMAT_H 21 - #define _RATPOISON_FORMAT_H 1 20 + #ifndef _SDORFEHS_FORMAT_H 21 + #define _SDORFEHS_FORMAT_H 1 22 22 23 23 void format_string(char *fmt, rp_window_elem *win_elem, struct sbuf *buffer); 24 24 25 - #endif /* _RATPOISON_FORMAT_H */ 25 + #endif /* _SDORFEHS_FORMAT_H */
+1 -1
frame.c
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #include "ratpoison.h" 20 + #include "sdorfehs.h" 21 21 22 22 #include <string.h> 23 23
+53 -1
globals.c
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #include "ratpoison.h" 19 + #include "sdorfehs.h" 20 20 21 21 #include <sys/types.h> 22 22 #include <sys/wait.h> ··· 26 26 #include <pwd.h> 27 27 #include <signal.h> 28 28 #include <unistd.h> 29 + #include <dirent.h> 29 30 30 31 /* 31 32 * Several systems seem not to have WAIT_ANY defined, so define it if it isn't. ··· 463 464 } 464 465 465 466 return homedir; 467 + } 468 + 469 + char * 470 + get_config_dir(void) 471 + { 472 + DIR *d; 473 + const char *homedir; 474 + char *xdg_config, *home_config; 475 + 476 + homedir = get_homedir(); 477 + if (!homedir) { 478 + PRINT_ERROR(("no home directory\n")); 479 + exit(EXIT_FAILURE); 480 + } 481 + 482 + xdg_config = getenv("XDG_CONFIG_HOME"); 483 + if (xdg_config == NULL || !strlen(xdg_config)) 484 + xdg_config = xsprintf("%s/.config", homedir); 485 + 486 + if (!(d = opendir(xdg_config))) { 487 + if (mkdir(xdg_config, 0755) == -1) { 488 + PRINT_ERROR(("failed creating %s: %s\n", xdg_config, 489 + strerror(errno))); 490 + exit(EXIT_FAILURE); 491 + } 492 + if (!(d = opendir(xdg_config))) { 493 + PRINT_ERROR(("failed opening %s: %s\n", xdg_config, 494 + strerror(errno))); 495 + exit(EXIT_FAILURE); 496 + } 497 + } 498 + closedir(d); 499 + 500 + home_config = xsprintf("%s/sdorfehs", xdg_config); 501 + if (!(d = opendir(home_config))) { 502 + if (mkdir(home_config, 0755) == -1) { 503 + PRINT_ERROR(("failed creating %s: %s\n", home_config, 504 + strerror(errno))); 505 + exit(EXIT_FAILURE); 506 + } 507 + if (!(d = opendir(home_config))) { 508 + PRINT_ERROR(("failed opening %s: %s\n", home_config, 509 + strerror(errno))); 510 + exit(EXIT_FAILURE); 511 + } 512 + } 513 + closedir(d); 514 + 515 + free(xdg_config); 516 + 517 + return home_config; 466 518 } 467 519 468 520 void
+3 -2
globals.h
··· 159 159 */ 160 160 extern int ignore_badwindow; 161 161 162 - /* Arguments passed to ratpoison. */ 162 + /* Arguments passed at startup. */ 163 163 extern char **myargv; 164 164 165 165 /* Keeps track of which mod mask each modifier is under. */ 166 166 extern struct modifier_info rp_modifier_info; 167 167 168 168 /* 169 - * nonzero if an alarm signal was raised. This means ratpoison should hide its 169 + * nonzero if an alarm signal was raised. This means we should hide our 170 170 * popup windows. 171 171 */ 172 172 extern int alarm_signalled; ··· 222 222 void set_close_on_exec(int fd); 223 223 void read_rc_file(FILE *file); 224 224 const char *get_homedir(void); 225 + char *get_config_dir(void); 225 226 void clean_up(void); 226 227 227 228 void register_atom(Atom *a, char *name);
+1 -1
group.c
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #include "ratpoison.h" 19 + #include "sdorfehs.h" 20 20 21 21 #include <string.h> 22 22
+4 -4
history.c
··· 22 22 #include <limits.h> 23 23 #include <sys/stat.h> 24 24 25 - #include "ratpoison.h" 25 + #include "sdorfehs.h" 26 26 27 27 static char * 28 28 get_history_filename(void) ··· 36 36 struct sbuf *buf; 37 37 38 38 buf = sbuf_new(0); 39 - sbuf_printf(buf, "%s/%s", homedir, HISTORY_FILE); 39 + sbuf_printf(buf, "%s/.config/sdorfehs/%s", homedir, 40 + HISTORY_FILE); 40 41 filename = sbuf_free_struct(buf); 41 42 } else { 42 43 filename = xstrdup(HISTORY_FILE); ··· 48 49 static const char * 49 50 extract_shell_part(const char *p) 50 51 { 51 - if (strncmp(p, "exec", 4) && 52 - strncmp(p, "verbexec", 8)) 52 + if (strncmp(p, "exec", 4) && strncmp(p, "verbexec", 8)) 53 53 return NULL; 54 54 while (*p && !isspace((unsigned char) *p)) 55 55 p++;
+3 -3
history.h
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #ifndef _RATPOISON_HISTORY_H 20 - #define _RATPOISON_HISTORY_H 1 19 + #ifndef _SDORFEHS_HISTORY_H 20 + #define _SDORFEHS_HISTORY_H 1 21 21 22 22 enum { 23 23 hist_NONE = 0, hist_COMMAND, hist_SHELLCMD, ··· 37 37 const char *history_previous(int); 38 38 int history_expand_line(int, char *string, char **output); 39 39 40 - #endif /* ! _RATPOISON_HISTORY_H */ 40 + #endif /* ! _SDORFEHS_HISTORY_H */
+1 -1
hook.c
··· 20 20 * A hook is simply a list of strings that get passed to command() in sequence. 21 21 */ 22 22 23 - #include "ratpoison.h" 23 + #include "sdorfehs.h" 24 24 25 25 #include <string.h> 26 26
+1 -1
input.c
··· 26 26 #include <X11/Xutil.h> 27 27 #include <X11/XKBlib.h> 28 28 29 - #include "ratpoison.h" 29 + #include "sdorfehs.h" 30 30 31 31 /* 32 32 * Convert an X11 modifier mask to the rp modifier mask equivalent, as best it
+3 -3
input.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_INPUT_H 21 - #define _RATPOISON_INPUT_H 1 20 + #ifndef _SDORFEHS_INPUT_H 21 + #define _SDORFEHS_INPUT_H 1 22 22 23 23 char *keysym_to_string(KeySym keysym, unsigned int modifier); 24 24 int cook_keycode(XKeyEvent *ev, KeySym *keysym, unsigned int *mod, ··· 37 37 38 38 void init_xkb(void); 39 39 40 - #endif /* ! _RATPOISON_INPUT_H */ 40 + #endif /* ! _SDORFEHS_INPUT_H */
+2 -2
linkedlist.h
··· 20 20 * Place, Suite 330, Boston, MA 02111-1307 USA. 21 21 */ 22 22 23 - #ifndef _RATPOISON_LINKLIST_H 24 - #define _RATPOISON_LINKLIST_H 23 + #ifndef _SDORFEHS_LINKLIST_H 24 + #define _SDORFEHS_LINKLIST_H 25 25 26 26 #include <string.h> 27 27
+1 -1
manage.c
··· 29 29 #include <stdlib.h> 30 30 #include <string.h> 31 31 32 - #include "ratpoison.h" 32 + #include "sdorfehs.h" 33 33 34 34 static char **unmanaged_window_list = NULL; 35 35 static int num_unmanaged_windows = 0;
+3 -3
manage.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_MANAGE_H 21 - #define _RATPOISON_MANAGE_H 1 20 + #ifndef _SDORFEHS_MANAGE_H 21 + #define _SDORFEHS_MANAGE_H 1 22 22 23 23 #include "data.h" 24 24 ··· 55 55 void hide_others(rp_window *win); 56 56 void hide_vscreen_windows(rp_vscreen *v); 57 57 58 - #endif /* ! _RATPOISION_MANAGE_H */ 58 + #endif /* ! _SDORFEHS_MANAGE_H */
+6 -6
messages.h
··· 1 1 /* 2 - * Ratpoison messages. 2 + * Messages. 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_MESSAGES_H 21 - #define _RATPOISON_MESSAGES_H 1 20 + #ifndef _SDORFEHS_MESSAGES_H 21 + #define _SDORFEHS_MESSAGES_H 1 22 22 23 23 #define MESSAGE_NO_OTHER_WINDOW "No other window" 24 24 #define MESSAGE_NO_OTHER_FRAME "No other frame" 25 25 #define MESSAGE_NO_MANAGED_WINDOWS "No managed windows" 26 - #define MESSAGE_UNKNOWN_COMMAND "unknown command '%s'" 26 + #define MESSAGE_UNKNOWN_COMMAND "Unknown command '%s'" 27 27 #define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)" 28 28 29 29 #define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)" ··· 48 48 #define MESSAGE_PROMPT_SELECT_VAR "Variable: " 49 49 #define MESSAGE_PROMPT_VAR_VALUE "Value: " 50 50 51 - #define MESSAGE_WELCOME PROGNAME " " VERSION " - press \"%s %s\" for help" 51 + #define MESSAGE_WELCOME "Welcome to " PROGNAME " - press \"%s %s\" for help" 52 52 53 53 #define EMPTY_FRAME_MESSAGE "Current Frame" 54 54 55 - #endif /* ! _RATPOISON_MESSAGES_H */ 55 + #endif /* ! _SDORFEHS_MESSAGES_H */
+1 -1
number.c
··· 20 20 #include <stdlib.h> 21 21 #include <stdio.h> 22 22 23 - #include "ratpoison.h" 23 + #include "sdorfehs.h" 24 24 25 25 /* Keep track of a set of numbers. For frames and windows. */ 26 26 struct numset {
+3 -3
number.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_NUMBER_H 21 - #define _RATPOISON_NUMBER_H 1 20 + #ifndef _SDORFEHS_NUMBER_H 21 + #define _SDORFEHS_NUMBER_H 1 22 22 23 23 struct numset; 24 24 ··· 28 28 int numset_request(struct numset *ns); 29 29 int numset_add_num(struct numset *ns, int n); 30 30 31 - #endif /* ! _RATPOISON_NUMBER_H */ 31 + #endif /* ! _SDORFEHS_NUMBER_H */
+27 -30
ratpoison.1 sdorfehs.1
··· 21 21 .\" [2] http://mdocml.bsd.lv/ 22 22 .\" [3] http://mdocml.bsd.lv/mdoc.7.html 23 23 .\" 24 - .Dd Aug 22, 2017 25 - .Dt RATPOISON 1 24 + .Dd Aug 22, 2019 25 + .Dt SDORFEHS 1 26 26 .Os 27 27 .Sh NAME 28 - .Nm ratpoison 28 + .Nm sdorfehs 29 29 .Nd window manager without mouse dependency 30 30 .Sh SYNOPSIS 31 31 .Nm 32 - .Op Fl hv 32 + .Op Fl h 33 33 .Nm 34 34 .Op Fl d Ar dpy 35 35 .Op Fl s Ar num ··· 41 41 .Fl c Ar command Op Fl c Ar command ... 42 42 .Sh DESCRIPTION 43 43 .Nm 44 - is a Window Manager without fat library dependencies, fancy graphics or 45 - rat dependence. 44 + is a window manager without fat library dependencies, fancy graphics or 45 + dependence on a mouse. 46 46 .Pp 47 47 The screen can be split into non-overlapping frames. 48 48 All windows are kept maximized inside their frames. 49 49 .Pp 50 - All interaction with the window manager is done through 51 - keystrokes. 50 + All interaction with the window manager is done through keystrokes. 52 51 .Nm 53 52 has a prefix map to minimize key clobbering. 54 53 .Pp 55 54 The options are as follows: 56 55 .Bl -tag -width Bs 57 56 .It Fl c , Fl \-command 58 - Send ratpoison a command. 59 - There must be a ratpoison instance running as window manager for the 60 - given display/screen for this to work. 57 + Send 58 + .Nm 59 + a command. 60 + There must be a 61 + .Nm 62 + instance running as window manager for the given display/screen for this to 63 + work. 61 64 Do not forget to quote the command if it contains spaces. 62 65 For example: 63 66 .Dl Nm Fl c Qq Ar "echo hello world" ··· 68 71 If this is not given, 69 72 .Nm 70 73 will try 71 - .Pa $HOME/.ratpoisonrc 72 - and if that does not exist 73 - .Pa /etc/ratpoisonrc 74 + .Pa $HOME/.config/sdorfehs/config 74 75 and execute each command when starting up. 75 76 .It Fl h , Fl \-help 76 77 Show summary of options. ··· 85 86 like prompting for missing arguments and things like that. 86 87 .It Fl s , Fl \-screen Ar number 87 88 Only use the specified screen. 88 - .It Fl v , Fl \-version 89 - Show version of program. 90 89 .El 91 90 .Sh KEY BINDINGS 92 - To avoid conflicts with other programs, all default ratpoison key 93 - bindings start with an escape key which, by default, is 91 + To avoid conflicts with other programs, all default 92 + .Nm 93 + key bindings start with an escape key which, by default, is 94 94 .Ic C\-t 95 95 (Control\-t). 96 96 Some important default key bindings: ··· 116 116 .It Ic C\-t Q 117 117 Make the current frame the only one 118 118 .It Ic C\-t \&: 119 - Execute a ratpoison command 119 + Execute a 120 + .Nm 121 + command 120 122 .El 121 123 .Pp 122 124 Further default key bindings can be found in parentheses after the ··· 180 182 If there isn't a window in the current frame, it banishes the rat cursor 181 183 to the lower right corner of the frame. 182 184 .It Ic chdir Op Ar directory 183 - If the optional argument is given, change the current directory 184 - of 185 + If the optional argument is given, change the current directory of 185 186 .Nm 186 187 to 187 188 .Ar directory . ··· 203 204 current one. 204 205 (That means the previous window belonging to another type of application 205 206 than the current one.) 206 - .It Ic colon Ar ratpoison\-command Pq Ic C\-t \&: 207 + .It Ic colon Ar sdorfehs\-command Pq Ic C\-t \&: 207 208 Execute 208 - .Ar ratpoison\-command 209 + .Ar sdorfehs\-command 209 210 interactively. 210 211 (i.e. ask for possible missing arguments.) 211 212 .It Ic cother ··· 1188 1189 .Li title . 1189 1190 .El 1190 1191 .Sh FILES 1191 - .Bl -tag -width "%%sysconfdir%%/ratpoisonrc" -compact 1192 - .It Pa ~/.ratpoisonrc 1192 + .Bl -tag -compact 1193 + .It Pa ~/.config/sdorfehs/config 1193 1194 Configuration file read at startup time, if present. 1194 - .It Pa %%sysconfdir%%/ratpoisonrc 1195 - Fallback configuration file, if 1196 - .Pa ~/.ratpoisonrc 1197 - is not found. 1198 1195 .El 1199 1196 .Sh EXIT STATUS 1200 1197 .Ex -std 1201 1198 .Sh AUTHORS 1202 1199 .An -nosplit 1203 1200 .Nm 1204 - was originally written by 1201 + is derived from ratpoison originally written by 1205 1202 .An Shawn Betts Aq Mt sabetts@gmail.com .
+26 -65
ratpoison.c sdorfehs.c
··· 34 34 #include <sys/wait.h> 35 35 #include <ctype.h> 36 36 37 - #include "ratpoison.h" 37 + #include "sdorfehs.h" 38 38 39 39 /* Command line options */ 40 - static struct option ratpoison_longopts[] = 40 + static struct option sdorfehs_longopts[] = 41 41 {{"help", no_argument, 0, 'h'}, 42 42 {"interactive", no_argument, 0, 'i'}, 43 43 {"version", no_argument, 0, 'v'}, ··· 47 47 {0, 0, 0, 0}, 48 48 }; 49 49 50 - static char ratpoison_opts[] = "hvic:d:s:f:"; 50 + static char sdorfehs_opts[] = "hvic:d:s:f:"; 51 51 52 52 static void 53 53 sighandler(int signum UNUSED) ··· 97 97 } 98 98 99 99 static void 100 - print_version(void) 101 - { 102 - printf("%s %s\n", PROGNAME, VERSION); 103 - printf("Copyright (C) 2000-2008 Shawn Betts\n\n"); 104 - 105 - exit(EXIT_SUCCESS); 106 - } 107 - 108 - static void 109 100 print_help(void) 110 101 { 111 102 printf("Help for %s %s\n\n", PROGNAME, VERSION); 112 103 printf("-h, --help Display this help screen\n"); 113 - printf("-v, --version Display the version\n"); 114 104 printf("-d, --display <dpy> Set the X display to use\n"); 115 105 printf("-c, --command <cmd> Send " PROGNAME " a colon-command\n"); 116 106 printf("-i, --interactive Execute commands in interactive mode\n"); ··· 123 113 read_startup_files(const char *alt_rcfile) 124 114 { 125 115 FILE *fileptr = NULL; 116 + char *config_dir, *filename; 126 117 127 - if (alt_rcfile) { 128 - if ((fileptr = fopen(alt_rcfile, "r")) == NULL) { 129 - PRINT_ERROR((PROGNAME ": could not open %s (%s)\n", 130 - alt_rcfile, strerror(errno))); 131 - return -1; 132 - } 133 - } else { 134 - const char *homedir; 135 - char *filename; 118 + if (alt_rcfile && ((fileptr = fopen(alt_rcfile, "r")) == NULL)) { 119 + PRINT_ERROR(("could not open %s (%s)\n", 120 + alt_rcfile, strerror(errno))); 121 + return -1; 122 + } 136 123 137 - /* first check $HOME/.ratpoisonrc */ 138 - homedir = get_homedir(); 139 - if (!homedir) 140 - PRINT_ERROR((PROGNAME ": no home directory!?\n")); 141 - else { 142 - filename = xsprintf("%s/.ratpoisonrc", homedir); 143 - fileptr = fopen(filename, "r"); 144 - if (fileptr == NULL && errno != ENOENT) 145 - PRINT_ERROR((PROGNAME ": could not open %s (%s)\n", 146 - filename, strerror(errno))); 147 - free(filename); 148 - } 149 - 150 - if (fileptr == NULL) { 151 - /* couldn't open $HOME/.ratpoisonrc, fall back on 152 - * system config */ 153 - filename = xsprintf("%s/ratpoisonrc", SYSCONFDIR); 154 - 155 - fileptr = fopen(filename, "r"); 156 - if (fileptr == NULL && errno != ENOENT) 157 - PRINT_ERROR((PROGNAME ": could not open %s (%s)\n", 158 - filename, strerror(errno))); 159 - free(filename); 160 - } 161 - } 124 + config_dir = get_config_dir(); 125 + filename = xsprintf("%s/config", config_dir); 126 + fileptr = fopen(filename, "r"); 127 + if (fileptr == NULL && errno != ENOENT) 128 + PRINT_ERROR(("could not open %s (%s)\n", filename, 129 + strerror(errno))); 130 + free(config_dir); 131 + free(filename); 162 132 163 133 if (fileptr != NULL) { 164 134 set_close_on_exec(fileno(fileptr)); ··· 171 141 static int 172 142 bar_mkfifo(void) 173 143 { 174 - const char *homedir; 144 + char *config_dir; 175 145 176 - homedir = get_homedir(); 177 - if (!homedir) { 178 - PRINT_ERROR((PROGNAME ": no home directory!?\n")); 179 - return 0; 180 - } 146 + config_dir = get_config_dir(); 147 + rp_glob_screen.bar_fifo_path = xsprintf("%s/bar", config_dir); 148 + free(config_dir); 181 149 182 - rp_glob_screen.bar_fifo_path = xsprintf("%s/.ratpoison_bar", homedir); 183 150 unlink(rp_glob_screen.bar_fifo_path); 184 151 185 152 if (mkfifo(rp_glob_screen.bar_fifo_path, S_IRUSR|S_IWUSR) == -1) { ··· 318 285 /* Parse the arguments */ 319 286 myargv = argv; 320 287 while (1) { 321 - c = getopt_long(argc, argv, ratpoison_opts, ratpoison_longopts, 288 + c = getopt_long(argc, argv, sdorfehs_opts, sdorfehs_longopts, 322 289 NULL); 323 290 if (c == -1) 324 291 break; ··· 326 293 switch (c) { 327 294 case 'h': 328 295 print_help(); 329 - break; 330 - case 'v': 331 - print_version(); 332 296 break; 333 297 case 'c': 334 298 cmd = xrealloc(cmd, sizeof(char *) * (cmd_count + 1)); ··· 363 327 } 364 328 set_close_on_exec(ConnectionNumber(dpy)); 365 329 366 - /* Set ratpoison specific Atoms. */ 330 + /* Set our own specific Atoms. */ 367 331 rp_command = XInternAtom(dpy, "RP_COMMAND", False); 368 332 rp_command_request = XInternAtom(dpy, "RP_COMMAND_REQUEST", False); 369 333 rp_command_result = XInternAtom(dpy, "RP_COMMAND_RESULT", False); ··· 423 387 set_sig_handler(SIGHUP, hup_handler); 424 388 set_sig_handler(SIGCHLD, chld_handler); 425 389 426 - /* Add RATPOISON to the environment */ 427 - putenv(xsprintf("RATPOISON=%s", argv[0])); 428 - 429 - if (!bar_mkfifo()) 390 + if (bar_mkfifo() == -1) 430 391 return EXIT_FAILURE; 431 392 432 - /* Setup ratpoison's internal structures */ 393 + /* Setup our internal structures */ 433 394 init_defaults(); 434 395 init_window_stuff(); 435 396 init_xrandr(); ··· 449 410 if (read_startup_files(alt_rcfile) == -1) 450 411 return EXIT_FAILURE; 451 412 452 - /* Indicate to the user that ratpoison has booted. */ 413 + /* Indicate to the user that we have booted. */ 453 414 if (defaults.startup_message) 454 415 show_welcome_message(); 455 416
+4 -4
ratpoison.h sdorfehs.h
··· 1 1 /* 2 - * Standard header for ratpoison. 2 + * Standard header 3 3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it ··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_H 21 - #define _RATPOISON_H 1 20 + #ifndef _SDORFEHS_H 21 + #define _SDORFEHS_H 1 22 22 23 23 #include <stdlib.h> 24 24 #include <stdio.h> ··· 102 102 #include "utf8.h" 103 103 #include "util.h" 104 104 105 - #endif /* ! _RATPOISON_H */ 105 + #endif /* ! _SDORFEHS_H */
-58
ratpoisonrc
··· 1 - # This is a sample .ratpoisonrc file 2 - # Copyright (C) 2003, 2004 Shawn Betts 3 - # 4 - # Copying and distribution of this file, with or without modification, 5 - # are permitted in any medium without royalty provided the copyright 6 - 7 - # Set the prefix key to that of screen's default 8 - escape C-a 9 - 10 - # Gets rid of that ugly crosshairs default cursor 11 - # and set the background to black 12 - exec xsetroot -solid black -cursor_name left_ptr 13 - 14 - # Emulate screen by starting with a new xterm 15 - exec xterm 16 - 17 - # Bind e to our favorite editor 18 - bind e exec emacs 19 - 20 - # bind s to interactively run a surfraw query on freshmeat 21 - bind s colon exec xterm -e freshmeat 22 - 23 - # bind b (`b' for browse) to interactively ask for an URL to open 24 - bind b colon exec mozilla http://www. 25 - 26 - # Use the name of the program rather than the title in the window list 27 - defwinname name 28 - 29 - # bind M-! to store the current frame layout in slot #1 30 - bind M-exclam exec ratpoison -c "setenv fs1 `ratpoison -c 'fdump'`" 31 - 32 - #bind M-1 to restore the frame layout in slot #1 33 - bind M-1 exec ratpoison -c "frestore `ratpoison -c 'getenv fs1'`" 34 - 35 - # Do the same for slot #2 and bind it to M-@ and M-2, respectively. 36 - bind M-at exec ratpoison -c "setenv fs2 `ratpoison -c 'fdump'`" 37 - bind M-2 exec ratpoison -c "frestore `ratpoison -c 'getenv fs2'`" 38 - 39 - # Give ourselves another slot on M-# and M-3, respectively. 40 - bind M-numbersign exec ratpoison -c "setenv fs3 `ratpoison -c 'fdump'`" 41 - bind M-3 exec ratpoison -c "frestore `ratpoison -c 'getenv fs3'`" 42 - 43 - # Here's a hack from John Meacham: 44 - 45 - bind a exec ratpoison -d :0.0 -c "echo `date +'%r - %A %n %D - %B'` `cal | tail -n +2 | sed -e 's/^Su/\n\n Su/' -e 's/.*/ & /' -e \"s/\ $(date +%e)\ /\<$(date +%e)\>/\"`" 46 - 47 - # it produces output like the following in the message window, very handy: 48 - # +-----------------------+ 49 - # |05:05:24 PM - Tuesday | 50 - # | 09/09/03 - September| 51 - # | | 52 - # |Su Mo Tu We Th Fr Sa | 53 - # | 1 2 3 4 5 6 | 54 - # | 7 8< 9>10 11 12 13 | 55 - # |14 15 16 17 18 19 20 | 56 - # |21 22 23 24 25 26 27 | 57 - # |28 29 30 | 58 - # +-----------------------+
+1 -1
sbuf.c
··· 19 19 20 20 #include <string.h> 21 21 22 - #include "ratpoison.h" 22 + #include "sdorfehs.h" 23 23 #include "sbuf.h" 24 24 25 25 struct sbuf *
+3 -3
sbuf.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_SBUF_H 21 - #define _RATPOISON_SBUF_H 1 20 + #ifndef _SDORFEHS_SBUF_H 21 + #define _SDORFEHS_SBUF_H 1 22 22 23 23 #include <stdlib.h> 24 24 ··· 44 44 char *sbuf_printf_concat(struct sbuf *b, char *fmt,...); 45 45 void sbuf_chop(struct sbuf *b); 46 46 47 - #endif /* ! _RATPOISON_SBUF_H */ 47 + #endif /* ! _SDORFEHS_SBUF_H */
+2 -2
screen.c
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #include "ratpoison.h" 20 + #include "sdorfehs.h" 21 21 #include <string.h> 22 22 #include <X11/cursorfont.h> 23 23 ··· 293 293 /* 294 294 * Select on some events on the root window, if this fails, then there 295 295 * is already a WM running and the X Error handler will catch it, 296 - * terminating ratpoison. 296 + * terminating us. 297 297 */ 298 298 XSelectInput(dpy, RootWindow(dpy, screen_num), 299 299 PropertyChangeMask | ColormapChangeMask
+1 -1
split.c
··· 20 20 #include <unistd.h> 21 21 #include <string.h> 22 22 23 - #include "ratpoison.h" 23 + #include "sdorfehs.h" 24 24 25 25 #define VERTICALLY 0 26 26 #define HORIZONTALLY 1
+1 -1
utf8.c
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #include "ratpoison.h" 20 + #include "sdorfehs.h" 21 21 22 22 #include <langinfo.h> 23 23
+1 -1
util.c
··· 16 16 * Place, Suite 330, Boston, MA 02111-1307 USA. 17 17 */ 18 18 19 - #include "ratpoison.h" 19 + #include "sdorfehs.h" 20 20 21 21 #include <ctype.h> 22 22
+1 -1
window.c
··· 21 21 #include <stdlib.h> 22 22 #include <string.h> 23 23 24 - #include "ratpoison.h" 24 + #include "sdorfehs.h" 25 25 26 26 LIST_HEAD(rp_unmapped_window); 27 27 LIST_HEAD(rp_mapped_window);
+3 -3
window.h
··· 17 17 * Place, Suite 330, Boston, MA 02111-1307 USA. 18 18 */ 19 19 20 - #ifndef _RATPOISON_LIST_H 21 - #define _RATPOISON_LIST_H 1 20 + #ifndef _SDORFEHS_LIST_H 21 + #define _SDORFEHS_LIST_H 1 22 22 23 23 #include "sbuf.h" 24 24 ··· 56 56 57 57 void window_full_screen(rp_window *win); 58 58 59 - #endif /* ! _RATPOISON_LIST_H */ 59 + #endif /* ! _SDORFEHS_LIST_H */
+1 -1
xrandr.c
··· 19 19 20 20 #include <X11/extensions/Xrandr.h> 21 21 22 - #include "ratpoison.h" 22 + #include "sdorfehs.h" 23 23 24 24 static int xrandr_evbase; 25 25
+1 -1
xrandr.h
··· 19 19 #ifndef XRANDR_H 20 20 #define XRANDR_H 21 21 22 - #include "ratpoison.h" 22 + #include "sdorfehs.h" 23 23 24 24 void init_xrandr(void); 25 25 int xrandr_query_screen(int **outputs);