Custom minimize and exit buttons in frameless window?

I’m making a frameless window, since I think my app will look horrible with the standard windows 10 title bar. I still want the user to be able to minimize and close the window, so I figured I’d just make my own buttons to minimize and exit the Window. I looked up quite a few solutions and ended up with this:

const { remote } = require('electron').remote;
var window = remote.getCurrentWindow();

function MinimizeWindow(){
    window.minimize();
}
function ExitWindow(){
    window.close();
}

All I found is that this completely bricks the script, proven by this:

document.getElementById('TestDiv').innerHTML = 'you like men';

where nothing changed until I commented out everything except for that line. Anything after and including const { remote }... doesn’t work. I looked it up again and found one answer, saying it was because I was in the main process and not the render process. I have no clue what that is even after looking at multiple stackoverflow and reddit posts. Is there any way to actually make my own title bar buttons or do I need to keep the standard W10 title bar?