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

Commit 0b7e858a6d56a88eef09c3d188327c33f10d90e3
Parent: ff63a185844b28e86b5db5d1ab8a643a673a8d6e
Author: mcol <mcol@posteo.net>
Date: 2021-11-02 01:32:12 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-02 01:32:12 +0000

Make background of window transparent

src/Window.hs Modified

@@ -1,3 +1,4 @@
+{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE OverloadedLabels #-}
 {-# LANGUAGE OverloadedStrings #-}
 
@@ -27,6 +28,7 @@
         Nothing -> error "Could not open display."
         Just (width, height) -> Gtk.windowSetDefaultSize win width height
 
+    addCSS
     Gtk.windowSetTypeHint win Enums.WindowTypeHintDesktop
     return win
 
@@ -38,3 +40,12 @@
     width <- Gdk.getRectangleWidth rect
     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