-
Notifications
You must be signed in to change notification settings - Fork 0
/
hoverlay.hs
46 lines (37 loc) · 1.1 KB
/
hoverlay.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Control.Monad
import System.IO
import System.Environment
import System.Posix.Signals
import Graphics.UI.Gtk
import PipeListener
import GtkHelpers
main = do
args <- getArgs
pipePath <- case args of
[path] -> return path
_ -> do
home <- getEnv "HOME"
return $ home ++ "/.MumbleOverlayPipe"
initGUI
w <- windowNew
windowSetTitle w "Mumble Overlay"
onDestroy w mainQuit
widgetSetAppPaintable w True
windowSetDecorated w False
widgetSetEvents w []
widgetGetScreen w >>= setRGBAColorMap w
on w screenChanged $ setRGBAColorMap w
onRealize w $ do
dw <- widgetGetDrawWindow w
drawWindowSetOverrideRedirect dw True
withCairoRegion $ \region ->
drawWindowInputShapeCombineRegion dw region 0 0
forkPipeListener pipePath w
widgetShowAll w
installHandler sigINT (CatchOnce mainQuit) Nothing
mainGUI
where
setRGBAColorMap window screen =
screenGetRGBAColormap screen >>= \mc -> case mc of
Just c -> widgetSetColormap window c
Nothing -> hPutStrLn stderr "no rgba colormap"