electron-titlebar-windows
electron-titlebar-windows copied to clipboard
Include title text
It would be great to do this without any hackery:

It might also be worth hooking it up to the page-title-updated event as then the title text will keep updated and will match what's displayed in the titlebar in Linux and Mac.
@timfish could you please provide some sample code for said hackery?
To add a title in Angular, in your component:
@ViewChild('titlebar', { static: true }) titlebarElement: ElementRef;
@ViewChild('titleLabel', { static: true }) titlebarLabelElement: ElementRef;
constructor(private elem: ElementRef) { }
ngOnInit(): void {
const titlebar = ...
titlebar.appendTo(this.titlebarElement.nativeElement);
let element = this.elem.nativeElement.querySelector('.titlebar') as HTMLElement;
element.appendChild(this.titlebarLabelElement.nativeElement);
}
where titlebarElement is a reference to the div the titlebar is appended to, titlebarLabelElement is an element containing the title string. We look for the div with the class titlebar and append our title to it. I set the title's position to be absolute in CSS.