diff options
author | jao <jao@gnu.org> | 2022-09-11 18:54:34 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-09-11 19:22:57 +0100 |
commit | 7b6542e6b13d5457509a3bf79e3ad3ad9a42e48e (patch) | |
tree | 136e52af523e4a6924705a92393ebabcc5b95363 /src/Xmobar/X11/Bitmap.hs | |
parent | d7299a0b80f0b15f820a1b7533549e306755441c (diff) | |
download | xmobar-7b6542e6b13d5457509a3bf79e3ad3ad9a42e48e.tar.gz xmobar-7b6542e6b13d5457509a3bf79e3ad3ad9a42e48e.tar.bz2 |
x event loop clean-ups
Diffstat (limited to 'src/Xmobar/X11/Bitmap.hs')
-rw-r--r-- | src/Xmobar/X11/Bitmap.hs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/Xmobar/X11/Bitmap.hs b/src/Xmobar/X11/Bitmap.hs index 026cd5c..027462d 100644 --- a/src/Xmobar/X11/Bitmap.hs +++ b/src/Xmobar/X11/Bitmap.hs @@ -14,17 +14,16 @@ module Xmobar.X11.Bitmap ( updateCache , drawBitmap - , Bitmap(..)) where + , Bitmap(..) + , BitmapCache) where import Control.Monad import Control.Monad.Trans(MonadIO(..)) -import Data.Map hiding (map, filter) -import Graphics.X11.Xlib +import Data.Map hiding (map) +import Graphics.X11.Xlib hiding (Segment) import System.Directory (doesFileExist) import System.FilePath ((</>)) import System.Mem.Weak ( addFinalizer ) -import Xmobar.Run.Actions (Action) -import Xmobar.Run.Parsers (TextRenderInfo(..), Widget(..)) import Xmobar.X11.ColorCache #ifdef XPM @@ -53,14 +52,12 @@ data Bitmap = Bitmap { width :: Dimension , bitmapType :: BitmapType } -updateCache :: Display -> Window -> Map FilePath Bitmap -> FilePath - -> [[(Widget, TextRenderInfo, Int, Maybe [Action])]] - -> IO (Map FilePath Bitmap) -updateCache dpy win cache iconRoot ps = do - let paths = map (\(Icon p, _, _, _) -> p) . concatMap (filter icons) $ ps - icons (Icon _, _, _, _) = True - icons _ = False - expandPath path@('/':_) = path +type BitmapCache = Map FilePath Bitmap + +updateCache :: Display -> Window -> Map FilePath Bitmap -> FilePath -> [FilePath] + -> IO BitmapCache +updateCache dpy win cache iconRoot paths = do + let expandPath path@('/':_) = path expandPath path@('.':'/':_) = path expandPath path@('.':'.':'/':_) = path expandPath path = iconRoot </> path |