the-via / releases

GNU General Public License v3.0
2.05k stars 222 forks source link

More advanced keycodes in macros? #97

Open Nazosan opened 3 years ago

Nazosan commented 3 years ago

I keep getting confused when I switch layers and I had a great idea: change the LEDs depending on the layer. What I would like to do is build a macro that looks something sort of like this: {TO(1)}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI}{RGB_HUI} And another that looks sort of like this: {TO(0)}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}{RGB_HUD}

This is just a rough idea of course, but overall a fairly simplistic thing. (From googling around I take it I would have to use layer_on/layer_off instead?)

Unfortunately the macros currently don't seem to support anything more than just basic keycodes (most of which you can simply type in anyway.) From what I can tell, QMK could actually do this, but it requires more advanced scripting than I know how to do at this time to actually do directly in QMK and VIA certainly makes the macro process a lot less painful in every other way. (And on that subject I really want to thank you for making the entire remapping/etc process easier on everyone.)

kroehre commented 3 years ago

@Nazosan I've had luck saving to json, editing the json directly to add more advanced keycodes, and then loading the edited json.

Nazosan commented 3 years ago

That's an interesting idea. I'm surprised it doesn't end up losing the data from that -- I'll admit I would have assumed it would so it didn't even occur to me to try anything like that.

I ended up doing it via QMK eventually as it turns out it supports setting different colors on different layers natively. My script is probably anything but 100% optimal, but it does work. I am able to get a different color for each layer that way. I still compile with VIA support, but pretty much only use VIA for stuff like directly changing brightness on the fly (though I have a shortcut for that too really.) Actually, I suppose if QMK is able to do it that way then probably VIA should be able to as well, but I don't know if it really gets updated given that its version number is 0.1 from a long time ago.

danielo515 commented 3 years ago

I have the same requirement. Having the RGB underlight change per layer is a huge memory helper for me. What it is needed to support it? In QMK is very simple to setup, so If VIA uses QMK it should be doable.