gtk-sni-tray 0.1.4.0 → 0.1.5.0
raw patch · 3 files changed
+21/−10 lines, 3 files
Files
- app/Main.hs +14/−3
- gtk-sni-tray.cabal +3/−4
- src/StatusNotifier/Tray.hs +4/−3
app/Main.hs view
@@ -116,8 +116,8 @@ startWatcherP = switch ( long "watcher"- <> help "Start a Watcher to handle SNI registration if one does not exist" <> short 'w'+ <> help "Start a Watcher to handle SNI registration if one does not exist" ) barLengthP :: Parser Rational@@ -128,6 +128,15 @@ <> value 1 ) +overlayScaleP :: Parser Rational+overlayScaleP =+ option auto+ ( long "overlay-scale"+ <> short 'o'+ <> help "The proportion of the tray icon's size that should be set for overlay icons."+ <> value (5 % 7)+ )+ getColor colorString = do rgba <- Gdk.newZeroRGBA colorParsed <- Gdk.rGBAParse rgba (T.pack colorString)@@ -146,9 +155,10 @@ -> Bool -> Bool -> Rational+ -> Rational -> IO () buildWindows pos align size padding monitors priority maybeColorString expand- startWatcher length = do+ startWatcher length overlayScale = do Gtk.init Nothing logger <- getLogger "StatusNotifier" saveGlobalLogger $ setLevel priority logger@@ -195,6 +205,7 @@ , trayImageSize = Expand , trayIconExpand = expand , trayAlignment = align+ , trayOverlayScale = overlayScale } window <- Gtk.windowNew Gtk.WindowTypeToplevel setupStrutWindow config window@@ -217,7 +228,7 @@ parser = buildWindows <$> positionP <*> alignmentP <*> sizeP <*> paddingP <*> monitorNumberP <*> logP <*> colorP <*> expandP <*> startWatcherP <*>- barLengthP+ barLengthP <*> overlayScaleP versionOption :: Parser (a -> a) versionOption = infoOption
gtk-sni-tray.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.27.0.+-- This file has been generated from package.yaml by hpack version 0.28.2. -- -- see: https://github.com/sol/hpack ----- hash: 39b472373d8713c0c95cb72bd424c5c44a8757887c342342219f7f433921feb7+-- hash: 067fc5601dbe657896605cceec402ebd1bd4bc70ddaf12463634b8149c9487a7 name: gtk-sni-tray-version: 0.1.4.0+version: 0.1.5.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@@ -18,7 +18,6 @@ license-file: LICENSE build-type: Simple cabal-version: >= 1.10- extra-source-files: ChangeLog.md README.md
src/StatusNotifier/Tray.hs view
@@ -123,7 +123,7 @@ sequenceA $ pixbufNewFromFile <$> maybeFile getIconPathFromThemePath :: String -> String -> IO (Maybe String)-getIconPathFromThemePath name themePath = do+getIconPathFromThemePath name themePath = if name == "" then return Nothing else do trayLogger DEBUG $ printf "Trying to load icon %s as filepath with theme path %s" name themePath@@ -161,6 +161,7 @@ , trayImageSize :: TrayImageSize , trayIconExpand :: Bool , trayAlignment :: StrutAlignment+ , trayOverlayScale :: Rational } buildTray :: TrayParams -> IO Gtk.Box@@ -174,6 +175,7 @@ , trayImageSize = imageSize , trayIconExpand = shouldExpand , trayAlignment = alignment+ , trayOverlayScale = overlayScale } = do trayLogger INFO "Building tray" @@ -335,11 +337,10 @@ maybeAddOverlayToPixbuf size info pixbuf = do runMaybeT $ do- let overlayHeight = (size `div` 2)+ let overlayHeight = floor (fromIntegral size * overlayScale) 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