From: https://github.com/hledgerorg/hledger/pull/2871
From: GuillaumedeVolpiano <xavier@wheredoibegin.fr>
Date: Sun, 29 Nov 2026 08:17:57 +0100
Subject: [PATCH] dev:support brick 3.1

--- a/Hledger/UI/Main.hs
+++ b/Hledger/UI/Main.hs
@@ -342,8 +342,12 @@ runBrickUi uopts0 j =
 
   if not (uoWatch uopts0)
   then do
+#if MIN_VERSION_brick(3,1,0)
+    void $ customMain (Just makevty) Nothing app ui
+#else
     vty <- makevty
     void $ customMain vty makevty Nothing app ui
+#endif
 
   else do
     -- a channel for sending misc. events to the app
@@ -400,8 +404,12 @@ runBrickUi uopts0 j =
             )
 
         -- and start the app. Must be inside the withManager block. (XXX makevty too ?)
+#if MIN_VERSION_brick(3,1,0)
+        void $ customMain (Just makevty) (Just eventChan) app ui
+#else
         vty <- makevty
         void $ customMain vty makevty (Just eventChan) app ui
+#endif
 
 brickApp :: Maybe String -> App UIState AppEvent Name
 brickApp mtheme = App {
