Add addon: title

This commit is contained in:
Fierelier 2022-12-19 19:20:04 +01:00
parent 34d3249874
commit 83e65f4273
1 changed files with 15 additions and 0 deletions

15
user/addon/title/_main.py Normal file
View File

@ -0,0 +1,15 @@
eventHandler = mfp.Bunch()
browser = mfp.require("browser")
def onTitleChanged(obj,prop):
title = obj.get_title()
if title == "": title = obj.get_uri()
window = obj.cWindow
if len(window.cWebViews) > 1:
title = "Multiple pages"
window.set_title(title + " - " + browser.name)
def onWebviewCreated(webView):
webView.connect("notify::title",onTitleChanged)
eventHandler["webview:created"] = onWebviewCreated