uchr file

User avatar
MrMen

11 Jul 2015, 13:42

Hi,
I'm not sure if this post is in the right place, but I try…if needed do not hesitate to tell me and to move/delete the post.
My question is about layout definition with uchr format and I don't know where to ask.

The problem :
I'd want to use my hhkb with hasu controller with my iPad (a jailbroken one).

Layout files are uchr ones. I d'ont know much about these. I want to edit one (for example Colemak.uchr) to have a bépo layout.
uchr are defined here : https://developer.apple.com/library/mac ... _uchr.html

One guy developped a gui to edit such files, but it seems to be buggy. https://github.com/stefslon/iOSKeyboardEditor

Does anyone have an idea ?

User avatar
Muirium
µ

11 Jul 2015, 14:45

Remap the keyboard itself, using Hasu's code.

But don't expect any help from me. I know it's possible, but I make code explode. Don't know why. Always have done!

User avatar
flabbergast

11 Jul 2015, 16:02

Muirium wrote: Remap the keyboard itself, using Hasu's code.
I think he's made a browser-based "GUI" for remapping his controller: https://geekhack.org/index.php?topic=12047.0 (under "Keymap Editor").

User avatar
MrMen

11 Jul 2015, 16:43

The issue is that I need non ascii key and different Alt/Shift layer...
For example the W key is on bepo layout é.

The Q key is B and the alt version is |.

User avatar
Muirium
µ

11 Jul 2015, 17:03

Hasu's TMK is great at layers. (So everyone says. Remember: I fail at editing code so I can't say from my own experience.) It ought to be able to handle this, as far as I understand.

You might be the only person in the forum running hacked iOS (I'm on an iPad jut now but I run stock) so I wouldn't expect much in the way of answers to this uchr question. I don't recognise it from the Mac. Could be all about software keyboards (on the screen) instead of hardware ones.

User avatar
flabbergast

11 Jul 2015, 17:11

MrMen wrote: The issue is that I need non ascii key and different Alt/Shift layer...
For example the W key is on bepo layout é.

The Q key is B and the alt version is |.
Doing this might be slightly tricky on the keyboard level. The method that comes to mind is to declare shift and alt as function keys in TMK that change layers. But it will take some consideration for more complicated combos...

Also, the keyboard is only able to produce é if there is a way to enter it on a "default" keyboard. -this is not really a good explanation. Example: I use US-extended keyboard setting on my mac, which means I can enter é as "RightAlt+e e". I can make TMK to produce this sequence on just one keypress. However if I used the default US keyboard on the mac, then there is no way to enter this character by pressing keys, and so whatever my external keyboard would do, the result would not be é.

User avatar
MrMen

12 Jul 2015, 17:57

Oh mens you're awesome ! I just realized what Muirium wanted to tell and your idea flabbergast :
go to hell shift, alt and others let's use Fn** !

About the é, I'll check if I can do it, but if I can't that won't be a huge problem : I'll use a spell checker to add accent.
But I'll try to do what you mean.

Thank you guys for these ideas ! I was looking for this for so long. And Mu, I'm not really happy with the jailbroken idea so let's go stock.

Edit :
Thank you guys ! :D
I know have my hhkb supporting bepo on my iPad.

I achieved to have é è and à supported with ACTION_MACRO. It will only work on the iPad, but I have another one without hasu controller so it won't be a problem.

So another time : THANK YOU !

User avatar
MrMen

14 Aug 2015, 11:50

I post another time but with the current file for people interested in looking at it. ;)

Code: Select all

/*
* HHKB Layout
* fn0 : hhkb layer
* fn1 : alt layer
* fn2 : fake shift layer
* fn3 : unused
* fn4 "
* fn5
* fn6
* fn7 (
* fn8 )
* fn9 @
* fn10 +
* fn11 *
* fn12 %
* fn13 é
* fn14 è
* fn15 ^
* fn16 à
* fn17 <
* fn18 >
* fn19 &
* fn20 ù
* fn21 ~
* fn22 {
* fn23 }
* fn24 !
* fn25 ?
* fn26
* fn27 $
* fn28 #
* fn29
*/
 
#include "keymap_common.h"


#ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
#endif
    /* Layer 0: Default Layer
     * ,-----------------------------------------------------------.
     * |Esc|  "|  2|  3|  (|  )|  @|  +|  -|  /|  *|  =|  %| \|  $|
     * |-----------------------------------------------------------|
     * |Tab  |  B|  É|  P|  O|  È|  ^|  V|  D|  L|  J|  Z|  W|Backs|
     * |----------------------------------------------------------|
     * |Contro|  A|  U|  I|  E|  ,|  C|  T|  S|  R|  N|  M|Enter   |
     * |-----------------------------------------------------------|
     * |Shift   |  À|  Y|  X|  .|  K|  '|  Q|  G|  H|  F|Shift |Fn0|
     * `-----------------------------------------------------------'
     *       |Alt|Gui  |         Space         |Gui  |Alt|
     *       `-------------------------------------------'
     */
    KEYMAP(ESC, FN4, FN5,   FN6,   FN7,   FN8,   FN9,   FN10,   MINS,   SLSH,   FN11,   EQL,FN12, BSLS,FN27,\
           TAB, B,   FN13,   P,   O,   FN14,   FN15,   V,   D,   L,   J,   Z,W,BSPC, \
           LCTL,A,   U,   I,   E,   COMM,   C,   T,   S,   R,   N,M,ENT,	\
           FN2,FN16,   Y,   X,   DOT,   K,   QUOT,  Q ,   G,H, F,RSFT,FN0, \
                LSFT,LGUI,          SPC,                FN1,RGUI),
// default layer : fn4 to fn16 used for new keys

    /* Layer 1: HHKB mode (HHKB Fn)
     * ,-----------------------------------------------------------.
     * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
     * |-----------------------------------------------------------|
     * |Caps |   |   |   |   |   |   |   |Psc|Slk|Pus|Up |   |Backs|
     * |-----------------------------------------------------------|
     * |      |VoD|VoU|Mut|   |   |  *|  /|Hom|PgU|Lef|Rig|Enter   |
     * |-----------------------------------------------------------|
     * |        |   |   |   |   |   |  +|  -|End|PgD|Dow|      |   |
     * `-----------------------------------------------------------'
     *       |   |     |                       |     |   |
     *       `-------------------------------------------'
     */
    KEYMAP(PWR, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,   \
           CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC,      \
           TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT,            \
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS,            \
                TRNS,TRNS,          TRNS,               TRNS,TRNS),

// hhkb layer : no fn used

    /* Layer 1: Alt Layer
     * ,-----------------------------------------------------------.
     * |Esc|  1|  <|  >|  [|  ]|  6|  7|  8|  9|  0|  |  |  |  |
     * |-----------------------------------------------------------|
     * |Tab  |\||   | &  |   |   |   |   |   |   |   |   |   |Backs|
     * |-----------------------------------------------------------|
     * |Contro|   | ù |   |   |   |   |   |   |   | ~ |   |Enter   |
     * |-----------------------------------------------------------|
     * |Shift   | \ |  {|  }|   |   |   |   |   |   |   |Shift |Fn0|
     * `-----------------------------------------------------------'
     *       |Alt|Gui  |         Space         |Gui  |Alt|
     *       `-------------------------------------------'
     */
    KEYMAP(ESC, 1,   FN17,   FN18,   LBRC,   RBRC,   6,   7,   8,   9,   0,   MINS,EQL, BSLS,GRV,\
       TAB,FN18,TRNS,FN19,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,BSPC, \
           LCTL,TRNS,FN20,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,FN21,TRNS,ENT,	\
           FN2,BSLS,FN22,FN23,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,RSFT,FN0, \
                LALT,LGUI,          SPC,                FN1,RGUI),

    /* Layer 2: Fake Shift Layer
     * ,-----------------------------------------------------------.
     * |Esc|  "|  2|  3|  (|  )|  @|  +|  -|  /|  *|  =|  %| Q\|  $|
     * |-----------------------------------------------------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|Backs|
     * |-----------------------------------------------------------|
     * |Contro|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Enter   |
     * |-----------------------------------------------------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift |Fn0|
     * `-----------------------------------------------------------'
     *       |Alt|Gui  |         Space         |Gui  |Alt|
     *       `-------------------------------------------'
     */
    KEYMAP(PWR, 1,  2,  3,  4,  5,  6,  7,  8,  9,  0, TRNS, TRNS, TRNS, FN28, \
           CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,FN24,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC,      \
           TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT,            \
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,FN25,PMNS,END, PGDN,DOWN,TRNS,TRNS,            \
                TRNS,TRNS,          TRNS,               TRNS,TRNS),
};



enum macro_id {
  EACUTE,
  EGRAVE,
  AGRAVE,
  UGRAVE,
};



/*
 * Fn action definition
 */
 
// les fn sont definis de proche en proche layer apres layer
// les n premiers fn correspondent au changements de layers
#ifdef KEYMAP_SECTION_ENABLE
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
    [0]  = ACTION_LAYER_MOMENTARY(1),
    [1]  = ACTION_LAYER_MOMENTARY(2),
    [2]  = ACTION_LAYER_MOMENTARY(3),
};
#else
const uint16_t fn_actions[] PROGMEM = {
    [0]  = ACTION_LAYER_MOMENTARY(1),
    [1]  = ACTION_LAYER_MOMENTARY(2),
    [2]  = ACTION_LAYER_MOMENTARY(3),
    [3] = ACTION_LAYER_MOMENTARY(1),
    [4]  = ACTION_MODS_KEY(MOD_LSFT, KC_QUOTE),// "
    [5]  = ACTION_MODS_KEY(MOD_LSFT, KC_COMM),// <
    [6]  = ACTION_MODS_KEY(MOD_LSFT, KC_DOT),// >
    [7]  = ACTION_MODS_KEY(MOD_LSFT, KC_9),// (
    [8]  = ACTION_MODS_KEY(MOD_LSFT, KC_0),// )
    [9]  = ACTION_MODS_KEY(MOD_LSFT, KC_2),// @
    [10]  = ACTION_MODS_KEY(MOD_LSFT, KC_EQL),// +
    [11]  = ACTION_MODS_KEY(MOD_LSFT, KC_8),// *
    [12]  = ACTION_MODS_KEY(MOD_LSFT, KC_5),// %
    [13] = ACTION_MACRO(EACUTE),// é
    [14] = ACTION_MACRO(EGRAVE),// è
    [15]  = ACTION_MODS_KEY(MOD_LSFT, KC_6),//^
    [16] = ACTION_MACRO(AGRAVE),// à
    [17]  = ACTION_MODS_KEY(MOD_LSFT, KC_COMM),// <
    [18]  = ACTION_MODS_KEY(MOD_LSFT, KC_DOT),// >
    [19] = ACTION_MODS_KEY(MOD_LSFT, KC_7),// &
    [20] = ACTION_MACRO(UGRAVE),// ù
    [21] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV),// ~
    [22] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC),// {
    [23] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC),// }
    [24] = ACTION_MODS_KEY(MOD_LSFT, KC_1),// !
    [25]  = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH),// ?
    [27] = ACTION_MODS_KEY(MOD_LSFT, KC_4),// $
    [28] = ACTION_MODS_KEY(MOD_LSFT, KC_3),// #
    
};
#endif
/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case EACUTE:
            return (record->event.pressed ?
                    MACRO( I(0), T(QUOT), T(E), END ) :
                    MACRO_NONE );
        case EGRAVE:
            return (record->event.pressed ?
                    MACRO( I(0), T(GRV), T(E), END ) :
                    MACRO_NONE );
        case AGRAVE:
            return (record->event.pressed ?
                    MACRO( I(0), T(GRV), T(A), END ) :
                    MACRO_NONE );
        case UGRAVE:
            return (record->event.pressed ?
                    MACRO( I(0), T(GRV), T(U), END ) :
                    MACRO_NONE );
    }
    return MACRO_NONE;
}

Post Reply

Return to “Workshop”