all repos — ryudo @ 404424f51836437cd0346a80acc7de77b19f6f81

the floatiling window manager that flows; fork of rio from plan9port

config.h: reorganize config.h and update documentation; key,c: make all keybinds except alt-tab optional
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmBFqXUACgkQO3+8IhRO
Y5g30Q/+KQ/AvGxEJBmjoUtlqdHBAbOB+fkFmpHjh3WbWbTpAqejKc3/nymFo/vL
kcO9cKxNJygvQXhRTaBZz2ksrPoznZaiJcfVCEKlmff7ZYZNhBvNz+QbqEAW7Lft
sl4ltCUEPotUT9BKqIp2qA4xkSzoYSgHuB5/71IEQsT7l93HkNxnkU5KW3mTVY9w
tc65CJoq2SnDmBJAcYIVWO6UX+7WoBSJD+kPu7LBR30JdGRPDkXW+qY7guxdYPeE
l0Tdfe2BPWBdppOlYNwSb8QaSJTdmSic7Q4IppfOpxLCkxtc5fFXVVg6xMcE8gJc
XN5MzEmUAMzKzrRT2OxakIuKR08OmNFxW9b6lIqXGX/iVNozmUW9bp77wTjiglkD
antvJGBM3K/PSLjYKctXEFOZgUt006j7ltbikZCDvSAJdd8sNhh00vC3jtjqQVcA
DkQZgVCP4PNPREOUIgMLFfDd8O/VyccqM1sqAXv5SfYjQxuQ5b10IjpCrkydLI5l
tKe2pn5p3YY/CT24P/DlVFOmhlDvs/8ZczdpVY0IE3TAScKplb/sPhgZQXf0K9qR
iHaQsmJw/uZZ6TE23RO9PXPIelyGbbQ52hO4e1p8M12HBrnr8JNeJGHdNxcfHsOH
V+VMgilqmIjiAk0/h4iK/uB5Q4q2S4VtEJV8XvNKlYZG3LIM+g8=
=AAbV
-----END PGP SIGNATURE-----
commit

404424f51836437cd0346a80acc7de77b19f6f81

parent

943b4fd82a7f5164fa792c65ec8da787296012e0

2 files changed, 264 insertions(+), 61 deletions(-)

jump to
M config.hconfig.h

@@ -1,20 +1,86 @@

-#define SHOLDCOL 0xC8C8C8 -#define HOLDCOL 0x444444 +/*********************** + * RYUDO CONFIGURATION * + **********************/ + +/*************** + * LOOK & FEEL * + **************/ + +/* Border colors */ #define SBORDERCOL 0x17736C #define BORDERCOL 0x000000 + +/* Window sweep border color */ #define GHOSTCOL 0x797979 + +/* Hold mode border colors -- if you don't use 9term you don't need to + * care what these are + */ +#define SHOLDCOL 0xC8C8C8 +#define HOLDCOL 0x444444 + +/* Border width in pixels */ #define BORDER 4 -/* Should be even */ +/* Gap size, in pixels, for pseudo-tiling. Should be even */ #define GAPSZ 4 +/* Menu border width and color */ #define MENUBORDER 0 #define MBORDERCOL 0x000000 + +/* Normal menu colors */ #define MENUFGCOL 0x797979 #define MENUBGCOL 0x000000 + +/* Selected menu colors */ #define SMENUFGCOL 0x000000 #define SMENUBGCOL 0x1F9B92 +// clang-format off + +/* List of fonts to try, in order, for rendering the menus. + * Remember the backslash at the end of non-terminating lines! + */ + +#define FONTLIST { \ + "*-lucidatypewriter-medium-*-12-*-75-*",\ + "lucm.latin1.9", \ + "blit", \ + "*-lucidatypewriter-bold-*-14-*-75-*", \ + "9x15bold", \ + "fixed", \ + "*", \ + 0 \ + } + +/* Names for the virtual desktops. You can define all 12, or only + * as many as you use. + * Remember the backslash at the end of non-terminating lines! + */ + +#define VIRTUALLIST {\ + "One", \ + "Two", \ + "Three", \ + "Four", \ + "Five", \ + "Six", \ + "Seven", \ + "Eight", \ + "Nine", \ + "Ten", \ + "Eleven", \ + "Twelve", \ + 0 \ +} + +// clang-format on + +/************ + * BEHAVIOR * + ***********/ + /* This sets the size ratio for windows spawned via keyboard or * center-snapped; CENTERNUM should be >= 2, so use 2/4 instead of 1/2 */

@@ -38,6 +104,30 @@ /* The summary and message to pass to the notifcation daeomon */

#define VIRTHEADER "virtual" #define VIRTMSG "[%s]" +// clang-format off + +/* List of window classes to spawn as sticky; + * Class values for currently open windows are conveniently shown in the last + * column of the 'xshove' command given with no arguments. + * Remember the backslash at the end of non-terminating lines! + */ + +/* You can remove/comment the entire macro to improve performance if you + * don't use this feature! + */ + +#define AUTOSTICK {\ + "XOsview", \ + "XClock", \ + 0 \ +} + +// clang-format on + +/*************** + * KEYBINDINGS * + **************/ + /* Modifier key and associated modifier bits; * Shift = (1<<0) * Lock = (1<<1)

@@ -48,11 +138,15 @@ * Mod3 = (1<<5)

* Mod4 = (1<<6) * Mod5 = (1<<7) */ + #define SHORTCUTMOD Mod4Mask #define MODBITS (1 << 6) /* Shortcut keys */ - +/* Any of these can be commented out/omitted if you want to free up + * your keyboard shortcuts for other things. Alt-tab is always bound. + */ + #define MAX_KEY XK_m #define ICON_KEY XK_i #define UNHIDE_KEY XK_u

@@ -61,9 +155,6 @@ #define RESIZE_KEY XK_r

#define DESTROY_KEY XK_d #define STICK_KEY XK_s #define ZOOM_KEY XK_z - -#define STICKYTOFRONT_KEY XK_t -#define STICKYTOBACK_KEY XK_b #define SNAPLEFT_KEY XK_h #define SNAPRIGHT_KEY XK_l

@@ -82,54 +173,6 @@ #define PREVVIRT_KEY XK_Left

#define LAUNCH_KEY XK_slash -// clang-format off - -/* List of window classes to spawn as sticky; - * Class values for currently open windows are conveniently shown in the last - * column of the 'xshove' command given with no arguments. - * Remember the backslash at the end of non-terminating lines! - */ - -#define AUTOSTICK {\ - "XOsview", \ - "XClock", \ - 0 \ -} - -/* List of fonts to try, in order, for rendering the menus. - * Remember the backslash at the end of non-terminating lines! - */ - -#define FONTLIST { \ - "*-lucidatypewriter-medium-*-12-*-75-*",\ - "lucm.latin1.9", \ - "blit", \ - "*-lucidatypewriter-bold-*-14-*-75-*", \ - "9x15bold", \ - "fixed", \ - "*", \ - 0 \ - } - -/* Names for the virtual desktops. You can define all 12, or only - * as many as you use. - * Remember the backslash at the end of non-terminating lines! - */ - -#define VIRTUALLIST {\ - "One", \ - "Two", \ - "Three", \ - "Four", \ - "Five", \ - "Six", \ - "Seven", \ - "Eight", \ - "Nine", \ - "Ten", \ - "Eleven", \ - "Twelve", \ - 0 \ -} - -// clang-format on +// ignore these for now -- this is a feature in development +#define STICKYTOFRONT_KEY XK_t +#define STICKYTOBACK_KEY XK_b
M key.ckey.c

@@ -30,26 +30,66 @@

void keysetup(void) { int i; int tabcode = XKeysymToKeycode(dpy, XK_Tab); +#ifdef DESTROY_KEY int dcode = XKeysymToKeycode(dpy, DESTROY_KEY); +#endif +#ifdef ICON_KEY int icode = XKeysymToKeycode(dpy, ICON_KEY); +#endif +#ifdef UNHIDE_KEY int ucode = XKeysymToKeycode(dpy, UNHIDE_KEY); +#endif +#ifdef MAX_KEY int mcode = XKeysymToKeycode(dpy, MAX_KEY); +#endif +#ifdef MOVE_KEY int vcode = XKeysymToKeycode(dpy, MOVE_KEY); +#endif +#ifdef RESIZE_KEY int rcode = XKeysymToKeycode(dpy, RESIZE_KEY); +#endif +#ifdef STICK_KEY int scode = XKeysymToKeycode(dpy, STICK_KEY); +#endif +#ifdef SNAPLEFT_KEY int hcode = XKeysymToKeycode(dpy, SNAPLEFT_KEY); +#endif +#ifdef SNAPRIGHT_KEY int lcode = XKeysymToKeycode(dpy, SNAPRIGHT_KEY); +#endif +#ifdef SNAPBOTTOM_KEY int jcode = XKeysymToKeycode(dpy, SNAPBOTTOM_KEY); +#endif +#ifdef SNAPTOP_KEY int kcode = XKeysymToKeycode(dpy, SNAPTOP_KEY); +#endif +#ifdef SNAPTOPLEFT_KEY int qcode = XKeysymToKeycode(dpy, SNAPTOPLEFT_KEY); +#endif +#ifdef SNAPBOTTOMLEFT_KEY int wcode = XKeysymToKeycode(dpy, SNAPBOTTOMLEFT_KEY); +#endif +#ifdef SNAPBOTTOMRIGHT_KEY int ocode = XKeysymToKeycode(dpy, SNAPBOTTOMRIGHT_KEY); +#endif +#ifdef SNAPTOPRIGHT_KEY int pcode = XKeysymToKeycode(dpy, SNAPTOPRIGHT_KEY); +#endif +#ifdef SNAPCENTER_KEY int ccode = XKeysymToKeycode(dpy, SNAPCENTER_KEY); +#endif +#ifdef LAUNCH_KEY int slcode = XKeysymToKeycode(dpy, LAUNCH_KEY); +#endif +#ifdef ZOOM_KEY int zcode = XKeysymToKeycode(dpy, ZOOM_KEY); +#endif +#ifdef NEXTVIRT_KEY int rightcode = XKeysymToKeycode(dpy, NEXTVIRT_KEY); +#endif +#ifdef PREVVIRT_KEY int leftcode = XKeysymToKeycode(dpy, PREVVIRT_KEY); +#endif #ifdef DEVEL int tcode = XKeysymToKeycode(dpy, STICKYTOFRONT_KEY); int bcode = XKeysymToKeycode(dpy, STICKYTOBACK_KEY);

@@ -64,6 +104,7 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#ifdef DESTROY_KEY XGrabKey( dpy, dcode,

@@ -72,6 +113,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef ICON_KEY XGrabKey( dpy, icode,

@@ -80,6 +123,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef UNHIDE_KEY XGrabKey( dpy, ucode,

@@ -88,6 +133,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef RESIZE_KEY XGrabKey( dpy, rcode,

@@ -96,6 +143,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef MOVE_KEY XGrabKey( dpy, vcode,

@@ -104,6 +153,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef MAX_KEY XGrabKey( dpy, mcode,

@@ -112,6 +163,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef STICK_KEY XGrabKey( dpy, scode,

@@ -120,6 +173,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPLEFT_KEY XGrabKey( dpy, hcode,

@@ -128,6 +183,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPRIGHT_KEY XGrabKey( dpy, lcode,

@@ -136,6 +193,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPBOTTOM_KEY XGrabKey( dpy, jcode,

@@ -144,6 +203,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPTOP_KEY XGrabKey( dpy, kcode,

@@ -152,6 +213,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPTOPLEFT_KEY XGrabKey( dpy, qcode,

@@ -160,6 +223,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPBOTTOMLEFT_KEY XGrabKey( dpy, wcode,

@@ -168,6 +233,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPBOTTOMRIGHT_KEY XGrabKey( dpy, ocode,

@@ -176,6 +243,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPTOPRIGHT_KEY XGrabKey( dpy, pcode,

@@ -184,6 +253,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef SNAPCENTER_KEY XGrabKey( dpy, ccode,

@@ -200,6 +271,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef PREVVIRT_KEY XGrabKey( dpy, leftcode,

@@ -208,6 +281,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef NEXTVIRT_KEY XGrabKey( dpy, rightcode,

@@ -216,6 +291,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef LAUNCH_KEY XGrabKey( dpy, slcode,

@@ -224,6 +301,8 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif +#ifdef ZOOM_KEY XGrabKey( dpy, zcode,

@@ -232,6 +311,7 @@ screens[i].root,

0, GrabModeSync, GrabModeAsync); +#endif XGrabKey( dpy, tabcode,

@@ -272,26 +352,66 @@ /*

* process key press here */ int tabcode = XKeysymToKeycode(dpy, XK_Tab); +#ifdef DESTROY_KEY int dcode = XKeysymToKeycode(dpy, DESTROY_KEY); +#endif +#ifdef ICON_KEY int icode = XKeysymToKeycode(dpy, ICON_KEY); +#endif +#ifdef UNHIDE_KEY int ucode = XKeysymToKeycode(dpy, UNHIDE_KEY); +#endif +#ifdef MAX_KEY int mcode = XKeysymToKeycode(dpy, MAX_KEY); +#endif +#ifdef MOVE_KEY int vcode = XKeysymToKeycode(dpy, MOVE_KEY); +#endif +#ifdef STICK_KEY int scode = XKeysymToKeycode(dpy, STICK_KEY); +#endif +#ifdef RESIZE_KEY int rcode = XKeysymToKeycode(dpy, RESIZE_KEY); +#endif +#ifdef LAUNCH_KEY int slcode = XKeysymToKeycode(dpy, LAUNCH_KEY); +#endif +#ifdef ZOOM_KEY int zcode = XKeysymToKeycode(dpy, ZOOM_KEY); +#endif +#ifdef SNAPLEFT_KEY int hcode = XKeysymToKeycode(dpy, SNAPLEFT_KEY); +#endif +#ifdef SNAPRIGHT_KEY int lcode = XKeysymToKeycode(dpy, SNAPRIGHT_KEY); +#endif +#ifdef SNAPBOTTOM_KEY int jcode = XKeysymToKeycode(dpy, SNAPBOTTOM_KEY); +#endif +#ifdef SNAPTOP_KEY int kcode = XKeysymToKeycode(dpy, SNAPTOP_KEY); +#endif +#ifdef SNAPTOPLEFT_KEY int qcode = XKeysymToKeycode(dpy, SNAPTOPLEFT_KEY); +#endif +#ifdef SNAPBOTTOMLEFT_KEY int wcode = XKeysymToKeycode(dpy, SNAPBOTTOMLEFT_KEY); +#endif +#ifdef SNAPBOTTOMRIGHT_KEY int ocode = XKeysymToKeycode(dpy, SNAPBOTTOMRIGHT_KEY); +#endif +#ifdef SNAPTOPRIGHT_KEY int pcode = XKeysymToKeycode(dpy, SNAPTOPRIGHT_KEY); +#endif +#ifdef SNAPCENTER_KEY int ccode = XKeysymToKeycode(dpy, SNAPCENTER_KEY); +#endif +#ifdef NEXTVIRT_KEY int rightcode = XKeysymToKeycode(dpy, NEXTVIRT_KEY); +#endif +#ifdef PREVVIRT_KEY int leftcode = XKeysymToKeycode(dpy, PREVVIRT_KEY); +#endif #ifdef DEVEL int tcode = XKeysymToKeycode(dpy, STICKYTOFRONT_KEY); int bcode = XKeysymToKeycode(dpy, STICKYTOBACK_KEY);

@@ -303,16 +423,27 @@

/* basic wm functionality */ if (e->keycode == tabcode && (e->state & Mod1Mask) == (1 << 3)) alttab(e->state & ShiftMask); +#ifdef DESTROY_KEY else if (e->keycode == dcode && (e->state & SHORTCUTMOD) == (MODBITS)) delete (current, 0); +#endif +#ifdef ICON_KEY else if (e->keycode == icode && (e->state & SHORTCUTMOD) == (MODBITS)) hide(current); +#endif +#ifdef UNHIDE_KEY else if (e->keycode == ucode && (e->state & SHORTCUTMOD) == (MODBITS)) unhide(0, 1); +#endif +#ifdef MOVE_KEY else if (e->keycode == vcode && (e->state & SHORTCUTMOD) == (MODBITS)) move(current, Button3); +#endif +#ifdef RESIZE_KEY else if (e->keycode == rcode && (e->state & SHORTCUTMOD) == (MODBITS)) reshape(current, Button3, sweep, 0); +#endif +#ifdef MAX_KEY else if (e->keycode == mcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -320,12 +451,18 @@ -BORDER,

-BORDER, ra.width + 2 * BORDER, ra.height + 2 * BORDER); +#endif +#ifdef STICK_KEY else if (e->keycode == scode && (e->state & SHORTCUTMOD) == (MODBITS)) stick(current); +#endif +#ifdef ZOOM_KEY else if (e->keycode == zcode && (e->state & SHORTCUTMOD) == (MODBITS)) zoom = !zoom; +#endif /* half snap */ +#ifdef SNAPLEFT_KEY else if (e->keycode == hcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -333,6 +470,8 @@ GAPSZ,

GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height - 2 * GAPSZ); +#endif +#ifdef SNAPRIGHT_KEY else if (e->keycode == lcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -340,6 +479,8 @@ ra.width / 2 + 0.5 * GAPSZ,

GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height - 2 * GAPSZ); +#endif +#ifdef SNAPBOTTOM_KEY else if (e->keycode == jcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -347,6 +488,8 @@ GAPSZ,

ra.height / 2 + 0.5 * GAPSZ, ra.width - 2 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif +#ifdef SNAPTOP_KEY else if (e->keycode == kcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -354,8 +497,10 @@ GAPSZ,

GAPSZ, ra.width - 2 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif /* quarter snap */ +#ifdef SNAPTOPLEFT_KEY else if (e->keycode == qcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -363,6 +508,8 @@ GAPSZ,

GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif +#ifdef SNAPBOTTOMLEFT_KEY else if (e->keycode == wcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -370,6 +517,8 @@ GAPSZ,

ra.height / 2 + 0.5 * GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif +#ifdef SNAPBOTTOMRIGHT_KEY else if (e->keycode == ocode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -377,6 +526,8 @@ ra.width / 2 + 0.5 * GAPSZ,

ra.height / 2 + 0.5 * GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif +#ifdef SNAPTOPRIGHT_KEY else if (e->keycode == pcode && (e->state & SHORTCUTMOD) == (MODBITS)) quickreshape( current,

@@ -384,8 +535,10 @@ ra.width / 2 + 0.5 * GAPSZ,

GAPSZ, ra.width / 2 - 1.5 * GAPSZ, ra.height / 2 - 1.5 * GAPSZ); +#endif /* center snap */ +#ifdef CENTERSNAP_KEY else if (e->keycode == ccode && (e->state & SHORTCUTMOD) == (MODBITS)) { if ((e->state & ShiftMask) == (1 << 0)) { #ifdef CENTERVMAX

@@ -401,6 +554,7 @@ centerclient(current, ra, 0);

#endif } } +#endif #ifdef DEVEL /* manage autostuck windows */

@@ -411,7 +565,8 @@ stickystack(0);

#endif /* launch */ - if (e->keycode == slcode && (e->state & SHORTCUTMOD) == (MODBITS)) { +#ifdef LAUNCH_KEY + else if (e->keycode == slcode && (e->state & SHORTCUTMOD) == (MODBITS)) { kbLaunch = 1; if (fork() == 0) { close(ConnectionNumber(dpy));

@@ -431,21 +586,26 @@ execlp("xterm", "xterm", "-ut", (char*)0);

perror("ryudo: exec urxvt/9term/xterm failed"); } } +#endif /* switch virts */ - if (e->keycode == rightcode && (e->state & SHORTCUTMOD) == (MODBITS)) +#ifdef NEXTVIRT_KEY + else if (e->keycode == rightcode && (e->state & SHORTCUTMOD) == (MODBITS)) if (numvirtuals > 1) if (virt < numvirtuals - 1) switch_to(virt + 1); else switch_to(0); +#endif - if (e->keycode == leftcode && (e->state & SHORTCUTMOD) == (MODBITS)) +#ifdef PREVVIRT_KEY + else if (e->keycode == leftcode && (e->state & SHORTCUTMOD) == (MODBITS)) if (numvirtuals > 1) if (virt > 0) switch_to(virt - 1); else switch_to(numvirtuals - 1); +#endif XAllowEvents(dpy, SyncKeyboard, e->time); }