Virtual desktop underlay for Wayland and X11
git clone https://github.com/m-col/xanadu
Files | Refs | Readme | License

Commit 1a77d57f9a71273222e4e2c9712835551b2d4bdf
Parent: 4bcbad45b226968fafae84208d1c682e8cce81b4
Author: mcol <mcol@posteo.net>
Date: 2021-11-02 01:42:08 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-02 01:42:08 +0000

addCSS: get screen from window to avoid Maybe

src/Window.hs Modified

@@ -28,7 +28,7 @@
         Nothing -> error "Could not open display."
         Just (width, height) -> Gtk.windowSetDefaultSize win width height
 
-    addCSS
+    addCSS win
     Gtk.windowSetTypeHint win Enums.WindowTypeHintDesktop
     return win
 
@@ -41,11 +41,9 @@
     height <- Gdk.getRectangleHeight rect
     return (width, height)
 
-addCSS :: IO ()
-addCSS =
-    Gdk.screenGetDefault >>= \case
-        Nothing -> error "Could not find screen."
-        Just screen -> do
-            cssProvider <- Gtk.cssProviderNew
-            Gtk.cssProviderLoadFromData cssProvider "* { background-color: transparent; }"
-            Gtk.styleContextAddProviderForScreen screen cssProvider 800
+addCSS :: Gtk.ApplicationWindow -> IO ()
+addCSS win = do
+    screen <- Gtk.windowGetScreen win
+    cssProvider <- Gtk.cssProviderNew
+    Gtk.cssProviderLoadFromData cssProvider "* { background-color: transparent; }"
+    Gtk.styleContextAddProviderForScreen screen cssProvider 800