The unit you need is glfw and I think it's a default in the distribution of FPC. Else you can get it here. And basically from there all you do is event snoop. Try looking at Phoenix's phxScreen unit for insights into how Andreaz does it; best method I've seen yet and MPL licensed (free for commercial use). Or you could always make your own unit to handle the window management.