kbaskett248 / adafruit_macropad

45 stars 21 forks source link

Support for manipulation of `app_settings` over the serial data port. #4

Closed avi-perl closed 2 years ago

avi-perl commented 2 years ago

Hello again,

I'm creating this issue to propose a new feature that I use, to see if its something you want to merge at some point.

One of the primary ways I use my MacroPad is to have it change what app is loaded based on the active window on the host computer it is connected to. This allows (as an example) for me to have specific VSCode shortcuts loaded when I am in that program. Additionally, it allows me to plug the MacroPad into various computers and allow each computer to send its configuration over to the MacroPad who will react appropriately.

This would be done by injecting JSON sent by the host into the app_settings and adding a mechanism to refresh the current app every time that data is changed. (Perhaps these, and possibly all settings, should be moved to a global singleton...)

I have prototyped this feature by shoehorning code from my previous project into yours, it can be found in this commit.

I wanted to get your thoughts on this idea and see if you would want to incorporate it. If yes, I'll have a look at rewriting it to be a better fit for your project.

kbaskett248 commented 2 years ago

Yeah, that sounds like an excellent feature. I'll take a look at the commit when I can and let you know if I see any major issues. The other thing I would love out of that type of feature is some way to send other info, like current media and volume level. But we can think about that later.

avi-perl commented 2 years ago

The trouble I anticipate is the data that is sent is controlled by a script on the host, which makes cross-platform support a bit of a challenge potentially.

I'd imagine that baking too much dependency on the MacroPad side could be a mistake. The problem is quite limited if the dependency is limited to the inside of apps only.

The main exception would be the automatic app switching, which seems worth the trouble. Configuring the OS_SETTING over serial should be possible/worth it as well.


I've already discovered and fixed some bugs with the implementation, I think it is best if I create a PR for this so we can leverage GitHub tooling.

avi-perl commented 2 years ago

A PR has been opened to address this idea here.