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
···29#include <X11/extensions/XTest.h>
30#include <sys/ioctl.h>
3132-#include "ratpoison.h"
3334/* arg_REST and arg_SHELLCMD eat the rest of the input. */
35enum argtype {
···3194 show_frame_message(defaults.resize_fmt);
3195 read_key(&c, &mod, buffer, sizeof(buffer));
31963197- /* Convert the mask to be compatible with ratpoison. */
3198 mod = x11_mask_to_rp_mask(mod);
31993200 for (binding = resize_bindings; binding->action; binding++) {
···29#include <X11/extensions/XTest.h>
30#include <sys/ioctl.h>
3132+#include "sdorfehs.h"
3334/* arg_REST and arg_SHELLCMD eat the rest of the input. */
35enum argtype {
···3194 show_frame_message(defaults.resize_fmt);
3195 read_key(&c, &mod, buffer, sizeof(buffer));
31963197+ /* Convert the mask to be compatible with us. */
3198 mod = x11_mask_to_rp_mask(mod);
31993200 for (binding = resize_bindings; binding->action; binding++) {
+4-4
actions.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_ACTIONS_H
21-#define _RATPOISON_ACTIONS_H 1
2223-#include "ratpoison.h"
2425/* The structure returned by a command. */
26typedef struct cmdret {
···44rp_action *find_keybinding(KeySym keysym, unsigned int state, rp_keymap *map);
45rp_action *find_keybinding_by_action(char *action, rp_keymap *map);
4647-#endif /* ! _RATPOISON_ACTIONS_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_ACTIONS_H
21+#define _SDORFEHS_ACTIONS_H 1
2223+#include "sdorfehs.h"
2425/* The structure returned by a command. */
26typedef struct cmdret {
···44rp_action *find_keybinding(KeySym keysym, unsigned int state, rp_keymap *map);
45rp_action *find_keybinding_by_action(char *action, rp_keymap *map);
4647+#endif /* ! _SDORFEHS_ACTIONS_H */
···1/*
2- * communications.c -- Send commands to a running copy of ratpoison.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···2526#include <string.h>
2728-#include "ratpoison.h"
2930-/* Sending commands to ratpoison */
31static int
32receive_command_result(Window w)
33{
···1/*
2+ * communications.c -- Send commands to a running copy of sdorfehs.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···2526#include <string.h>
2728+#include "sdorfehs.h"
2930+/* Sending commands to us from another process */
31static int
32receive_command_result(Window w)
33{
+4-4
communications.h
···1/*
2- * communications.h -- Send commands to a running copy of ratpoison.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_COMMUNICATIONS_H
21-#define _RATPOISON_COMMUNICATIONS_H 1
2223int send_command(unsigned char interactive, unsigned char *cmd);
2425-#endif /* ! _RATPOISON_COMMUNICATIONS_H */
···1/*
2+ * communications.h -- Send commands to a running copy of sdorfehs.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_COMMUNICATIONS_H
21+#define _SDORFEHS_COMMUNICATIONS_H 1
2223int send_command(unsigned char interactive, unsigned char *cmd);
2425+#endif /* ! _SDORFEHS_COMMUNICATIONS_H */
+1-2
completions.c
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819-#define _GNU_SOURCE
20#include <string.h>
2122-#include "ratpoison.h"
23#include "completions.h"
2425rp_completions *
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18019#include <string.h>
2021+#include "sdorfehs.h"
22#include "completions.h"
2324rp_completions *
+3-3
completions.h
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819-#ifndef _RATPOISON_COMPLETIONS_H
20-#define _RATPOISON_COMPLETIONS_H 1
2122char *completions_complete(rp_completions * c, char *partial, int direction);
23rp_completions *completions_new(completion_fn list_fn,
24 enum completion_styles style);
25void completions_free(rp_completions * c);
2627-#endif /* ! _RATPOISON_COMPLETIONS_H */
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819+#ifndef _SDORFEHS_COMPLETIONS_H
20+#define _SDORFEHS_COMPLETIONS_H 1
2122char *completions_complete(rp_completions * c, char *partial, int direction);
23rp_completions *completions_new(completion_fn list_fn,
24 enum completion_styles style);
25void completions_free(rp_completions * c);
2627+#endif /* ! _SDORFEHS_COMPLETIONS_H */
+9-9
config.h
···1/*
2- * Config file for ratpoison. Edit these values and recompile.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_CONF_H
21-#define _RATPOISON_CONF_H 1
2223#include "data.h"
24#include "actions.h"
2526-#define PROGNAME "ratpoison"
27-#define VERSION "20190816"
2829/* Enter command mode with Control+T by default. */
30#define KEY_PREFIX XK_t
···94#define MAX_LINK_DEPTH 16
9596/*
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
99 * messages.
100 */
101#define IGNORE_BADWINDOW 1
···107#define MAX_HISTORY_SIZE 100
108109/* The default filename in which to store the history */
110-#define HISTORY_FILE ".ratpoison_history"
111112/* The name of the root keymap */
113#define ROOT_KEYMAP "root"
···118/* The default font */
119#define DEFAULT_XFT_FONT "monospace:size=12"
120121-#endif /* !_ _RATPOISON_CONF_H */
···1/*
2+ * Config file. Edit these values and recompile.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_CONF_H
21+#define _SDORFEHS_CONF_H 1
2223#include "data.h"
24#include "actions.h"
2526+#define PROGNAME "sdorfehs"
27+#define VERSION "20190822"
2829/* Enter command mode with Control+T by default. */
30#define KEY_PREFIX XK_t
···94#define MAX_LINK_DEPTH 16
9596/*
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 * messages.
100 */
101#define IGNORE_BADWINDOW 1
···107#define MAX_HISTORY_SIZE 100
108109/* The default filename in which to store the history */
110+#define HISTORY_FILE "history"
111112/* The name of the root keymap */
113#define ROOT_KEYMAP "root"
···118/* The default font */
119#define DEFAULT_XFT_FONT "monospace:size=12"
120121+#endif /* !_ _SDORFEHS_CONF_H */
+3-3
data.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_DATA_H
21-#define _RATPOISON_DATA_H
2223#include "linkedlist.h"
24#include "number.h"
···476 int len;
477};
478479-#endif /* _RATPOISON_DATA_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_DATA_H
21+#define _SDORFEHS_DATA_H
2223#include "linkedlist.h"
24#include "number.h"
···476 int len;
477};
478479+#endif /* _SDORFEHS_DATA_H */
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819-#ifndef _RATPOISON_EDITOR_H
20-#define _RATPOISON_EDITOR_H 1
2122#include "utf8.h"
23···39edit_status execute_edit_action(rp_input_line *line, KeySym ch,
40 unsigned int modifier, char *keysym_buf);
4142-#endif /* ! _RATPOISON_EDITOR_H */
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819+#ifndef _SDORFEHS_EDITOR_H
20+#define _SDORFEHS_EDITOR_H 1
2122#include "utf8.h"
23···39edit_status execute_edit_action(rp_input_line *line, KeySym ch,
40 unsigned int modifier, char *keysym_buf);
4142+#endif /* ! _SDORFEHS_EDITOR_H */
+2-2
events.c
···1/*
2- * Ratpoison X events
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···35#include <sys/time.h>
36#include <sys/wait.h>
3738-#include "ratpoison.h"
3940/*
41 * The event currently being processed. Mostly used in functions from action.c
···1/*
2+ * X events
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···35#include <sys/time.h>
36#include <sys/wait.h>
3738+#include "sdorfehs.h"
3940/*
41 * The event currently being processed. Mostly used in functions from action.c
+3-3
events.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_EVENTS_H
21-#define _RATPOISON_EVENTS_H 1
2223void listen_for_events(void);
24void show_rudeness_msg(rp_window *win, int raised);
2526-#endif /* _RATPOISON_EVENTS_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_EVENTS_H
21+#define _SDORFEHS_EVENTS_H 1
2223void listen_for_events(void);
24void show_rudeness_msg(rp_window *win, int raised);
2526+#endif /* _SDORFEHS_EVENTS_H */
+1-1
format.c
···20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23-#include "ratpoison.h"
2425/* Function prototypes for format char expanders. */
26#define RP_FMT(fn) static void fmt_ ## fn (rp_window_elem *elem, struct sbuf *buf)
···20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23+#include "sdorfehs.h"
2425/* Function prototypes for format char expanders. */
26#define RP_FMT(fn) static void fmt_ ## fn (rp_window_elem *elem, struct sbuf *buf)
+3-3
format.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_FORMAT_H
21-#define _RATPOISON_FORMAT_H 1
2223void format_string(char *fmt, rp_window_elem *win_elem, struct sbuf *buffer);
2425-#endif /* _RATPOISON_FORMAT_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_FORMAT_H
21+#define _SDORFEHS_FORMAT_H 1
2223void format_string(char *fmt, rp_window_elem *win_elem, struct sbuf *buffer);
2425+#endif /* _SDORFEHS_FORMAT_H */
+1-1
frame.c
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#include "ratpoison.h"
2122#include <string.h>
23
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#include "sdorfehs.h"
2122#include <string.h>
23
+53-1
globals.c
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819-#include "ratpoison.h"
2021#include <sys/types.h>
22#include <sys/wait.h>
···26#include <pwd.h>
27#include <signal.h>
28#include <unistd.h>
02930/*
31 * Several systems seem not to have WAIT_ANY defined, so define it if it isn't.
···463 }
464465 return homedir;
000000000000000000000000000000000000000000000000000466}
467468void
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819+#include "sdorfehs.h"
2021#include <sys/types.h>
22#include <sys/wait.h>
···26#include <pwd.h>
27#include <signal.h>
28#include <unistd.h>
29+#include <dirent.h>
3031/*
32 * Several systems seem not to have WAIT_ANY defined, so define it if it isn't.
···464 }
465466 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;
518}
519520void
+3-2
globals.h
···159 */
160extern int ignore_badwindow;
161162-/* Arguments passed to ratpoison. */
163extern char **myargv;
164165/* Keeps track of which mod mask each modifier is under. */
166extern struct modifier_info rp_modifier_info;
167168/*
169- * nonzero if an alarm signal was raised. This means ratpoison should hide its
170 * popup windows.
171 */
172extern int alarm_signalled;
···222void set_close_on_exec(int fd);
223void read_rc_file(FILE *file);
224const char *get_homedir(void);
0225void clean_up(void);
226227void register_atom(Atom *a, char *name);
···159 */
160extern int ignore_badwindow;
161162+/* Arguments passed at startup. */
163extern char **myargv;
164165/* Keeps track of which mod mask each modifier is under. */
166extern struct modifier_info rp_modifier_info;
167168/*
169+ * nonzero if an alarm signal was raised. This means we should hide our
170 * popup windows.
171 */
172extern int alarm_signalled;
···222void set_close_on_exec(int fd);
223void read_rc_file(FILE *file);
224const char *get_homedir(void);
225+char *get_config_dir(void);
226void clean_up(void);
227228void register_atom(Atom *a, char *name);
+1-1
group.c
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819-#include "ratpoison.h"
2021#include <string.h>
22
···16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
1819+#include "sdorfehs.h"
2021#include <string.h>
22
···20 * A hook is simply a list of strings that get passed to command() in sequence.
21 */
2223-#include "ratpoison.h"
2425#include <string.h>
26
···20 * A hook is simply a list of strings that get passed to command() in sequence.
21 */
2223+#include "sdorfehs.h"
2425#include <string.h>
26
+1-1
input.c
···26#include <X11/Xutil.h>
27#include <X11/XKBlib.h>
2829-#include "ratpoison.h"
3031/*
32 * Convert an X11 modifier mask to the rp modifier mask equivalent, as best it
···26#include <X11/Xutil.h>
27#include <X11/XKBlib.h>
2829+#include "sdorfehs.h"
3031/*
32 * Convert an X11 modifier mask to the rp modifier mask equivalent, as best it
+3-3
input.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_INPUT_H
21-#define _RATPOISON_INPUT_H 1
2223char *keysym_to_string(KeySym keysym, unsigned int modifier);
24int cook_keycode(XKeyEvent *ev, KeySym *keysym, unsigned int *mod,
···3738void init_xkb(void);
3940-#endif /* ! _RATPOISON_INPUT_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_INPUT_H
21+#define _SDORFEHS_INPUT_H 1
2223char *keysym_to_string(KeySym keysym, unsigned int modifier);
24int cook_keycode(XKeyEvent *ev, KeySym *keysym, unsigned int *mod,
···3738void init_xkb(void);
3940+#endif /* ! _SDORFEHS_INPUT_H */
+2-2
linkedlist.h
···20 * Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
2223-#ifndef _RATPOISON_LINKLIST_H
24-#define _RATPOISON_LINKLIST_H
2526#include <string.h>
27
···20 * Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
2223+#ifndef _SDORFEHS_LINKLIST_H
24+#define _SDORFEHS_LINKLIST_H
2526#include <string.h>
27
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_MANAGE_H
21-#define _RATPOISON_MANAGE_H 1
2223#include "data.h"
24···55void hide_others(rp_window *win);
56void hide_vscreen_windows(rp_vscreen *v);
5758-#endif /* ! _RATPOISION_MANAGE_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_MANAGE_H
21+#define _SDORFEHS_MANAGE_H 1
2223#include "data.h"
24···55void hide_others(rp_window *win);
56void hide_vscreen_windows(rp_vscreen *v);
5758+#endif /* ! _SDORFEHS_MANAGE_H */
+6-6
messages.h
···1/*
2- * Ratpoison messages.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_MESSAGES_H
21-#define _RATPOISON_MESSAGES_H 1
2223#define MESSAGE_NO_OTHER_WINDOW "No other window"
24#define MESSAGE_NO_OTHER_FRAME "No other frame"
25#define MESSAGE_NO_MANAGED_WINDOWS "No managed windows"
26-#define MESSAGE_UNKNOWN_COMMAND "unknown command '%s'"
27#define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)"
2829#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)"
···48#define MESSAGE_PROMPT_SELECT_VAR "Variable: "
49#define MESSAGE_PROMPT_VAR_VALUE "Value: "
5051-#define MESSAGE_WELCOME PROGNAME " " VERSION " - press \"%s %s\" for help"
5253#define EMPTY_FRAME_MESSAGE "Current Frame"
5455-#endif /* ! _RATPOISON_MESSAGES_H */
···1/*
2+ * Messages.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_MESSAGES_H
21+#define _SDORFEHS_MESSAGES_H 1
2223#define MESSAGE_NO_OTHER_WINDOW "No other window"
24#define MESSAGE_NO_OTHER_FRAME "No other frame"
25#define MESSAGE_NO_MANAGED_WINDOWS "No managed windows"
26+#define MESSAGE_UNKNOWN_COMMAND "Unknown command '%s'"
27#define MESSAGE_WINDOW_INFORMATION "This is window %d (%s)"
2829#define MESSAGE_RAISE_TRANSIENT "Raise request from transient window %d (%s)"
···48#define MESSAGE_PROMPT_SELECT_VAR "Variable: "
49#define MESSAGE_PROMPT_VAR_VALUE "Value: "
5051+#define MESSAGE_WELCOME "Welcome to " PROGNAME " - press \"%s %s\" for help"
5253#define EMPTY_FRAME_MESSAGE "Current Frame"
5455+#endif /* ! _SDORFEHS_MESSAGES_H */
+1-1
number.c
···20#include <stdlib.h>
21#include <stdio.h>
2223-#include "ratpoison.h"
2425/* Keep track of a set of numbers. For frames and windows. */
26struct numset {
···20#include <stdlib.h>
21#include <stdio.h>
2223+#include "sdorfehs.h"
2425/* Keep track of a set of numbers. For frames and windows. */
26struct numset {
+3-3
number.h
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_NUMBER_H
21-#define _RATPOISON_NUMBER_H 1
2223struct numset;
24···28int numset_request(struct numset *ns);
29int numset_add_num(struct numset *ns, int n);
3031-#endif /* ! _RATPOISON_NUMBER_H */
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_NUMBER_H
21+#define _SDORFEHS_NUMBER_H 1
2223struct numset;
24···28int numset_request(struct numset *ns);
29int numset_add_num(struct numset *ns, int n);
3031+#endif /* ! _SDORFEHS_NUMBER_H */
+27-30
ratpoison.1
sdorfehs.1
···21.\" [2] http://mdocml.bsd.lv/
22.\" [3] http://mdocml.bsd.lv/mdoc.7.html
23.\"
24-.Dd Aug 22, 2017
25-.Dt RATPOISON 1
26.Os
27.Sh NAME
28-.Nm ratpoison
29.Nd window manager without mouse dependency
30.Sh SYNOPSIS
31.Nm
32-.Op Fl hv
33.Nm
34.Op Fl d Ar dpy
35.Op Fl s Ar num
···41.Fl c Ar command Op Fl c Ar command ...
42.Sh DESCRIPTION
43.Nm
44-is a Window Manager without fat library dependencies, fancy graphics or
45-rat dependence.
46.Pp
47The screen can be split into non-overlapping frames.
48All windows are kept maximized inside their frames.
49.Pp
50-All interaction with the window manager is done through
51-keystrokes.
52.Nm
53has a prefix map to minimize key clobbering.
54.Pp
55The options are as follows:
56.Bl -tag -width Bs
57.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.
000061Do not forget to quote the command if it contains spaces.
62For example:
63.Dl Nm Fl c Qq Ar "echo hello world"
···68If this is not given,
69.Nm
70will try
71-.Pa $HOME/.ratpoisonrc
72-and if that does not exist
73-.Pa /etc/ratpoisonrc
74and execute each command when starting up.
75.It Fl h , Fl \-help
76Show summary of options.
···85like prompting for missing arguments and things like that.
86.It Fl s , Fl \-screen Ar number
87Only use the specified screen.
88-.It Fl v , Fl \-version
89-Show version of program.
90.El
91.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
094.Ic C\-t
95(Control\-t).
96Some important default key bindings:
···116.It Ic C\-t Q
117Make the current frame the only one
118.It Ic C\-t \&:
119-Execute a ratpoison command
00120.El
121.Pp
122Further default key bindings can be found in parentheses after the
···180If there isn't a window in the current frame, it banishes the rat cursor
181to the lower right corner of the frame.
182.It Ic chdir Op Ar directory
183-If the optional argument is given, change the current directory
184-of
185.Nm
186to
187.Ar directory .
···203current one.
204(That means the previous window belonging to another type of application
205than the current one.)
206-.It Ic colon Ar ratpoison\-command Pq Ic C\-t \&:
207Execute
208-.Ar ratpoison\-command
209interactively.
210(i.e. ask for possible missing arguments.)
211.It Ic cother
···1188.Li title .
1189.El
1190.Sh FILES
1191-.Bl -tag -width "%%sysconfdir%%/ratpoisonrc" -compact
1192-.It Pa ~/.ratpoisonrc
1193Configuration 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.El
1199.Sh EXIT STATUS
1200.Ex -std
1201.Sh AUTHORS
1202.An -nosplit
1203.Nm
1204-was originally written by
1205.An Shawn Betts Aq Mt sabetts@gmail.com .
···21.\" [2] http://mdocml.bsd.lv/
22.\" [3] http://mdocml.bsd.lv/mdoc.7.html
23.\"
24+.Dd Aug 22, 2019
25+.Dt SDORFEHS 1
26.Os
27.Sh NAME
28+.Nm sdorfehs
29.Nd window manager without mouse dependency
30.Sh SYNOPSIS
31.Nm
32+.Op Fl h
33.Nm
34.Op Fl d Ar dpy
35.Op Fl s Ar num
···41.Fl c Ar command Op Fl c Ar command ...
42.Sh DESCRIPTION
43.Nm
44+is a window manager without fat library dependencies, fancy graphics or
45+dependence on a mouse.
46.Pp
47The screen can be split into non-overlapping frames.
48All windows are kept maximized inside their frames.
49.Pp
50+All interaction with the window manager is done through keystrokes.
051.Nm
52has a prefix map to minimize key clobbering.
53.Pp
54The options are as follows:
55.Bl -tag -width Bs
56.It Fl c , Fl \-command
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.
64Do not forget to quote the command if it contains spaces.
65For example:
66.Dl Nm Fl c Qq Ar "echo hello world"
···71If this is not given,
72.Nm
73will try
74+.Pa $HOME/.config/sdorfehs/config
0075and execute each command when starting up.
76.It Fl h , Fl \-help
77Show summary of options.
···86like prompting for missing arguments and things like that.
87.It Fl s , Fl \-screen Ar number
88Only use the specified screen.
0089.El
90.Sh KEY BINDINGS
91+To avoid conflicts with other programs, all default
92+.Nm
93+key bindings start with an escape key which, by default, is
94.Ic C\-t
95(Control\-t).
96Some important default key bindings:
···116.It Ic C\-t Q
117Make the current frame the only one
118.It Ic C\-t \&:
119+Execute a
120+.Nm
121+command
122.El
123.Pp
124Further default key bindings can be found in parentheses after the
···182If there isn't a window in the current frame, it banishes the rat cursor
183to the lower right corner of the frame.
184.It Ic chdir Op Ar directory
185+If the optional argument is given, change the current directory of
0186.Nm
187to
188.Ar directory .
···204current one.
205(That means the previous window belonging to another type of application
206than the current one.)
207+.It Ic colon Ar sdorfehs\-command Pq Ic C\-t \&:
208Execute
209+.Ar sdorfehs\-command
210interactively.
211(i.e. ask for possible missing arguments.)
212.It Ic cother
···1189.Li title .
1190.El
1191.Sh FILES
1192+.Bl -tag -compact
1193+.It Pa ~/.config/sdorfehs/config
1194Configuration file read at startup time, if present.
00001195.El
1196.Sh EXIT STATUS
1197.Ex -std
1198.Sh AUTHORS
1199.An -nosplit
1200.Nm
1201+is derived from ratpoison originally written by
1202.An Shawn Betts Aq Mt sabetts@gmail.com .
+26-65
ratpoison.c
sdorfehs.c
···34#include <sys/wait.h>
35#include <ctype.h>
3637-#include "ratpoison.h"
3839/* Command line options */
40-static struct option ratpoison_longopts[] =
41 {{"help", no_argument, 0, 'h'},
42 {"interactive", no_argument, 0, 'i'},
43 {"version", no_argument, 0, 'v'},
···47 {0, 0, 0, 0},
48};
4950-static char ratpoison_opts[] = "hvic:d:s:f:";
5152static void
53sighandler(int signum UNUSED)
···97}
9899static 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
109print_help(void)
110{
111 printf("Help for %s %s\n\n", PROGNAME, VERSION);
112 printf("-h, --help Display this help screen\n");
113- printf("-v, --version Display the version\n");
114 printf("-d, --display <dpy> Set the X display to use\n");
115 printf("-c, --command <cmd> Send " PROGNAME " a colon-command\n");
116 printf("-i, --interactive Execute commands in interactive mode\n");
···123read_startup_files(const char *alt_rcfile)
124{
125 FILE *fileptr = NULL;
0126127- 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;
136137- /* 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- }
162163 if (fileptr != NULL) {
164 set_close_on_exec(fileno(fileptr));
···171static int
172bar_mkfifo(void)
173{
174- const char *homedir;
175176- homedir = get_homedir();
177- if (!homedir) {
178- PRINT_ERROR((PROGNAME ": no home directory!?\n"));
179- return 0;
180- }
181182- rp_glob_screen.bar_fifo_path = xsprintf("%s/.ratpoison_bar", homedir);
183 unlink(rp_glob_screen.bar_fifo_path);
184185 if (mkfifo(rp_glob_screen.bar_fifo_path, S_IRUSR|S_IWUSR) == -1) {
···318 /* Parse the arguments */
319 myargv = argv;
320 while (1) {
321- c = getopt_long(argc, argv, ratpoison_opts, ratpoison_longopts,
322 NULL);
323 if (c == -1)
324 break;
···326 switch (c) {
327 case 'h':
328 print_help();
329- break;
330- case 'v':
331- print_version();
332 break;
333 case 'c':
334 cmd = xrealloc(cmd, sizeof(char *) * (cmd_count + 1));
···363 }
364 set_close_on_exec(ConnectionNumber(dpy));
365366- /* Set ratpoison specific Atoms. */
367 rp_command = XInternAtom(dpy, "RP_COMMAND", False);
368 rp_command_request = XInternAtom(dpy, "RP_COMMAND_REQUEST", False);
369 rp_command_result = XInternAtom(dpy, "RP_COMMAND_RESULT", False);
···423 set_sig_handler(SIGHUP, hup_handler);
424 set_sig_handler(SIGCHLD, chld_handler);
425426- /* Add RATPOISON to the environment */
427- putenv(xsprintf("RATPOISON=%s", argv[0]));
428-429- if (!bar_mkfifo())
430 return EXIT_FAILURE;
431432- /* Setup ratpoison's internal structures */
433 init_defaults();
434 init_window_stuff();
435 init_xrandr();
···449 if (read_startup_files(alt_rcfile) == -1)
450 return EXIT_FAILURE;
451452- /* Indicate to the user that ratpoison has booted. */
453 if (defaults.startup_message)
454 show_welcome_message();
455
···34#include <sys/wait.h>
35#include <ctype.h>
3637+#include "sdorfehs.h"
3839/* Command line options */
40+static struct option sdorfehs_longopts[] =
41 {{"help", no_argument, 0, 'h'},
42 {"interactive", no_argument, 0, 'i'},
43 {"version", no_argument, 0, 'v'},
···47 {0, 0, 0, 0},
48};
4950+static char sdorfehs_opts[] = "hvic:d:s:f:";
5152static void
53sighandler(int signum UNUSED)
···97}
9899static void
000000000100print_help(void)
101{
102 printf("Help for %s %s\n\n", PROGNAME, VERSION);
103 printf("-h, --help Display this help screen\n");
0104 printf("-d, --display <dpy> Set the X display to use\n");
105 printf("-c, --command <cmd> Send " PROGNAME " a colon-command\n");
106 printf("-i, --interactive Execute commands in interactive mode\n");
···113read_startup_files(const char *alt_rcfile)
114{
115 FILE *fileptr = NULL;
116+ char *config_dir, *filename;
117118+ 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+ }
0000123124+ 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);
00000000000000000132133 if (fileptr != NULL) {
134 set_close_on_exec(fileno(fileptr));
···141static int
142bar_mkfifo(void)
143{
144+ char *config_dir;
145146+ config_dir = get_config_dir();
147+ rp_glob_screen.bar_fifo_path = xsprintf("%s/bar", config_dir);
148+ free(config_dir);
001490150 unlink(rp_glob_screen.bar_fifo_path);
151152 if (mkfifo(rp_glob_screen.bar_fifo_path, S_IRUSR|S_IWUSR) == -1) {
···285 /* Parse the arguments */
286 myargv = argv;
287 while (1) {
288+ c = getopt_long(argc, argv, sdorfehs_opts, sdorfehs_longopts,
289 NULL);
290 if (c == -1)
291 break;
···293 switch (c) {
294 case 'h':
295 print_help();
000296 break;
297 case 'c':
298 cmd = xrealloc(cmd, sizeof(char *) * (cmd_count + 1));
···327 }
328 set_close_on_exec(ConnectionNumber(dpy));
329330+ /* Set our own specific Atoms. */
331 rp_command = XInternAtom(dpy, "RP_COMMAND", False);
332 rp_command_request = XInternAtom(dpy, "RP_COMMAND_REQUEST", False);
333 rp_command_result = XInternAtom(dpy, "RP_COMMAND_RESULT", False);
···387 set_sig_handler(SIGHUP, hup_handler);
388 set_sig_handler(SIGCHLD, chld_handler);
389390+ if (bar_mkfifo() == -1)
000391 return EXIT_FAILURE;
392393+ /* Setup our internal structures */
394 init_defaults();
395 init_window_stuff();
396 init_xrandr();
···410 if (read_startup_files(alt_rcfile) == -1)
411 return EXIT_FAILURE;
412413+ /* Indicate to the user that we have booted. */
414 if (defaults.startup_message)
415 show_welcome_message();
416
+4-4
ratpoison.h
sdorfehs.h
···1/*
2- * Standard header for ratpoison.
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#ifndef _RATPOISON_H
21-#define _RATPOISON_H 1
2223#include <stdlib.h>
24#include <stdio.h>
···102#include "utf8.h"
103#include "util.h"
104105-#endif /* ! _RATPOISON_H */
···1/*
2+ * Standard header
3 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#ifndef _SDORFEHS_H
21+#define _SDORFEHS_H 1
2223#include <stdlib.h>
24#include <stdio.h>
···102#include "utf8.h"
103#include "util.h"
104105+#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-# +-----------------------+
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920-#include "ratpoison.h"
21#include <string.h>
22#include <X11/cursorfont.h>
23···293 /*
294 * Select on some events on the root window, if this fails, then there
295 * is already a WM running and the X Error handler will catch it,
296- * terminating ratpoison.
297 */
298 XSelectInput(dpy, RootWindow(dpy, screen_num),
299 PropertyChangeMask | ColormapChangeMask
···17 * Place, Suite 330, Boston, MA 02111-1307 USA.
18 */
1920+#include "sdorfehs.h"
21#include <string.h>
22#include <X11/cursorfont.h>
23···293 /*
294 * Select on some events on the root window, if this fails, then there
295 * is already a WM running and the X Error handler will catch it,
296+ * terminating us.
297 */
298 XSelectInput(dpy, RootWindow(dpy, screen_num),
299 PropertyChangeMask | ColormapChangeMask