How to get Chrome window name via Chrome API?

459 views
Skip to first unread message

Uladzimir Yankovich

unread,
Jun 23, 2023, 9:35:15 AM6/23/23
to Chromium Extensions

Oliver Dunk

unread,
Jun 23, 2023, 9:43:40 AM6/23/23
to Uladzimir Yankovich, Chromium Extensions
Hmm - I'm not immediately aware of a way to do that (I didn't even know about the feature!).

If nobody else jumps in, that might be a good one to open a bug for :)
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


On Fri, Jun 23, 2023 at 2:35 PM Uladzimir Yankovich <yank...@manganum.app> wrote:
https://gang.manganum.app/YL9YPzb4 

Any idea? 🤔

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/779645f9-0cff-4929-8a38-4a10e4e07765n%40chromium.org.

Jackie Han

unread,
Jun 23, 2023, 10:29:02 AM6/23/23
to Oliver Dunk, Uladzimir Yankovich, Chromium Extensions
This feature request was proposed two years ago. https://crbug.com/1190160
You can star it.

Deco

unread,
Jun 23, 2023, 10:52:33 AM6/23/23
to Uladzimir Yankovich, Chromium Extensions
It's not possible, specifically there is no way to fetch the window name (as mentioned by the feature request) whatsoever. The closest is with the ID that chrome.window generates for each tab, however you cannot use this as a way of mapping it as it is unique per session, meaning when the browser is closed, it will generate a new ID, and the ID itself has no inherit information in relation to what the window name is.

An actual implementation would need to be done outside the extension itself, e.g.: 
e.g: import pygetwindow as gw

# Get a list of all Chrome windows
chrome_windows = gw.getWindowsWithTitle('Chrome')

# Print the title of each window
for window in chrome_windows:
    print(window.title)
which is a hacky, but only real viable way to get the name until it's implemented in the API.

Cheers,
Deco

hrg...@gmail.com

unread,
Jun 23, 2023, 11:33:21 AM6/23/23
to Chromium Extensions, Deco, Chromium Extensions, Uladzimir Yankovich
This would require a new permission because it's personal information. Similar to the "tabs" permission or the "tabGroups" permission which give access to tab titles and group titles respectively.
I would prefer that one of those two permissions gave access to the window title as well, instead of creating a third permission.

Patrick Kettner

unread,
Jun 24, 2023, 12:42:35 AM6/24/23
to hrg...@gmail.com, Chromium Extensions, Deco, Uladzimir Yankovich
Please do star the issue and leave comments when relevant - they discuss the issues around permission naming in the thread.

Reply all
Reply to author
Forward
0 new messages