electron-seamless-titlebar-tutorial icon indicating copy to clipboard operation
electron-seamless-titlebar-tutorial copied to clipboard

CSS window border workaround - high DPI scaling issues

Open binaryfunt opened this issue 5 years ago • 2 comments

Related to #11, the CSS border for the frameless Electron window becomes more than 1 physical pixel thick while maintaining a thickness of 1 device independent pixel on high scaling factors.

Could try something like this.

binaryfunt avatar Feb 17 '20 16:02 binaryfunt

I've just noticed on 125% scaling, when the border is still 1 physical px thick, the bottom & right borders sometimes don't show depending on the size of the window (https://github.com/electron/electron/issues/10862, or see this GIF). This seems to happen most of the time unless the window's width/height are at specific arbitrary values. It seems to be a Chromium bug as opposed to Electron itself, as I can reproduce on Chrome 80.

Ideally frameless windows should support native Windows borders, but the corresponding issue https://github.com/electron/electron/issues/7172 hasn't received much attention. Frustrating!

binaryfunt avatar Apr 13 '20 21:04 binaryfunt

Yes, I've been frustrated with this problem for a long time, I mentioned it a while ago. It happens on any scaling that isn't a multiple of 100. There isn't really any fix as far as I know though, the window border is kinda hard to get right especially since the native one is transparent. Google Chrome itself uses a custom window but native 1px border, which would be a nice option in electron.

IMHO, the border should be taken out entirely, because it has at least three problems and no other electron/nwjs app with a custom window (Discord, Teams, Slack, VS Code, GitHub Desktop) has as 1px border of any kind. And it still looks great without it!

Toby56 avatar Apr 14 '20 00:04 Toby56