sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit c3efbc9516ecc187d7ae1965f4e49290ffda9a59
parent 7c4c42e762256a08155e2d1b33c8eaf037333ebd
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Sun, 23 Jun 2013 14:22:49 +0200

Handle empty sequence elements via '_'

Diffstat:
MREADME.md | 10++++++++++
Mparse.c | 2++
Mparse.h | 1+
Msxhkd.1 | 2++
4 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -52,6 +52,8 @@ The hotkey and the command may contain sequences of the form `{STRING_1,…,STRI In addition, the sequences can contain ranges of the form `A-Z` where *A* and *Z* are alphanumeric characters. +The underscore character represents an empty sequence element. + What is actually executed is `SHELL -c COMMAND`, which means you can use environment variables in `COMMAND`. `SHELL` will be the content of the first defined environment variable in the following list: `SXHKD_SHELL`, `SHELL`. @@ -95,12 +97,20 @@ If no configuration file is specified via the `-c` option, the following is used super + @button{1-3} bspc ungrab_pointer + super + {_,shift} + {h,j,k,l} + bspc {focus,shift} {left,down,up,right} + + {_,shift,super} + XF86MonBrightness{Down,Up} + bright {-1,-10,min,+1,+10,max} + super + o ; {e,w,m} {gvim,firefox,thunderbird} super + alt + control + {h,j,k,l} ; {0-9} bspc fence_ratio {left,down,up,right} 0.{0-9} + + ## Installation make diff --git a/parse.c b/parse.c @@ -2509,6 +2509,8 @@ void render_next(chunk_t *chunks, char *dest) if (c->range_cur <= c->range_max) { dest[i++] = c->range_cur; } else { + if (c->item[0] == SEQ_NONE && c->item[1] == '\0') + continue; strcpy(dest + i, c->item); i += strlen(c->item); } diff --git a/parse.h b/parse.h @@ -14,6 +14,7 @@ #define SEQ_BEGIN '{' #define SEQ_END '}' #define SEQ_SEP "," +#define SEQ_NONE '_' typedef struct chunk_t chunk_t; struct chunk_t { diff --git a/sxhkd.1 b/sxhkd.1 @@ -84,6 +84,8 @@ where .IR A " and " Z are alphanumeric characters. .PP +The underscore character represents an empty sequence element. +.PP What is actually executed is .IB SHELL " -c " .IR COMMAND ,