Author Topic: QMK - VIA programming and keyboard macros  (Read 24024 times)

0 Members and 1 Guest are viewing this topic.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: QMK - VIA programming and keyboard macros
« Reply #50 on: Fri, 02 April 2021, 07:17:45 »
... you said the link was too hard so you had read it to find that out, right? :blank:  Actually you're right - it assumes you know where the file is.  Not great documentation.

Wherever your qmk_firmware folder is go in keyboards/id87/keymaps/via or default and edit keymap.c in a text editor.

It should be both, theoretically, as per: https://altcodeunicode.com/pound-sign-alt-code/

The windows alt codes for £ are ALT 156 or ALT 0163 - I've got AHK using 0163 without issue, but perhaps QMK only likes the three digit codes.

Thanks for clearing that up.  Why not have two codes to do exactly the same thing...  I love Windows :p
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline phinix

  • Thread Starter
  • Posts: 2296
  • Location: Haggis Land
  • On a diet.. again.. don't ask...
Re: QMK - VIA programming and keyboard macros
« Reply #51 on: Fri, 02 April 2021, 09:18:01 »
... you said the link was too hard so you had read it to find that out, right? :blank:  Actually you're right - it assumes you know where the file is.  Not great documentation.

Wherever your qmk_firmware folder is go in keyboards/id87/keymaps/via or default and edit keymap.c in a text editor.

It should be both, theoretically, as per: https://altcodeunicode.com/pound-sign-alt-code/

The windows alt codes for £ are ALT 156 or ALT 0163 - I've got AHK using 0163 without issue, but perhaps QMK only likes the three digit codes.

Thanks for clearing that up.  Why not have two codes to do exactly the same thing...  I love Windows :p

Sorry, I have no firmware folder, I only have qmk configurator, all I have is hex and json file.
9100 | 3070 | 8TB SSD + 2x 1TB SSD | Z390 Aorus Pro ITX | 16GB RAM | SFX 600W | Sentry 2.0 | Ruark Audio MR1 Mark II | LG OLED 48CX
Realforce 87u55 | CM QuickFire Rapid MX Blacks | NCR-80 87g Gateron Oil Kings | Logitech Pro Superlight
SA: Retro Petscii, 7bit Round6 'Symbiosis', Filco, Carbon Bone Cherry: GMK Laser, OG double shot caps, CRP APL GSA: Retro High-light HSA: Hyperfuse

::: Phinix Cube ::: Phinix Nano Tower ::: Phinix Aurora ::: Phinix Chimera ::: Phinix Retro :::

Offline phinix

  • Thread Starter
  • Posts: 2296
  • Location: Haggis Land
  • On a diet.. again.. don't ask...
Re: QMK - VIA programming and keyboard macros
« Reply #52 on: Fri, 02 April 2021, 09:58:15 »
I dont get it, it just stopped working...:(

OK, weird - it only works in web browser.
Not in Windows explorer or Word etc
9100 | 3070 | 8TB SSD + 2x 1TB SSD | Z390 Aorus Pro ITX | 16GB RAM | SFX 600W | Sentry 2.0 | Ruark Audio MR1 Mark II | LG OLED 48CX
Realforce 87u55 | CM QuickFire Rapid MX Blacks | NCR-80 87g Gateron Oil Kings | Logitech Pro Superlight
SA: Retro Petscii, 7bit Round6 'Symbiosis', Filco, Carbon Bone Cherry: GMK Laser, OG double shot caps, CRP APL GSA: Retro High-light HSA: Hyperfuse

::: Phinix Cube ::: Phinix Nano Tower ::: Phinix Aurora ::: Phinix Chimera ::: Phinix Retro :::

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: QMK - VIA programming and keyboard macros
« Reply #53 on: Fri, 02 April 2021, 10:35:00 »
QMK configurator being the website?  Looks nice but no macros, as far as I can see.
 
After building the GH60 via version the program detected the board and showed me something usable.  I put the code below and it was happy to save the macro, then set a key as that macro and saved a json so I guess it works but I have no idea what to do with the json file to test.

SS_RALT(SS_TAP(X_P0)SS_TAP(X_P1)SS_TAP(X_P6)SS_TAP(X_P3))
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline phinix

  • Thread Starter
  • Posts: 2296
  • Location: Haggis Land
  • On a diet.. again.. don't ask...
Re: QMK - VIA programming and keyboard macros
« Reply #54 on: Fri, 02 April 2021, 11:27:04 »
QMK configurator being the website?  Looks nice but no macros, as far as I can see.
 
After building the GH60 via version the program detected the board and showed me something usable.  I put the code below and it was happy to save the macro, then set a key as that macro and saved a json so I guess it works but I have no idea what to do with the json file to test.

SS_RALT(SS_TAP(X_P0)SS_TAP(X_P1)SS_TAP(X_P6)SS_TAP(X_P3))

Yes QMK configurator as a website. Plus QMK toolbox just for flashing with hex files.

I have a feeling like we are very close, but dont know how to make it work:(
9100 | 3070 | 8TB SSD + 2x 1TB SSD | Z390 Aorus Pro ITX | 16GB RAM | SFX 600W | Sentry 2.0 | Ruark Audio MR1 Mark II | LG OLED 48CX
Realforce 87u55 | CM QuickFire Rapid MX Blacks | NCR-80 87g Gateron Oil Kings | Logitech Pro Superlight
SA: Retro Petscii, 7bit Round6 'Symbiosis', Filco, Carbon Bone Cherry: GMK Laser, OG double shot caps, CRP APL GSA: Retro High-light HSA: Hyperfuse

::: Phinix Cube ::: Phinix Nano Tower ::: Phinix Aurora ::: Phinix Chimera ::: Phinix Retro :::

Offline phinix

  • Thread Starter
  • Posts: 2296
  • Location: Haggis Land
  • On a diet.. again.. don't ask...
Re: QMK - VIA programming and keyboard macros
« Reply #55 on: Fri, 02 April 2021, 11:36:24 »
OK OK...

I got qmk_firmware folder, that website configurator - I used compile and got the whole thing now on my PC.
Went to keyboards/id87/keymaps/via, editing keymap.c file.

So I have all this :

Code: [Select]
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_tkl_ansi(
        KC_ESC,           KC_F1,   KC_F2,   KC_F3,   KC_F4,       KC_F5,   KC_F6,   KC_F7,   KC_F8,        KC_F9,   KC_F10,  KC_F11,  KC_F12,    KC_PSCR, KC_SLCK, KC_PAUS,
        KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC,            KC_INS,  KC_HOME, KC_PGUP,
        KC_TAB,      KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSLS,        KC_DEL,  KC_END,  KC_PGDN,
        KC_CAPS,       KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT,
        KC_LSFT,            KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,                            KC_UP,
        KC_LCTL,   KC_LGUI,   KC_LALT,                       KC_SPC,                              KC_RALT,   KC_RGUI,   LT(1, KC_APP),     KC_RCTL,      KC_LEFT, KC_DOWN, KC_RGHT
    ),
    [1] = LAYOUT_tkl_ansi(
        RESET,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, RGB_HUI, _______,
        _______,     BL_TOGG, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        RGB_VAI, RGB_SAI, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______,                            BL_INC,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      BL_INC,  BL_DEC, RGB_MOD
    ),
[2] = LAYOUT_tkl_ansi(
        _______,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, _______, _______,
        _______,     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        _______, _______, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                            _______,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      _______,  _______, _______
                ),
[3] = LAYOUT_tkl_ansi(
                _______,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, _______, _______,
        _______,     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        _______, _______, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                            _______,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      _______,  _______, _______
                ),
};

pasting your bit here and have this.

Code: [Select]
#include QMK_KEYBOARD_H

enum custom_keycodes {
    UKPOUNDL = SAFE_RANGE,
    UKPOUNDW,
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
   
    case UKPOUNDL:
        if (record->event.pressed) {
            // when keycod is pressed
            SEND_STRING(SS_LSFT(SS_RCTL("ua3")));
        } else {
            // when keycode is released
        }
        break;
       
    case UKPOUNDW:
        if (record->event.pressed) {
            // when keycode is pressed
            SEND_STRING(SS_RALT(SS_TAP(X_P0)SS_TAP(X_P1)SS_TAP(X_P6)SS_TAP(X_P3)));
        } else {
            // when keycode is released
        }
        break;
    }
    return true;
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_tkl_ansi(
        KC_ESC,           KC_F1,   KC_F2,   KC_F3,   KC_F4,       KC_F5,   KC_F6,   KC_F7,   KC_F8,        KC_F9,   KC_F10,  KC_F11,  KC_F12,    KC_PSCR, KC_SLCK, KC_PAUS,
        KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC,            KC_INS,  KC_HOME, KC_PGUP,
        KC_TAB,      KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSLS,        KC_DEL,  KC_END,  KC_PGDN,
        KC_CAPS,       KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT,
        KC_LSFT,            KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,                            KC_UP,
        KC_LCTL,   KC_LGUI,   KC_LALT,                       KC_SPC,                              KC_RALT,   KC_RGUI,   LT(1, KC_APP),     KC_RCTL,      KC_LEFT, KC_DOWN, KC_RGHT
    ),
    [1] = LAYOUT_tkl_ansi(
        RESET,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, RGB_HUI, _______,
        _______,     BL_TOGG, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        RGB_VAI, RGB_SAI, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______,                            BL_INC,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      BL_INC,  BL_DEC, RGB_MOD
    ),
[2] = LAYOUT_tkl_ansi(
        _______,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, _______, _______,
        _______,     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        _______, _______, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                            _______,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      _______,  _______, _______
                ),
[3] = LAYOUT_tkl_ansi(
                _______,            _______, _______, _______, _______,     _______, _______, _______, _______,      _______, _______, _______, _______,   _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,            _______, _______, _______,
        _______,     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,        _______, _______, _______,
        _______,       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______,            _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                            _______,
        _______,   _______,   _______,                      _______,                              _______,   _______,   _______,   _______,      _______,  _______, _______
                ),
};

What now?  :D
9100 | 3070 | 8TB SSD + 2x 1TB SSD | Z390 Aorus Pro ITX | 16GB RAM | SFX 600W | Sentry 2.0 | Ruark Audio MR1 Mark II | LG OLED 48CX
Realforce 87u55 | CM QuickFire Rapid MX Blacks | NCR-80 87g Gateron Oil Kings | Logitech Pro Superlight
SA: Retro Petscii, 7bit Round6 'Symbiosis', Filco, Carbon Bone Cherry: GMK Laser, OG double shot caps, CRP APL GSA: Retro High-light HSA: Hyperfuse

::: Phinix Cube ::: Phinix Nano Tower ::: Phinix Aurora ::: Phinix Chimera ::: Phinix Retro :::

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: QMK - VIA programming and keyboard macros
« Reply #56 on: Fri, 02 April 2021, 11:47:06 »
Random idea - added the 'macro' and built the via hex, the key now shows up as a seemingly random hex code in via but it still sends the right keys.  It's no use if you want to add more macros but you can do anything else including moving FN?

Or if you want to do this the proper (old fashioned) way you need to change the _____  which corresponds to the key you want £ on to UKPOUNDW then setup a compiler.  Pretty sure the compiler part was the main reason Windows users needed to make helpful GUIs to do this stuff, it's easy in Linux.
« Last Edit: Fri, 02 April 2021, 11:51:00 by suicidal_orange »
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline phinix

  • Thread Starter
  • Posts: 2296
  • Location: Haggis Land
  • On a diet.. again.. don't ask...
Re: QMK - VIA programming and keyboard macros
« Reply #57 on: Fri, 02 April 2021, 13:12:59 »
Random idea - added the 'macro' and built the via hex, the key now shows up as a seemingly random hex code in via but it still sends the right keys.  It's no use if you want to add more macros but you can do anything else including moving FN?

Or if you want to do this the proper (old fashioned) way you need to change the _____  which corresponds to the key you want £ on to UKPOUNDW then setup a compiler.  Pretty sure the compiler part was the main reason Windows users needed to make helpful GUIs to do this stuff, it's easy in Linux.

I wanted to use this on all my keyboards with QMK, so ideally I would like to have this done proper way.
So now I would need to swap one of those ______ with UKPOUNDW and comply it.. somehow.
So that step would be the hard part?
I cant believe I cant find people who already tried this - at least someone in UK who uses ANSI keyboard would like to have £ sign handy, right?
I got rid of all ISO keyboards cause I hated to pay extra for ISO kits in caps sets. ANSI felt better anyway.

How can I now compile it to hex file?
9100 | 3070 | 8TB SSD + 2x 1TB SSD | Z390 Aorus Pro ITX | 16GB RAM | SFX 600W | Sentry 2.0 | Ruark Audio MR1 Mark II | LG OLED 48CX
Realforce 87u55 | CM QuickFire Rapid MX Blacks | NCR-80 87g Gateron Oil Kings | Logitech Pro Superlight
SA: Retro Petscii, 7bit Round6 'Symbiosis', Filco, Carbon Bone Cherry: GMK Laser, OG double shot caps, CRP APL GSA: Retro High-light HSA: Hyperfuse

::: Phinix Cube ::: Phinix Nano Tower ::: Phinix Aurora ::: Phinix Chimera ::: Phinix Retro :::

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: QMK - VIA programming and keyboard macros
« Reply #58 on: Mon, 05 April 2021, 04:23:10 »
QMK configurator being the website?  Looks nice but no macros, as far as I can see.
 
After building the GH60 via version the program detected the board and showed me something usable.  I put the code below and it was happy to save the macro, then set a key as that macro and saved a json so I guess it works but I have no idea what to do with the json file to test.

SS_RALT(SS_TAP(X_P0)SS_TAP(X_P1)SS_TAP(X_P6)SS_TAP(X_P3))

Did you try adding this as a macro in via and loading the json to the board?

As to why no-one does this maybe it's easier to do it the other way round and say you have an ISO board?  Not sure what you prefer about ANSI, aside from @ and " swapping and the missing £ I couldn't tell you what the differences are...
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Keybadger

  • Posts: 6
Re: QMK - VIA programming and keyboard macros
« Reply #59 on: Sat, 10 April 2021, 16:50:34 »
I wondered about this for ages also using an ANSI layout in the UK, as I mostly used Linux, I have a button for the compose key, which is a key designed for entering special characters.

I don't know why MS hasn't added this feature to Windows yet. Until they do you could do something like install 2 languages US standard and UK standard, then press win+space to swap between them and the £ symbol will be on 3 as normal then swap back.

Sent from my M2007J20CG using Tapatalk