MacGapProject / MacGap2

MacGap 2
MIT License
1.2k stars 84 forks source link

Custom titlebar (transparent and draggable area) #86

Closed faejr closed 6 years ago

faejr commented 6 years ago

I don't usually code in Obj-C so please provide any feedback you may have.

This implements options in the config file to hide the titlebar (make it transparent) and create a draggable area at the top with the height of your choice.

Which should be easier than having to explain how to make the titlebar transparent as per #41

jeff-h commented 6 years ago

Great! I assume this doesn't work with Spaces etc but is still a very useful addition, I think.

faejr commented 6 years ago

Glad it got merged! In which use case do you believe it wouldn't with? I'm not sure what you mean by "Spaces" in this scenario.

jeff-h commented 6 years ago

I'm referring to macOS spaces (ie System Preferences > Mission Control). An ordinary Cocoa window will allow you to drag the window to the top of your screen and hold it there, which will enable the "spaces arranging mode" (not sure of the actual terminology!) and you can drag that window into any other space.

I imagine apps built using your code won't activate this. The macOS Slack client (built with Electron) likewise does not work in this scenario.

Not sure if it went away in High Sierra, but I previously was also able to drag a window to the side of my screen and hold it there, and it would switch to the next space beside it, moving the window to that space. That no longer works on my Mac though — not entirely sure why!

jeff-h commented 6 years ago

I just tried Kitematic (also an Electron app) and it does trigger the usual window-drag-to-another-space functionality. So it's apparently not implicit to full-screen javascript-controlled window drags.

Sorry for all the words — I don't have time to try your code, so hoping you can clarify this point for me: does your code allow you to drag the window to another space?

faejr commented 6 years ago

You're definitely right, this doesn't trigger the screens feature seeing as it is using a custom draggable handler. It completely slipped my mind while developing this feature. I'll see if I can come up with any solution and create a PR.

jeff-h commented 6 years ago

I don't think it's a major issue really — but it would be interesting to see how those Electron apps have achieved it (eg Kitematic). Thanks for your work!