nickcoutsos / keymap-editor

A web based graphical editor of ZMK keymaps.
http://nickcoutsos.github.io/keymap-editor
MIT License
1.09k stars 279 forks source link

Read-only keymap preview #216

Open sebmos opened 4 months ago

sebmos commented 4 months ago

One thing I find quite useful about ZSA's Oryx is the ability to point someone to a link that shows my key map.

I was wondering about ways to provide that behaviour with the Keymap Editor. It could be via a page that includes the repo link (but without requiring Github permissions), that shows a stripped-down version without editing features. Alternatively, a preview could be published to the Github repo directly. I could see two ways for how that could work:

nickcoutsos commented 4 months ago

Hey, thanks for sharing this! I've been away so apologies for letting this hang without any response.

I like this idea for sure. I think it relates to the idea of a keymap export type feature in a lot of basic ways but having the "rich" format HTML output would be really valuable. Likewise, being able to share diagrams via URL is a big deal.

Both of these are achievable to some extent, I think, with keymap-drawer. It's possible to incorporate it in a GitHub action so that static diagrams are rendered when the branch is updated and I suspect that you can specify SVG output to get tooltips but don't quote me on that...

Otherwise, yeah, I think I'd need a read-only version of keymap-editor's rendering components. Depending on how much interactivity is expected that may not be too crazy as, technically, I'm already generating HTML in some way, it's just a question of spitting it (and dependent JS/CSS) out. I think it'd be limited to static content, though, as I try to keep backend usage of the system to a minimum.

I'll probably keep this stewing in the back of my head.

sebmos commented 4 months ago

I didn’t know about keymap-drawer until after I posted this. It is a decent substitute and I’ve set it up for my repo.

It makes me wonder if the keymap-editor could integrate more tightly with it, eg providing the ability to set labels, icons etc for keyboard shortcuts and macros that would go into the keymap-drawer config file. 🤔