gtk-sni-tray 0.1.10.1 → 0.1.10.2
raw patch · 6 files changed
+27/−28 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +7/−0
- app/Main.hs +6/−5
- gtk-sni-tray.cabal +1/−1
- src/StatusNotifier/DBus/Client/Util.hs +0/−1
- src/StatusNotifier/TransparentWindow.hs +0/−4
- src/StatusNotifier/Tray.hs +13/−17
ChangeLog.md view
@@ -1,5 +1,12 @@ # Changelog for gtk-sni-tray +## 0.1.10.2++- Fix menu popups not appearing: restore `widgetShowAll` so menu items are+ visible, and use `menuPopupAtPointer` for reliable positioning on both X11+ and Wayland.+- Fix all `-Wall` warnings across library and executable.+ ## 0.1.10.1 - Fix menu popup positioning on Wayland: use `menuAttachToWidget` instead of
app/Main.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-deprecations #-} module Main where import Control.Monad@@ -7,7 +8,6 @@ import Data.Char (toLower) import Data.Maybe import Data.Ratio-import Data.Semigroup ((<>)) import qualified Data.Map.Strict as Map import qualified Data.Text as T import Data.Version (showVersion)@@ -468,6 +468,7 @@ <> value (5 % 7) ) +getColor :: String -> IO Gdk.RGBA getColor colorString = do rgba <- Gdk.newZeroRGBA colorParsed <- Gdk.rGBAParse rgba (T.pack colorString)@@ -491,8 +492,8 @@ -> Rational -> IO () buildWindows pos align size padding monitors priority backendChoice maybeColorString expand- startWatcher noStrut length overlayScale = do- Gtk.init Nothing+ startWatcher noStrut barLength overlayScale = do+ _ <- Gtk.init Nothing logger <- getLogger "StatusNotifier" saveGlobalLogger $ setLevel priority logger detectedBackend <- detectBackend@@ -510,7 +511,7 @@ unless startWatcher $ logM "StatusNotifier" WARNING $ "Start a watcher first (recommended) or run with --watcher to start one in-process."- logger <- getRootLogger+ _ <- getRootLogger pid <- getProcessID host <- Host.build@@ -529,7 +530,7 @@ , strutXPadding = padding , strutYPadding = padding }- defaultRatio = ScreenRatio length+ defaultRatio = ScreenRatio barLength configBase = case pos of TopPos -> c1 {strutHeight = ExactSize size, strutWidth = defaultRatio}
gtk-sni-tray.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: gtk-sni-tray-version: 0.1.10.1+version: 0.1.10.2 synopsis: A standalone StatusNotifierItem/AppIndicator tray description: Please see the README on Github at <https://github.com/IvanMalison/gtk-sni-tray#readme> category: System
src/StatusNotifier/DBus/Client/Util.hs view
@@ -16,7 +16,6 @@ import qualified Data.Char as Char import qualified Data.Coerce as Coerce import qualified Data.Maybe as Maybe-import qualified Data.Text as T import qualified Data.Text.IO as TIO import Language.Haskell.TH import Language.Haskell.TH.Syntax (addDependentFile, makeRelativeToProject)
src/StatusNotifier/TransparentWindow.hs view
@@ -17,10 +17,6 @@ module StatusNotifier.TransparentWindow where import Control.Monad.IO.Class-import Control.Monad.Trans.Reader-import Data.GI.Base-import Foreign.Ptr (castPtr)-import GI.Cairo hiding (OperatorOver, OperatorSource) import GI.Cairo.Render import GI.Cairo.Render.Connector import qualified GI.Gdk as Gdk
src/StatusNotifier/Tray.hs view
@@ -112,8 +112,8 @@ catchGErrorsAsNothing :: IO a -> IO (Maybe a) catchGErrorsAsNothing action = catchGErrorsAsLeft action >>= rightToJustLogLeft where rightToJustLogLeft (Right value) = return $ Just value- rightToJustLogLeft (Left error) = do- trayLogger WARNING $ printf "Encountered error: %s" $ show error+ rightToJustLogLeft (Left err) = do+ trayLogger WARNING $ printf "Encountered error: %s" $ show err return Nothing safePixbufNewFromFile :: FilePath -> IO (Maybe Gdk.Pixbuf)@@ -205,6 +205,7 @@ , trayRightClickAction :: TrayClickAction } +defaultTrayParams :: TrayParams defaultTrayParams = TrayParams { trayOrientation = Gtk.OrientationHorizontal , trayImageSize = Expand@@ -362,17 +363,12 @@ } popupGtkMenu gtkMenu triggerEvent = do- -- On Wayland (e.g. Hyprland) popups need the triggering input- -- event so GTK can associate the popup with the correct seat/- -- serial. Also, anchor to the EventBox rather than the Image- -- (GtkImage is typically "no-window"), or the popup may be- -- positioned/realized incorrectly. Gtk.menuAttachToWidget gtkMenu eventBox Nothing _ <- Gtk.onWidgetHide gtkMenu (Gtk.widgetDestroy gtkMenu)+ Gtk.widgetShowAll gtkMenu evPtr <- ManagedPtr.unsafeManagedPtrCastPtr triggerEvent :: IO (Ptr Gdk.Event) ManagedPtr.withTransient evPtr $ \ev ->- Gtk.menuPopupAtWidget gtkMenu eventBox- GravitySouthWest GravityNorthWest (Just ev)+ Gtk.menuPopupAtPointer gtkMenu (Just ev) _ <- Gtk.onWidgetButtonPressEvent eventBox $ \event -> do mouseButton <- Gdk.getEventButtonButton event@@ -445,7 +441,7 @@ updateHandler _ _ = return () maybeAddOverlayToPixbuf size info pixbuf = do- runMaybeT $ do+ _ <- runMaybeT $ do let overlayHeight = floor (fromIntegral size * overlayScale) overlayPixbuf <- MaybeT $ getOverlayPixBufFromInfo overlayHeight info >>=@@ -453,8 +449,8 @@ lift $ do actualOHeight <- getPixbufHeight overlayPixbuf actualOWidth <- getPixbufWidth overlayPixbuf- mainHeight <- getPixbufHeight pixbuf- mainWidth <- getPixbufWidth pixbuf+ _mainHeight <- getPixbufHeight pixbuf+ _mainWidth <- getPixbufWidth pixbuf pixbufComposite overlayPixbuf pixbuf 0 0 -- Top left corner actualOWidth actualOHeight -- Overlay size@@ -470,13 +466,13 @@ maybeAddOverlayToPixbuf size info) getPixBufFromInfo size- info@ItemInfo { iconName = name- , iconThemePath = mpath- , iconPixmaps = pixmaps- } = getPixBufFrom size name mpath pixmaps+ ItemInfo { iconName = name+ , iconThemePath = mpath+ , iconPixmaps = pixmaps+ } = getPixBufFrom size name mpath pixmaps getOverlayPixBufFromInfo size- info@ItemInfo+ ItemInfo { overlayIconName = name , iconThemePath = mpath , overlayIconPixmaps = pixmaps