-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated JBWMKeys from keys.txt using keys.scm. Reformatted libconve…
…rt.scm. Added display-c-include.
- Loading branch information
1 parent
e58a686
commit 14f3e89
Showing
5 changed files
with
163 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Mixtures of Ctrl, Alt an Escape are used for things like VMWare and | ||
* XFree86/Cygwin, so the KILL key is an option in the Makefile */ | ||
#ifndef JBWM_KEY_COMBOS_H | ||
#define JBWM_KEY_COMBOS_H | ||
#ifndef JBWM_KEY_KILL | ||
enum { JBWM_KEY_KILL = XK_q }; | ||
#endif | ||
#define JBWM_NUM_KEYS XK_0, XK_1, XK_2, XK_3, XK_4, XK_5, XK_6, XK_7,\ | ||
XK_8, XK_9 | ||
#define JBWM_VWM_KEYS JBWM_KEY_PREVDESK, JBWM_KEY_NEXTDESK, \ | ||
JBWM_NUM_KEYS | ||
#define JBWM_DIRECTION_KEYS JBWM_KEY_LEFT, JBWM_KEY_RIGHT, \ | ||
JBWM_KEY_DOWN, JBWM_KEY_UP | ||
#define JBWM_KEYS_TO_GRAB JBWM_KEY_NEXT, JBWM_KEY_NEW, JBWM_KEY_QUIT,\ | ||
JBWM_KEY_KILL, JBWM_DIRECTION_KEYS, JBWM_KEY_LOWER,\ | ||
JBWM_KEY_ALTLOWER, JBWM_KEY_MAX, JBWM_KEY_STICK,\ | ||
JBWM_VWM_KEYS, JBWM_KEY_MOVE, JBWM_KEY_RAISE, JBWM_KEY_SHADE,\ | ||
JBWM_KEY_MAX_H, JBWM_KEY_MAX_V, JBWM_KEY_FS, 0 | ||
#define JBWM_ALT_KEYS_TO_GRAB JBWM_KEY_KILL, JBWM_DIRECTION_KEYS,\ | ||
JBWM_VWM_KEYS, 0 | ||
#endif//!JBWM_KEY_COMBOS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; Copyright 2017, Jeffrey E. Bedard | ||
; vim: sw=2 | ||
(load "libconvert.scm") | ||
(define convert_keys | ||
(lambda (in_filename out_filename) | ||
(letrec ((i (open-input-file in_filename)) | ||
(o (open-output-file out_filename)) | ||
(guard "JBWM_JBWMKEYS") | ||
(parse (lambda (i o) | ||
(let ((line (read-line i))) | ||
(if (and (not (eof-object? line)) | ||
(> (string-length line) 1)) | ||
(let ((key (string-car line)) | ||
(value (string-cdr line))) | ||
(display (string-append "\tJBWM_KEY_" key | ||
" = XK_" value ",\n") o) | ||
(parse i o))))))) | ||
(begin-include guard o) | ||
(display-c-include "<X11/keysym.h>" o) | ||
(display "enum JBWMKeys {\n" o) | ||
(parse i o) | ||
(display "};\n" o) | ||
(display-c-include "\"key_combos.h\"" o) | ||
(end-include guard o) | ||
(close-port i) | ||
(close-port o)))) | ||
(convert_keys "keys.txt" "JBWMKeys.h") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ALTLOWER:minus | ||
BOTTOMLEFT:KP_End | ||
BOTTOMRIGHT:KP_Page_Down | ||
DOWN:j | ||
FS:a | ||
INFO:F5 | ||
LEFT:h | ||
LOWER:Down | ||
MAX_H:x | ||
MAX:space | ||
MAX_V:z | ||
MOVE:m | ||
NEW:Return | ||
NEXTDESK:Right | ||
NEXT:Tab | ||
PREVDESK:Left | ||
QUIT:Escape | ||
RAISE:Up | ||
RIGHT:l | ||
SHADE:s | ||
STICK:period | ||
TOPLEFT:KP_Home | ||
TOPRIGHT:KP_Page_Up | ||
UP:k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,73 @@ | ||
; libconvert.scm | ||
; Simple colon-separated database parsing library for header generation | ||
; vim: sw=2 | ||
(define copyright "// Copyright 2017, Jeffrey E. Bedard\n") | ||
; lisp-like operations on colon-separated strings: | ||
(define get-string-divider (lambda (str) | ||
(string-find-next-char str #\:))) | ||
(define get-string-divider | ||
(lambda (str) (string-find-next-char str #\:))) | ||
|
||
; returns original string if not a list | ||
(define string-car (lambda (str) (let ((i (get-string-divider str))) | ||
(if i (string-head str i) str)))) | ||
(define string-car | ||
(lambda (str) | ||
(let ((i (get-string-divider str))) | ||
(if i (string-head str i) str)))) | ||
|
||
; returns "" when list empty | ||
(define string-cdr (lambda (str) (let ((i (get-string-divider str))) | ||
(if i (string-tail str (+ 1 i)) "")))) | ||
(define string-cdr | ||
(lambda (str) | ||
(let ((i (get-string-divider str))) | ||
(if i (string-tail str (+ 1 i)) "")))) | ||
|
||
; The following prefix is applied to each entry | ||
(define master-prefix "_NET_") | ||
(define begin-array-definition (lambda (type name out) | ||
(display (string-append "static " type " " name " [] = {\n") out))) | ||
(define begin-enum-definition (lambda (name out) | ||
(display (string-append "enum " name " {\n") out))) | ||
|
||
(define begin-array-definition | ||
(lambda (type name out) | ||
(display (string-append "static " type " " name " [] = {\n") out))) | ||
|
||
(define begin-enum-definition | ||
(lambda (name out) | ||
(display (string-append "enum " name " {\n") out))) | ||
|
||
(define end-c-definition (lambda (out) (display "};\n" out))) | ||
(define get-array-line (lambda (prefix item) | ||
(string-append "\t\"" master-prefix prefix item "\",\n"))) | ||
(define print-each-array-element (lambda (prefix elements out_port) | ||
(map (lambda (item) | ||
(display (get-array-line prefix item) out_port)) | ||
elements))) | ||
(define get-enum-line (lambda (prefix item) | ||
(string-append "\t" master-prefix prefix item ",\n"))) | ||
(define print-enum-line (lambda (prefix item out_port) | ||
(display (get-enum-line prefix item) out_port))) | ||
(define print-each-enum (lambda (prefix elements out_port) | ||
(map (lambda (item) (print-enum-line prefix item out_port)) | ||
elements))) | ||
(define get-guard (lambda (name) | ||
(string-append name "_H\n"))) | ||
(define print-each (lambda (function data out_port) | ||
(function (car data) (cdr data) out_port))) | ||
(define add-c-include (lambda (name) (string-append "#include " name "\n"))) | ||
(define begin-include (lambda (guard_tag out) | ||
(display (string-append copyright | ||
"#ifndef " (get-guard guard_tag) | ||
"#define " (get-guard guard_tag)) out))) | ||
(define end-include (lambda (guard_tag out) | ||
(display (string-append "#endif//!" (get-guard guard_tag)) out))) | ||
|
||
(define get-array-line | ||
(lambda (prefix item) | ||
(string-append "\t\"" master-prefix prefix item "\",\n"))) | ||
|
||
(define print-each-array-element | ||
(lambda (prefix elements out_port) | ||
(map (lambda (item) | ||
(display (get-array-line prefix item) out_port)) elements))) | ||
|
||
(define get-enum-line | ||
(lambda (prefix item) (string-append "\t" master-prefix prefix item ",\n"))) | ||
|
||
(define print-enum-line | ||
(lambda (prefix item out_port) | ||
(display (get-enum-line prefix item) out_port))) | ||
|
||
(define print-each-enum | ||
(lambda (prefix elements out_port) | ||
(map (lambda (item) (print-enum-line prefix item out_port)) elements))) | ||
|
||
(define get-guard (lambda (name) (string-append name "_H\n"))) | ||
|
||
(define print-each | ||
(lambda (function data out_port) | ||
(function (car data) (cdr data) out_port))) | ||
|
||
(define add-c-include | ||
(lambda (name) (string-append "#include " name "\n"))) | ||
|
||
(define display-c-include | ||
(lambda (name out) (display (add-c-include name) out))) | ||
|
||
(define begin-include | ||
(lambda (guard_tag out) | ||
(display (string-append copyright "#ifndef " (get-guard guard_tag) | ||
"#define " (get-guard guard_tag)) out))) | ||
|
||
(define end-include | ||
(lambda (guard_tag out) | ||
(display (string-append "#endif//!" (get-guard guard_tag)) out))) |