asticode / go-astilectron-demo

Discover the power of Astilectron through a demo app
MIT License
404 stars 83 forks source link

Custom Titlebar #67

Closed roociferSonOfTheMorning closed 3 years ago

roociferSonOfTheMorning commented 3 years ago

I am looking for some guidance for a custom titlebar. Something similar to custom-electron-titlebar but simpler. I am specifically looking for drag, min, max and close.

I've seen a few tickets within your astilectron projects the make me think other people are doing something like this.

Could you provide some guidance on how I would build this or maybe you know of someone who has a public project with this implemented?

Thank you for your time!

asticode commented 3 years ago

I don't see how you can add this directly in electron. However, if I were you, I would implement it in HTML/JS/CSS since in JS you have access to nodeJS functions and the window object

roociferSonOfTheMorning commented 3 years ago

I am wanting to implement in html/js/css, I am a little confused as how to get started.

roociferSonOfTheMorning commented 3 years ago

if I were to follow a tutorial like this: https://github.com/binaryfunt/electron-seamless-titlebar-tutorial

How would I go about controlling the window in step 8 using the astilectron object in js?

roociferSonOfTheMorning commented 3 years ago

should I send a message and handle it in the MessageHandler where I have access to the window or is there a way of manipulating the window in javascript?

asticode commented 3 years ago

Right now you can use the code in step 8 since you still have access to the remote attribute. However, this attribute is deprecated and will be removed in next Electron versions.

Therefore, if I were you, I'd do it the way you've described in your last comment : send a message to GO and let it do the proper action on the window.

roociferSonOfTheMorning commented 3 years ago

Thank you very much for your help, I've got it working this morning!