electron-titlebar-windows icon indicating copy to clipboard operation
electron-titlebar-windows copied to clipboard

Include title text

Open timfish opened this issue 8 years ago • 3 comments

It would be great to do this without any hackery:

image

timfish avatar Oct 08 '17 15:10 timfish

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 avatar Oct 09 '17 01:10 timfish

@timfish could you please provide some sample code for said hackery?

1nv1n avatar Oct 09 '18 00:10 1nv1n

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.

shachar-oren avatar Aug 15 '20 14:08 shachar-oren