packages feed

gtk-sni-tray 0.1.3.2 → 0.1.4.0

raw patch · 2 files changed

+50/−9 lines, 2 filesdep ~status-notifier-item

Dependency ranges changed: status-notifier-item

Files

gtk-sni-tray.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.21.2.+-- This file has been generated from package.yaml by hpack version 0.27.0. -- -- see: https://github.com/sol/hpack ----- hash: d1e672e55e7a2e314add18da0c35b7cb0a029595671050692864ae0b56395ffa+-- hash: 39b472373d8713c0c95cb72bd424c5c44a8757887c342342219f7f433921feb7  name:           gtk-sni-tray-version:        0.1.3.2+version:        0.1.4.0 synopsis:       A standalone StatusNotifierItem/AppIndicator tray description:    Please see the README on Github at <https://github.com/IvanMalison/gtk-sni-tray#readme> category:       System@@ -54,7 +54,7 @@     , haskell-gi >=0.21.2     , haskell-gi-base >=0.21.1     , hslogger-    , status-notifier-item >=0.2.2.1 && <0.3.0.0+    , status-notifier-item >=0.3.0.0 && <0.4.0.0     , text     , transformers     , transformers-base >=0.4@@ -80,7 +80,7 @@     , gtk-strut     , hslogger     , optparse-applicative-    , status-notifier-item >=0.2.0.0 && <0.3.0.0+    , status-notifier-item >=0.3.0.0 && <0.4.0.0     , text     , unix   default-language: Haskell2010
src/StatusNotifier/Tray.hs view
@@ -208,6 +208,16 @@                                              showInfo info                                   in handlePixbuf +      getTooltipText ItemInfo { itemToolTip = Just (_, _, titleText, fullText )}+        | titleText == fullText = fullText+        | titleText == "" = fullText+        | fullText == "" = titleText+        | otherwise = printf "%s: %s" titleText fullText+      getTooltipText _ = ""++      setTooltipText widget info =+        Gtk.widgetSetTooltipText widget $ Just $ T.pack $ getTooltipText info+       updateHandler ItemAdded                     info@ItemInfo { menuPath = pathForMenu                                   , itemServiceName = serviceName@@ -276,6 +286,7 @@              flip Gtk.styleContextAddClass "tray-icon-image"            Gtk.containerAdd button image+          setTooltipText button info            maybeMenu <- sequenceA $ DM.menuNew (T.pack serviceNameStr) .                        T.pack <$> serviceMenuPathStr@@ -315,21 +326,51 @@                   MV.modifyMVar_ contextMap $ return . Map.delete name        updateHandler IconUpdated i = updateIconFromInfo i+      updateHandler OverlayIconUpdated i = updateIconFromInfo i -      updateHandler IconNameUpdated i = updateIconFromInfo i+      updateHandler ToolTipUpdated info@ItemInfo { itemServiceName = name } =+        void $ getContext name >>= traverse (flip setTooltipText info . contextButton)        updateHandler _ _ = return () +      maybeAddOverlayToPixbuf size info pixbuf = do+        runMaybeT $ do+          let overlayHeight = (size `div` 2)+          overlayPixbuf <- MaybeT $ getOverlayPixBufFromInfo overlayHeight info >>=+                           traverse (scalePixbufToSize overlayHeight Gtk.OrientationHorizontal)+          lift $ do+            trayLogger WARNING "Has overlay pixbuf"+            actualOHeight <- getPixbufHeight overlayPixbuf+            actualOWidth <- getPixbufWidth overlayPixbuf+            mainHeight <- getPixbufHeight pixbuf+            mainWidth <- getPixbufWidth pixbuf+            pixbufComposite overlayPixbuf pixbuf+              0 0                           -- Top left corner+              actualOWidth actualOHeight    -- Overlay size+              0 0                           -- Offset+              1.0 1.0                       -- Scale+              InterpTypeBilinear            -- InterpType+              255                           -- Source image alpha+        return pixbuf+       getScaledPixBufFromInfo size info =         getPixBufFromInfo size info >>=-        traverse (scalePixbufToSize size orientation)+        traverse (scalePixbufToSize size orientation >=>+                  maybeAddOverlayToPixbuf size info)        getPixBufFromInfo size                         info@ItemInfo { iconName = name                                       , iconThemePath = mpath                                       , iconPixmaps = pixmaps-                                      } = do-        logItemInfo info "Getting pixbuf"+                                      } = getPixBufFrom size name mpath pixmaps++      getOverlayPixBufFromInfo size+                               info@ItemInfo { overlayIconName = name+                                             , iconThemePath = mpath+                                             , overlayIconPixmaps = pixmaps+                                             } = getPixBufFrom size (fromMaybe "" name) mpath pixmaps++      getPixBufFrom size name mpath pixmaps = do         let tooSmall (w, h, _) = w < size || h < size             largeEnough = filter (not . tooSmall) pixmaps             orderer (w1, h1, _) (w2, h2, _) =