message: Quantize the UI scaling factor to an int
diff: @@ -143,6 +143,9 @@ function main(): void {
  // This method will be called when Electron has done everything
  // initialization and ready for creating browser windows.
  app.on('ready', function() {
  + if (setScaleFactor()) {
  + return;
  + }
  startIpc();
  @@ -185,6 +188,19 @@ function main(): void {
  });
  }
  +function setScaleFactor(): boolean {
  + const primaryDisplay = screen.getPrimaryDisplay();
  + log("Display scale factor is ", primaryDisplay.scaleFactor);
  + if (primaryDisplay.scaleFactor !== 1 && primaryDisplay.scaleFactor !== 2) {
  + const scaleFactor = primaryDisplay.scaleFactor < 1.5 ? 1 : 2;
  + app.relaunch({args: process.argv.slice(1).concat(['--relaunch', '--force-device-scale-factor=' + scaleFactor])});
  + log("Restarting with scale factor ", scaleFactor);
  + app.exit(0);
  + return true; // true means a restart is coming.
  + }
  + return false;
  +}
  +
  const _log = new Logger("main");
  function log(msg: any, ...opts: any[]): void {
  _log.debug(msg, ...opts);
  