Hello folks,
I’m currently tinkering with an extension that allows Elgato Streamdeck to switch profiles depending on the file type currently edited in Nova.
By default, Streamdeck allows you to switch profiles based on apps, not based on content in a specific app.
It’s working well now. I have a profil for PHP/HTML, another for JS/TS, another for CSS/SCSS/LESS,… so sweet
Because in the Nova extension API there is no event when a editor get focus (so sad), i use onDidChangeSelection as event to check the current edited file type.
As onDidChangeSelection triggers a lot of events, i store the last file type change and do the rest of the process only if the previous type is different than the current, for performance reasons. And it’s quite nice, performant enough and stable.
But Streamdeck not only switch profil with Nova. I have a profil for the Finder, a profil for the browser, ect…
So when i activate my browser, Streamdeck switch to the browser profil.
But when i go back to Nova, because i store the last edited file type and the current is the same, no profil switch, then i stay with “browser profil” on the Streamdeck.
It’s not difficult to solve, i just have to open or edit another file with another file type, Streamdeck profil switch accordingly and everything goes back to normal. But it’s quite annoying.
So, is there a way to :
- trigger something when Nova go in back or in front, i would be able to empty the last file type variable ?
- something else than onDidChangeSelection to use, more performant, to know when the current edited file change ?
Thank you !