Files
dotfiles/nixos/patches/kanshi-sni-keep-menu-root-alive.patch

31 lines
992 B
Diff
Raw Normal View History

--- a/src/Kanshi/SNI.hs
+++ b/src/Kanshi/SNI.hs
2026-04-24 01:30:03 -07:00
@@ -42,7 +42,8 @@
data SNIState = SNIState
{ sniConnection :: MVar (Maybe KanshiConnection)
, sniAppState :: MVar AppState
+ , sniMenuRoot :: MVar Dbusmenu.Menuitem
, sniMenuServer :: Dbusmenu.Server
, sniGLibContext :: GLib.MainContext
}
2026-04-24 01:30:03 -07:00
@@ -77,8 +78,10 @@
appState <- buildInitialState kanshiConn
connVar <- newMVar kanshiConn
stateVar <- newMVar appState
+ initialRoot <- Dbusmenu.menuitemNew
+ rootVar <- newMVar initialRoot
2026-04-24 01:30:03 -07:00
- let sniState = SNIState connVar stateVar menuServer context
+ let sniState = SNIState connVar stateVar rootVar menuServer context
2026-04-24 01:30:03 -07:00
-- Build initial menu
rebuildMenu sniState
@@ -177,6 +179,7 @@
, onToggleMonitor = handleToggleMonitor sniState
}
newRoot <- buildMenu state actions
+ modifyMVar_ (sniMenuRoot sniState) $ const (pure newRoot)
runOnGLibMain (sniGLibContext sniState) $
Dbusmenu.serverSetRoot (sniMenuServer sniState) newRoot