Listen to key press without content script

I am currently using a content script to listen to key presses but I would like to avoid that because of the permissions content scripts require.

My goal is to create keyboard shortcuts but I can’t use browser.commands because I need to be able to create and delete them at run time.

If you can’t use commands then you have to use a content script. If you could have an initial keyboard shortcut for further shortcuts, you could have a command to trigger injection of the content script, so you can get away with activeTab I think.

I will try that, thanks