balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

Possible to list favicons somehow? #50

Open MatthiasGrandl opened 3 years ago

MatthiasGrandl commented 3 years ago

Just stumbled across this extension. It's (almost) exactly what I need! The only thing that is missing is the ability to list favicons, so I can display them in Rofi/Wofi, as it would make things a little easier to parse. Is that possible? I think there is a way to get a data url from the tabs API, but it has been a while since I looked into this.

balta2ar commented 2 years ago

Totally understand you, it's much nicer with an icon. There's a method "query" which is pretty flexible on the input, but fixed on the output:

function queryTabsOnSuccess(tabs) {
  tabs.sort(compareWindowIdTabId);
  let lines = tabs.map(tab => `${tab.windowId}.${tab.id}\t${tab.title}\t${tab.url}`)
  console.log(lines);
  port.postMessage(lines);
}

I think it would be reasonable to return the whole tab as a JSON string here from browser back to mediator, and eventually to the client, and then the client could decide how to format it, including showing the raw json, which you could use to grab favIconUrl.