wxt icon indicating copy to clipboard operation
wxt copied to clipboard

Provide a way to reopen the browser

Open WOSHIZHAZHA120 opened this issue 1 year ago • 2 comments

Feature Request

Provides a way to reopen the browser. For example, Vite can be restarted using the r key.

Is your feature request related to a bug?

N/A

What are the alternatives?

Restarted the wxt process but also trigger the build

Additional context

WOSHIZHAZHA120 avatar Jan 16 '24 11:01 WOSHIZHAZHA120

We can listen for key presses like so:

let readline = require('readline');

readline.emitKeypressEvents(process.stdin);

process.stdin.on('keypress', (ch, key) => {
  console.log('got "keypress"', ch, key);
  if (key && key.ctrl && key.name == 'c') {
    process.stdin.pause();
  }
});

process.stdin.setRawMode(true);

– https://stackoverflow.com/questions/43286881/how-do-i-detect-whether-a-key-is-pressed-in-node-js#answer-74545520

Here's how Vite does it:

https://github.com/vitejs/vite/blob/bf1e9c2fd7b05f84d05e59f72b3fc26ca22807bb/packages/vite/src/node/shortcuts.ts

aklinker1 avatar Jan 16 '24 20:01 aklinker1

I like the idea of a few keyboard shortcuts for the dev server.

aklinker1 avatar Jan 16 '24 20:01 aklinker1