Adjusting Gmail Mail Pane Width with Greasemonkey or Gmail API

How can I resize Gmail’s main mail area using Greasemonkey or the Gmail API? The following test script fails to work as intended:

document.addEventListener('DOMContentLoaded', () => {
  if (window.scriptController) {
    window.scriptController.initialize('v1.0', (apiClient) => {
      apiClient.getPrimaryContainer().style.width = '450px';
    });
  }
});

hey, try delaying script exection using a timeout. gmail loads some parts after domcontentloaded so your target might not be ready at that time. i had similar issues and waiting a bit worked for me. good luck!