Customize browser tab title?

Right now the title of the browser tab is identical to the title of the note being viewed. Journal/Week/2024-04-22, or SETTINGS, for example. I’d like to add a postfix to the title. Journal/Week/2024-04-22 - SilverBullet, or SETTINGS - SilverBullet.

Is this possible to do? The Space Script feature sounds promising. If I can hook the function that sets the browser title and change the string in-flight, that could work. But I’m a little bit lost trying to find the function I’d need to hook.

My use case is using Hammerspoon to add a hotkey for the SilverBullet browser tab.

This is hacky, but this seems to work:

```space-script
silverbullet.registerEventListener({name: "editor:pageLoaded"}, (event) => {
  const pageName = event.data[0];
  setTimeout(() => {
    document.title = `${pageName} - whatever`;  
  });
});
```
1 Like