Skip to content

Commit

Permalink
Change sidebar title too
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Oct 4, 2019
1 parent 652313a commit c556a0b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions custom_components/favicon/__init__.py
Expand Up @@ -101,6 +101,19 @@ def new_render(*args, **kwargs):
text = text.replace("/static/icons/favicon-apple-180x180.png", icons["apple"])
if title:
text = text.replace("<title>Home Assistant</title>", f"<title>{title}</title>")
text = text.replace("<body>", f"""<body>
<script type="module">
customElements.whenDefined('ha-sidebar').then(() => {{
const Sidebar = customElements.get('ha-sidebar');
const firstUpdated = Sidebar.prototype.firstUpdated;
Sidebar.prototype.firstUpdated = function(changedProps) {{
firstUpdated.bind(this)(changedProps);
this.shadowRoot.querySelector(".menu .title").innerHTML = "{title}";
}}
}});
</script>
""")

return text

tpl.render = new_render
Expand Down

0 comments on commit c556a0b

Please sign in to comment.