qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit 1cd336dde4dad00864cfef643c501e2a32704426
parent cc52ac5b1634f61c8333bb653be0bc3d0a3c3da6
Author: Gergely Nagy <algernon@madhouse-project.org>
Date:   Sun,  1 Oct 2017 15:37:41 +0200

ergodox: Update algernon's layout to v1.11

Overall changes
===============

* Updated to work with QMK master.
* The `$` and `^` symbols on the number row were swapped on both the base and
  the ADORE layers.
* The bracket tap-dance keys can now be used to input Japanese brackets, `「`
  and `」` with a third tap.
* The second column of the top row on the right side will act as a "Social"
  application selector on the `AppSel` layer.
* The third key on the same column will select a password manager.
* The `GUI` key will now launch `rofi` when triple-tapped.

Miscellaneous
=============

* The `👶` symbol can be entered with UCIS.
* The `👪` symbol can be entered with UCIS.

Tools
=====

* `tools/hid-commands` can now find the `Mstdn`, not just `Slack`, as the
  "Slack"/chat app.
* `tools/hid-commands` can now find the Plex web app as a music/media player.
* `tools/hid-commands` now understands the "Social" application selector. It
  raises the `Mstdn` and `Tweetdeck` windows, but keeps focus on the previous
  window.
* `tools/hid-commands` now understands the "Social2" application selector, which
  raises `Signal` and `Viber`, but keeps focus on the previous window.
* `tools/hid-commands` is now able to select a password manager (KeePass*).
* `tools/hid-commands` can now run `rofi` when receiving an `appsel_helper`
  command (triggered by a triple-tapped `GUI` key).

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>

Diffstat:
layouts/community/ergodox/algernon/NEWS.md | 27+++++++++++++++++++++++++++
layouts/community/ergodox/algernon/keymap.c | 124+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
layouts/community/ergodox/algernon/readme.md | 24++++++++++--------------
layouts/community/ergodox/algernon/rules.mk | 8+++-----
layouts/community/ergodox/algernon/tools/hid-commands | 39++++++++++++++++++++++++++++++++++++---
layouts/community/ergodox/algernon/tools/log-to-heatmap.py | 0
layouts/community/ergodox/algernon/tools/text-to-log.py | 0
7 files changed, 181 insertions(+), 41 deletions(-)

diff --git a/layouts/community/ergodox/algernon/NEWS.md b/layouts/community/ergodox/algernon/NEWS.md @@ -1,5 +1,32 @@ <!-- -*- mode: markdown; fill-column: 8192 -*- --> +## v1.11 + +*2017-10-01* + +### Overall changes + +* Updated to work with QMK master. +* The `$` and `^` symbols on the number row were swapped on both the base and the ADORE layers. +* The bracket tap-dance keys can now be used to input Japanese brackets, `「` and `」` with a third tap. +* The second column of the top row on the right side will act as a "Social" application selector on the `AppSel` layer. +* The third key on the same column will select a password manager. +* The `GUI` key will now launch `rofi` when triple-tapped. + +### Miscellaneous + +* The `👶` symbol can be entered with UCIS. +* The `👪` symbol can be entered with UCIS. + +### Tools + +* `tools/hid-commands` can now find the `Mstdn`, not just `Slack`, as the "Slack"/chat app. +* `tools/hid-commands` can now find the Plex web app as a music/media player. +* `tools/hid-commands` now understands the "Social" application selector. It raises the `Mstdn` and `Tweetdeck` windows, but keeps focus on the previous window. +* `tools/hid-commands` now understands the "Social2" application selector, which raises `Signal` and `Viber`, but keeps focus on the previous window. +* `tools/hid-commands` is now able to select a password manager (KeePass*). +* `tools/hid-commands` can now run `rofi` when receiving an `appsel_helper` command (triggered by a triple-tapped `GUI` key). + ## v1.10 *2016-12-28* diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c @@ -36,11 +36,14 @@ enum { A_MPN, // Application select keys - APP_SLK, // Slack + APP_SLK, // Slack APP_EMCS, // Emacs APP_TERM, // Terminal APP_CHRM, // Chrome APP_MSIC, // Music + APP_SOCL, // Social + APP_PMGR, // Password manager + APP_SCL2, // Social #2 // Hungarian layer keys HU_AA, // Á @@ -252,7 +255,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 3: Application select layer * * ,-----------------------------------------------------. ,-----------------------------------------------------. - * | |Music |Slack |Emacs |Term |Chrome| | | | | | | | | | + * | |Music |Slack |Emacs |Term |Chrome| | | |Social|PWMgr |Scl2 | | | | * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * | | | | | | | | | | | | | | | | * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------| @@ -283,16 +286,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS - // right hand - ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_TRNS - ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS - ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS - ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS - ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS + // right hand + ,KC_TRNS ,M(APP_SOCL) ,M(APP_PMGR) ,M(APP_SCL2) ,KC_NO ,KC_NO ,KC_TRNS + ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS + ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS + ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS + ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS - ,KC_TRNS ,KC_TRNS - ,KC_TRNS - ,KC_TRNS ,KC_TRNS ,KC_TRNS + ,KC_TRNS ,KC_TRNS + ,KC_TRNS + ,KC_TRNS ,KC_TRNS ,KC_TRNS ), @@ -376,8 +379,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // right hand ,KC_TRNS ,KC_F10 ,KC_F2 ,KC_F4 ,KC_F6 ,KC_F8 ,KC_NO - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_NO ,KC_UP ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO @@ -536,10 +539,10 @@ static void ang_handle_num_row(uint8_t id, keyrecord_t *record) { kc = KC_8; break; case A_3: - kc = KC_6; + kc = KC_4; break; case A_1: - kc = KC_4; + kc = KC_6; break; case A_0: @@ -630,10 +633,14 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { register_code (KC_LGUI); if (record->tap.count && !record->tap.interrupted) { - if (record->tap.count >= 2) { + if (record->tap.count == 2) { uprintf("CMD:appsel_start\n"); layer_on (APPSEL); set_oneshot_layer (APPSEL, ONESHOT_START); + } else if (record->tap.count >= 3) { + uprintf("CMD:appsel_helper\n"); + layer_off (APPSEL); + clear_oneshot_layer_state (ONESHOT_PRESSED); } } else { record->tap.count = 0; @@ -673,6 +680,21 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) uprintf("CMD:appsel_music\n"); break; + case APP_SOCL: + if (record->event.pressed) + uprintf("CMD:appsel_social\n"); + break; + + case APP_PMGR: + if (record->event.pressed) + uprintf("CMD:appsel_pwmgr\n"); + break; + + case APP_SCL2: + if (record->event.pressed) + uprintf("CMD:appsel_social2\n"); + break; + // number row and symbols case A_1 ... A_0: ang_handle_num_row(id, record); @@ -844,14 +866,53 @@ _td_sr_reset (qk_tap_dance_state_t *state, void *user_data) { } } +static void +_td_brackets_finished (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + if (state->keycode == TD(CT_LBP)) + register_code16 (KC_LBRC); + else + register_code16 (KC_RBRC); + } else if (state->count == 2) { + if (state->keycode == TD(CT_LBP)) + register_code16 (KC_LPRN); + else + register_code16 (KC_RPRN); + } else if (state->count == 3) { + unicode_input_start(); + + if (state->keycode == TD(CT_LBP)) + register_hex (0x300c); + else + register_hex (0x300d); + + unicode_input_finish(); + } +} + +static void +_td_brackets_reset (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + if (state->keycode == TD(CT_LBP)) + unregister_code16 (KC_LBRC); + else + unregister_code16 (KC_RBRC); + } else if (state->count == 2) { + if (state->keycode == TD(CT_LBP)) + unregister_code16 (KC_LPRN); + else + unregister_code16 (KC_RPRN); + } +} + qk_tap_dance_action_t tap_dance_actions[] = { [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN) ,[CT_TA] = { .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset }, .user_data = (void *)&((td_ta_state_t) { false, false }) } - ,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN) - ,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN) + ,[CT_LBP] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset) + ,[CT_RBP] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset) ,[CT_TMUX]= ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_finished) ,[CT_TPS] = ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_pane_select) ,[CT_SR] = ACTION_TAP_DANCE_FN_ADVANCED (_td_sr_each, _td_sr_finished, _td_sr_reset) @@ -934,6 +995,29 @@ void matrix_scan_user(void) { KC_S, KC_Z, KC_O, KC_N, KC_Y, KC_K, KC_RALT, KC_QUOT, KC_A, KC_M, 0); } + SEQ_ONE_KEY (KC_K) { + ang_tap (KC_SPC, LSFT(KC_7), KC_SPC, 0); + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_U); + unregister_code(KC_U); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + ang_tap (KC_1, KC_F, KC_4, KC_7, KC_6, 0); + register_code (KC_ENT); + unregister_code (KC_ENT); + ang_tap (KC_END, 0); + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_U); + unregister_code(KC_U); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + ang_tap (KC_1, KC_F, KC_4, KC_7, KC_6, 0); + register_code (KC_SPC); + unregister_code (KC_SPC); + } + SEQ_ONE_KEY (KC_G) { ang_tap (LSFT(KC_G), KC_E, KC_J, KC_G, KC_RALT, KC_EQL, KC_O, KC_RALT, KC_EQL, KC_O, @@ -1040,7 +1124,9 @@ const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE UCIS_SYM("pi", 0x03c0), UCIS_SYM("mouse", 0x1f401), UCIS_SYM("micro", 0x00b5), - UCIS_SYM("tm", 0x2122) + UCIS_SYM("tm", 0x2122), + UCIS_SYM("child", 0x1f476), + UCIS_SYM("family", 0x1F46A) ); bool process_record_user (uint16_t keycode, keyrecord_t *record) { diff --git a/layouts/community/ergodox/algernon/readme.md b/layouts/community/ergodox/algernon/readme.md @@ -34,13 +34,13 @@ Some of the things in the layout only work when one uses [Spacemacs][spacemacs] ## Base layer -[![Base layer](https://i.imgur.com/q1MDvq4.png)](http://www.keyboard-layout-editor.com/#/gists/28f7eb305fdbff943613e1dc7aa9e82b) +[![Base layer](https://github.com/algernon/ergodox-layout/raw/master/images/base-layer.png)](http://www.keyboard-layout-editor.com/#/gists/28f7eb305fdbff943613e1dc7aa9e82b) At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave: * The number row is the same as in the [ADORE](#adore-layer) layer. The function keys are on the **Media** layer. * The `Shift`, `Alt`, and `Control` modifiers are one-shot. When tapped, they are considered active for the next key press only. When double tapped, they toggle on, until a third, single tap sometime later. When held, they act as expected. My usual pattern is that I use these for the next keypress only, so this behaviour is perfect. If I need them held, I'll just double-tap. -* The `GUI` key is special, because when I double-tap it, it sends `GUI + w`, which pops up an application selector. It also switches to a one-shot layer, where the number row on the left half turns into app selector macros, for the most common things I usually want to switch to. Otherwise it behaves as on a normal layout. +* The `GUI` key is special, because while a single tap works as usual, when double-tapped, it turns the number row into an application selector, and when triple tapped, it runs an application selector program on the host. * The `ESC` key also doubles as a one-shot cancel key: if tapped while any of the one-shot modifiers are in-flight (as in, single-tapped, and not expired yet), it cancels all one-shot modifiers. It also cancels the **Hun** layer, if active. Otherwise it sends the usual keycode. * The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle. * The **Fx** key is one-shot, and activates the **Media** layer, along with a one-shot `Alt`. @@ -57,12 +57,12 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest - `LEAD d` toggles logging keypress positions to the HID console. - `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader. - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode. - + The symbols on the front in the image above have the same color as the key that activates them, with the exception of the **Arrow** layer, which is just black on the front. ## ADORE layer -[![ADORE layer](https://i.imgur.com/r3LnQAA.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a) +[![ADORE layer](https://github.com/algernon/ergodox-layout/raw/master/images/adore-layer.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a) My experimental layout, that I keep tweaking. No full description here, because things are very much in flux. @@ -70,7 +70,7 @@ Note that the **HUN** layer does not work well with ADORE: it still has the same ## Steno layer -[![Steno layer for Plover](https://i.imgur.com/PgifhBF.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667) +[![Steno layer for Plover](https://github.com/algernon/ergodox-layout/raw/master/images/steno-layer.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667) This is to be used with [Plover](http://www.openstenoproject.org/plover/), nothing really fancy here. The **STENO** key toggles the layer on and off, and sends the toggle command to Plover too. @@ -110,7 +110,7 @@ Included with the firmware is a small tool that can parse these logs, and create The generated heatmap looks somewhat like this: - ![Heatmap](https://i.imgur.com/tly9XSy.png) + ![Heatmap](https://github.com/algernon/ergodox-layout/raw/master/images/heatmap.png) ## Layer notification @@ -118,7 +118,7 @@ There is a very small tool in `tools/layer-notify`, that listens to the HID cons # Building -To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `keyboards/ergodox_ez/algernon-master`. One way to achieve that is this: +To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `layouts/community/algernon_master`, or symlinked there. One way to achieve that is this: [algernon:ez-layout]: https://github.com/algernon/ergodox-layout [qmk]: https://github.com/qmk/qmk_firmware @@ -127,14 +127,14 @@ To make my workflow easier, this layout is maintained in [its own repository][al $ git clone https://github.com/qmk/qmk_firmware.git $ cd qmk_firmware $ git clone https://github.com/algernon/ergodox-layout.git \ - keyboards/ergodox/keymaps/algernon-master -$ make keyboard=ergodox keymap=algernon-master + layouts/community/ergodox/algernon_master +$ make ergodox_ez-algernon_master ``` From time to time, updates may be submitted back to the QMK repository. If you are reading it there, you can build the firmware like any other firmware included with it (assuming you are in the root directory of the firmware): ``` -$ make keyboard=ergodox keymap=algernon +$ make ergodox_ez-algernon ``` ## Using on Windows @@ -144,6 +144,3 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the # License The layout, being a derivative of the original TMK firmware which is under the GPL-2+, this layout is under the GPL as well, but GPL-3+, rather than the older version. - -![nav-n-media-layer.png](https://i.imgur.com/AReX8C9.png) -![hun-layer.png](https://i.imgur.com/uPGBl9J.png)- \ No newline at end of file diff --git a/layouts/community/ergodox/algernon/rules.mk b/layouts/community/ergodox/algernon/rules.mk @@ -1,15 +1,15 @@ BOOTMAGIC_ENABLE=no COMMAND_ENABLE=no SLEEP_LED_ENABLE=no -FORCE_NKRO = yes +FORCE_NKRO ?= yes DEBUG_ENABLE = no CONSOLE_ENABLE = no TAP_DANCE_ENABLE = yes -KEYLOGGER_ENABLE = yes +KEYLOGGER_ENABLE ?= yes UCIS_ENABLE = yes MOUSEKEY_ENABLE = no -AUTOLOG_ENABLE = no +AUTOLOG_ENABLE ?= no ifeq (${FORCE_NKRO},yes) OPT_DEFS += -DFORCE_NKRO @@ -39,5 +39,3 @@ LAYOUT_ergodox_BRANCH = $(shell \ git rev-parse --abbrev-ref HEAD 2>/dev/null) OPT_DEFS += -DLAYOUT_ergodox_VERSION=\"$(LAYOUT_ergodox_VERSION)\\\#$(LAYOUT_ergodox_BRANCH)\" - - diff --git a/layouts/community/ergodox/algernon/tools/hid-commands b/layouts/community/ergodox/algernon/tools/hid-commands @@ -10,6 +10,10 @@ cmd_wm () { wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz } +cmd_appsel_helper () { + rofi -show window +} + _cmd_appsel () { wmctrl -x -a $1 || true xdotool key Escape @@ -17,12 +21,14 @@ _cmd_appsel () { cmd_appsel_music () { wmctrl -x -a rhythmbox || wmctrl -x -a spotify || \ - wmctrl -x -a banshee || wmctrl -x -a kodi || true + wmctrl -x -a banshee || wmctrl -x -a kodi || \ + wmctrl -x -a plex || true xdotool key Escape } cmd_appsel_slack () { - _cmd_appsel slack + wmctrl -x -a slack || wmctrl -x -a Mstdn || true + xdotool key Escape } cmd_appsel_emacs () { @@ -34,7 +40,8 @@ cmd_appsel_term () { } cmd_appsel_chrome () { - _cmd_appsel chrom + wmctrl -x -a chrom || wmctrl -x -a Chrome || true + xdotool key Escape } cmd_appsel_start () { @@ -51,6 +58,32 @@ cmd_appsel_start () { -i /usr/share/icons/Adwaita/24x24/devices/video-display.png } +cmd_appsel_social () { + # Save the current window + a=$(xdotool getactivewindow) + # Raise & Focus Mstdn & Tweetdeck + wmctrl -x -a trunk.mad-scientist.club.Google-chrome || true; wmctrl -x -a tweetdeck || true + # Focus the previously active window + xdotool windowfocus $a || true; xdotool windowactivate $a || true + + xdotool key Escape +} + +cmd_appsel_social2 () { + # Save the current window + a=$(xdotool getactivewindow) + # Raise & Focus Viber & Signal + wmctrl -x -a Viber || true; wmctrl -a Signal || true + # Focus the previously active window + xdotool windowfocus $a || true; xdotool windowactivate $a || true + + xdotool key Escape +} + +cmd_appsel_pwmgr () { + _cmd_appsel keepass +} + cmd_reflash () { teensy_loader_cli -v -w ~/src/ext/qmk_firmware/algernon.hex --mcu atmega32u4 || true } diff --git a/layouts/community/ergodox/algernon/tools/log-to-heatmap.py b/layouts/community/ergodox/algernon/tools/log-to-heatmap.py diff --git a/layouts/community/ergodox/algernon/tools/text-to-log.py b/layouts/community/ergodox/algernon/tools/text-to-log.py