diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-18 20:57:19 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-18 20:57:19 +0200 |
commit | 581e1f9c63101fd2a00711748415997b0c20b793 (patch) | |
tree | ab2ee291354819727939593655e0a53383870b03 /lib/Phi/Widgets/Taskbar.hs | |
parent | 4cc0f0f2ee44aa5c65b8b7f759620b5de0c874a3 (diff) | |
download | phi-581e1f9c63101fd2a00711748415997b0c20b793.tar phi-581e1f9c63101fd2a00711748415997b0c20b793.zip |
Make minSize depend on the screen if necessary
Diffstat (limited to 'lib/Phi/Widgets/Taskbar.hs')
-rw-r--r-- | lib/Phi/Widgets/Taskbar.hs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/Phi/Widgets/Taskbar.hs b/lib/Phi/Widgets/Taskbar.hs index e1d0ed9..f8b61f0 100644 --- a/lib/Phi/Widgets/Taskbar.hs +++ b/lib/Phi/Widgets/Taskbar.hs @@ -170,7 +170,7 @@ instance WidgetClass Taskbar where return $ TaskbarState 0 0 (-1) [] M.empty M.empty M.empty M.empty - minSize _ _ _ = 0 + minSize _ _ _ _ = 0 weight _ = 1 render (Taskbar config) TaskbarState { taskbarActiveWindow = activeWindow @@ -182,21 +182,24 @@ instance WidgetClass Taskbar where , taskbarWindowScaledIcons = windowScaledIcons , taskbarWindowScreens = windowScreens } w h screen = do - let screenWindows = filter ((== Just screen) . flip M.lookup windowScreens) windows + let screenWindows = filter ((== Just screen) . flip M.lookup windowScreens) windows desktopNumbers = take desktopCount [0..] - desktops = map (\desktop -> (desktop, filter (fromMaybe False . fmap (windowOnDesktop desktop) . flip M.lookup windowStates) screenWindows)) desktopNumbers - windowCount = sum $ map (length . snd) $ desktops - dstyle d = fmap (if d == currentDesktop then snd else fst) $ desktopStyle config - dlabelwidth d = fromMaybe 0 $ fmap desktopLabelWidth $ dstyle d - gap d ds = if null (snd $ desktops !! d) then 0 else desktopLabelGap ds - dleftwidth d = fromMaybe 0 $ fmap (\ds@DesktopStyle {desktopBorder = border} - -> (borderLeft $ margin border) + (borderWidth border) + (borderLeft $ padding border) - + dlabelwidth d + gap d ds) $ dstyle d - dwidth d = fromMaybe 0 $ fmap (\ds@DesktopStyle {desktopBorder = border} - -> (borderH $ margin border) + 2*(borderWidth border) + (borderH $ padding border) - + dlabelwidth d + gap d ds) $ dstyle d - desktopsWidth = sum $ map dwidth desktopNumbers - windowWidth = if windowCount == 0 then 0 else min (taskMaxSize config) ((w - desktopsWidth) `div` windowCount) + desktops = map (\desktop -> (desktop, filter (fromMaybe False . fmap (windowOnDesktop desktop) . flip M.lookup windowStates) screenWindows)) desktopNumbers + + windowCount = sum $ map (length . snd) $ desktops + + dstyle d = fmap (if d == currentDesktop then snd else fst) $ desktopStyle config + dlabelwidth d = fromMaybe 0 $ fmap desktopLabelWidth $ dstyle d + gap d ds = if null (snd $ desktops !! d) then 0 else desktopLabelGap ds + dleftwidth d = fromMaybe 0 $ fmap (\ds@DesktopStyle {desktopBorder = border} + -> (borderLeft $ margin border) + (borderWidth border) + (borderLeft $ padding border) + + dlabelwidth d + gap d ds) $ dstyle d + dwidth d = fromMaybe 0 $ fmap (\ds@DesktopStyle {desktopBorder = border} + -> (borderH $ margin border) + 2*(borderWidth border) + (borderH $ padding border) + + dlabelwidth d + gap d ds) $ dstyle d + + desktopsWidth = sum $ map dwidth desktopNumbers + windowWidth = if windowCount == 0 then 0 else min (taskMaxSize config) ((w - desktopsWidth) `div` windowCount) flip (flip foldM_ 0) desktops $ \nwindows (desktop, desktopWindows) -> do let dstyle' = dstyle desktop |