Skip to content

Instantly share code, notes, and snippets.

@cxw42
Last active April 13, 2020 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cxw42/67e870bd2f67f9a525b1e53a8b244af4 to your computer and use it in GitHub Desktop.
Save cxw42/67e870bd2f67f9a525b1e53a8b244af4 to your computer and use it in GitHub Desktop.
Keyboard.io Model01 Colormap file
#!/bin/bash
# Modified from Model01-sketch/tools/colormap/apply by Gergely Nagy
# (algernon),
# https://github.com/algernon/Model01-sketch/blob/master/tools/colormap/apply ,
# licensed GPL3.
here="$(cd "$(dirname "$0")" &>/dev/null ; pwd)"
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <colormap filename>"
exit 1
fi
mapfile="$1"
if [[ ! -r "$mapfile" ]]; then
echo "Cannot read specified file"
exit 1
fi
clean_command () {
sed -e "s,#.*,,"
}
focus="$here/focus"
grep -v '^#' "$mapfile" | clean_command | DEVICE=/dev/ttyACM0 xargs "$focus"
colormap.map
# Layout:
#
# Left side:
# Starting from pgdn, up column 1, down column 2, &c., ending up column 7.
# Then across the thumb L-R, then the pad.
#
# Right side:
# Pad, then across the thumb L-R, then, starting from `any`, down column 1,
# up column 2, &c., ending down column 7 at `-`
#######################################
# Primary layer
## Left, col 1: pgdn pgup ` prog
1 1 1 1
## col 2: 1 q a z
1 1 1 1
## col 3: x s w 2
1 1 1 1
## col 4: 3 e d c
1 1 1 1
## col 5: v f r 4
1 1 1 1
## col 6: 5 t g b
1 1 1 1
## col 7: esc tab led
1 1 1
## Left thumb: ctrl bksp cmd shift
1 1 1 1
## Left pad
1
## Right pad
1
## Right thumb: shift alt space ctrl
1 1 1 1
## Right, col 1: any enter butterfly
1 1 1
## col 2: n h y 6
1 1 1 1
## col 3: 7 u j m
1 1 1 1
## col 4: , k i 8
1 1 1 1
## col 5: 9 o l .
1 1 1 1
## col 6: / ; p 0
1 1 1 1
## col 7: num = ' -
1 1 1 1
#######################################
# Numpad
## Left, col 1: pgdn pgup ` prog
1 1 1 1
## col 2: 1 q a z
1 1 1 1
## col 3: x s w 2
1 1 1 1
## col 4: 3 e d c
1 1 1 1
## col 5: v f r 4
1 1 1 1
## col 6: 5 t g b
1 1 1 1
## col 7: esc tab led
1 1 1
## Left thumb: ctrl bksp cmd shift
1 1 1 1
## Left pad
1
## Right pad
1
## Right thumb: shift alt space ctrl
1 1 1 1
## Right, col 1: any enter butterfly
1 1 1
## col 2: n h y 6
1 1 1 1
## col 3: 7 u j m
1 1 1 1
## col 4: , k i 8
1 1 1 1
## col 5: 9 o l .
1 1 1 1
## col 6: / ; p 0
## Highlight = (white) / + (green) / - (red)
1 1 1 1
## col 7: num = ' -
## Highlight Num and Enter
1 1 1 1
#######################################
# Function
## Left, col 1: pgdn pgup ` prog
1 1 1 1
## col 2: 1 q a z
1 1 1 1
## col 3: x s w 2
1 1 1 1
## col 4: 3 e d c
1 1 1 1
## col 5: v f r 4
1 1 1 1
## col 6: 5 t g b
1 1 1 1
## col 7: esc tab led
1 1 1
## Left thumb: ctrl bksp cmd shift
1 1 1 1
## Left pad
1
## Right pad
1
## Right thumb: shift alt space ctrl
1 1 1 1
## Right, col 1: any enter butterfly
1 1 1
## col 2: n h y 6
1 1 1 1
## col 3: 7 u j m
1 1 1 1
## col 4: , k i 8
1 1 1 1
## col 5: 9 o l .
1 1 1 1
## col 6: / ; p 0
1 1 1 1
## col 7: num = ' -
1 1 1 1
# Copyright (c) 2020 Christopher White (https://github.com/cxw42).
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
# SPDX-License-Identifier: FSFAP
# vi: set ft=perl: # # Just for syntax-highlighting the comments
#!/usr/bin/env bash
# focus-test - Trivial Focus testing tool
# Copyright (C) 2018 Keyboard.io, Inc.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
# Modified from Model01-sketch/tools/focus by Gergely Nagy
# (algernon),
# https://github.com/algernon/Model01-sketch/blob/master/tools/focus ,
# licensed GPL3.
set -e
DEVICE="${DEVICE:-/dev/ttyACM0}"
stty -F "${DEVICE}" 9600 raw -echo
exec 3<"${DEVICE}"
echo "Sending command: " "$@"
echo "$@" >"${DEVICE}"
echo "Response (if any) follows."
while read -r line <&3; do
line="$(echo -n "${line}" | tr -d '\r')"
if [ "${line}" == "." ]; then
break
fi
echo "${line}"
done
@cxw42
Copy link
Author

cxw42 commented Apr 13, 2020

Colormap file for the keyboard.io Model01 running the standard firmware
with the Colormap plugin loaded.

To use:

  • Put these three files together in a directory
  • Update colormap.txt with indices in your palette
  • Run ./apply-file colormap.txt
  • Unplug and replug your Model01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment