summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-06-20 16:27:42 +0200
committerHannes Schulze <haschu0103@outlook.de>2025-06-20 16:27:42 +0200
commit519956797d905c0925b8dd418ceb17c7495ad30a (patch)
tree5a26d1b6df1ddce517a47d3105761820b29a8953 /app
parent1af3d14f3f995645a0de08a54b244c19840709e9 (diff)
set up haskell bindings for c lib
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs29
-rw-r--r--app/foobar.cabal19
2 files changed, 48 insertions, 0 deletions
diff --git a/app/Main.hs b/app/Main.hs
new file mode 100644
index 0000000..609b53d
--- /dev/null
+++ b/app/Main.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+{-# LANGUAGE ImplicitParams #-}
+
+import Control.Monad (void)
+import Data.GI.Base
+import qualified GI.Gtk as Gtk
+import qualified GI.Gio as Gio
+import qualified GI.Foobar as FB
+
+activate :: Gtk.Application -> IO ()
+activate app = do
+ button <- new Gtk.Button [ #label := "Hello, world!" ]
+ window <- new Gtk.ApplicationWindow [ #application := app
+ , #title := "Test"
+ , #child := button ]
+ _ <- FB.serverProxyNewForBusSync Gio.BusTypeSession
+ []
+ "com.github.hannesschulze.foobar"
+ "/com/github/hannesschulze/foobar/server"
+ (Nothing :: Maybe Gio.Cancellable)
+ window.show
+
+main :: IO ()
+main = do
+ app <- new Gtk.Application [ #applicationId := "com.github.hannesschulze.foobar-hs"
+ , On #activate (activate ?self) ]
+ void $ app.run Nothing
diff --git a/app/foobar.cabal b/app/foobar.cabal
new file mode 100644
index 0000000..7dcebc6
--- /dev/null
+++ b/app/foobar.cabal
@@ -0,0 +1,19 @@
+cabal-version: 3.0
+name: foobar
+version: 2.0.0
+synopsis: A simple bar, launcher, control center, and notification daemon.
+build-type: Simple
+
+common warnings
+ ghc-options: -Wall
+
+executable foobar
+ import: warnings
+ main-is: Main.hs
+ build-depends: base,
+ haskell-gi,
+ haskell-gi-base,
+ gi-gio,
+ gi-gtk4,
+ gi-foobar
+ default-language: Haskell2010