Add top and bottom desktop border margins and paddings, for the sake of consistency

This commit is contained in:
Matthias Schiffer 2011-07-18 16:31:19 +02:00
parent 4292cbce3e
commit cc55ee7678
2 changed files with 66 additions and 60 deletions

View file

@ -211,14 +211,14 @@ instance WidgetClass Taskbar where
renderText (desktopFont ds) (fromIntegral (dx - dlabelwidth desktop - gap desktop ds)) 0 (dlabelwidth desktop) h $ show (desktop+1) renderText (desktopFont ds) (fromIntegral (dx - dlabelwidth desktop - gap desktop ds)) 0 (dlabelwidth desktop) h $ show (desktop+1)
restore restore
_ -> return ()
forM_ (zip [0..] desktopWindows) $ \(i, window) -> do forM_ (zip [0..] desktopWindows) $ \(i, window) -> do
let style = (if window == activeWindow then activeTaskStyle else normalTaskStyle) config let style = (if window == activeWindow then activeTaskStyle else normalTaskStyle) config
(r, g, b, a) = taskColor style (r, g, b, a) = taskColor style
leftBorder = (borderLeft $ margin $ taskBorder style) + (borderWidth $ taskBorder style) + (borderLeft $ padding $ taskBorder style) leftBorder = (borderLeft $ margin $ taskBorder style) + (borderWidth $ taskBorder style) + (borderLeft $ padding $ taskBorder style)
rightBorder = (borderRight $ margin $ taskBorder style) + (borderWidth $ taskBorder style) + (borderRight $ padding $ taskBorder style) rightBorder = (borderRight $ margin $ taskBorder style) + (borderWidth $ taskBorder style) + (borderRight $ padding $ taskBorder style)
h' = h - (borderV $ margin $ taskBorder style) hd = h - (borderV $ margin $ desktopBorder ds) - 2*(borderWidth $ desktopBorder ds) - (borderV $ padding $ desktopBorder ds)
h' = hd - (borderV $ margin $ taskBorder style)
mstate = M.lookup window windowStates mstate = M.lookup window windowStates
micons = M.lookup window windowIcons micons = M.lookup window windowIcons
mscaledIconRef = M.lookup window windowScaledIcons mscaledIconRef = M.lookup window windowScaledIcons
@ -227,11 +227,13 @@ instance WidgetClass Taskbar where
case (mstate, micons, mscaledIconRef) of case (mstate, micons, mscaledIconRef) of
(Just state, Just icons, Just scaledIconRef) -> do (Just state, Just icons, Just scaledIconRef) -> do
save save
drawBorder (taskBorder style) x 0 windowWidth h translate 0 $ fromIntegral $ ((borderTop $ margin $ desktopBorder ds) + (borderWidth $ desktopBorder ds) + (borderTop $ padding $ desktopBorder ds))
save
drawBorder (taskBorder style) x 0 windowWidth hd
clip clip
setSourceRGBA r g b a setSourceRGBA r g b a
renderText (taskFont style) (fromIntegral (x + leftBorder + h' + 3)) 0 (windowWidth - leftBorder - h' - 3 - rightBorder) h $ windowTitle state renderText (taskFont style) (fromIntegral (x + leftBorder + h' + 3)) 0 (windowWidth - leftBorder - h' - 3 - rightBorder) hd $ windowTitle state
restore restore
@ -271,6 +273,10 @@ instance WidgetClass Taskbar where
Nothing -> Nothing ->
return () return ()
restore
_ -> return ()
_ -> return () _ -> return ()
return $ nwindows + length desktopWindows return $ nwindows + length desktopWindows

View file

@ -14,7 +14,7 @@ main = do
runPhi defaultXConfig defaultPanelConfig { panelPosition = Bottom } runPhi defaultXConfig defaultPanelConfig { panelPosition = Bottom }
[theTaskbar, brightBorder [theSystray], brightBorder [theClock]] [theTaskbar, brightBorder [theSystray], brightBorder [theClock]]
where where
normalTaskBorder = BorderConfig (BorderWidth 2 (-3) 2 7) 1 (BorderWidth 0 5 0 5) (0.9, 0.9, 0.9, 0.8) (0.45, 0.45, 0.45, 1) 5 0 normalTaskBorder = BorderConfig (BorderWidth (-1) (-3) (-1) 7) 1 (BorderWidth 0 5 0 5) (0.9, 0.9, 0.9, 0.8) (0.45, 0.45, 0.45, 1) 5 0
activeTaskBorder = normalTaskBorder { borderColor = (1, 1, 1, 0.8) activeTaskBorder = normalTaskBorder { borderColor = (1, 1, 1, 0.8)
, backgroundColor = (0, 0, 0, 1) , backgroundColor = (0, 0, 0, 1)
} }
@ -41,7 +41,7 @@ main = do
} }
theTaskbar = taskbar defaultTaskbarConfig { normalTaskStyle = taskStyle {taskIconStyle = desaturateIconStyle 0.6} theTaskbar = taskbar defaultTaskbarConfig { normalTaskStyle = taskStyle {taskIconStyle = desaturateIconStyle 0.7}
, activeTaskStyle = taskStyle {taskBorder = activeTaskBorder} , activeTaskStyle = taskStyle {taskBorder = activeTaskBorder}
, desktopStyle = Just (normalDesktopStyle, currentDesktopStyle) , desktopStyle = Just (normalDesktopStyle, currentDesktopStyle)
} }
@ -49,7 +49,7 @@ main = do
theSystray = systray theSystray = systray
theClock = clock defaultClockConfig { clockFormat = "<span font='Sans 8'>%R</span>\n<span font='Sans 6'>%A %d %B</span>" theClock = clock defaultClockConfig { clockFormat = "<span font='Sans 8'>%R</span>\n<span font='Sans 6'>%A %d %B</span>"
, lineSpacing = (-2) , lineSpacing = (-3)
, clockSize = 75 , clockSize = 75
} }
brightBorder = border $ BorderConfig (simpleBorderWidth 1) 1 (BorderWidth (-2) 3 0 3) (0.5, 0.5, 0.5, 0.65) (0.85, 0.85, 0.85, 0.8) 5 0 brightBorder = border normalDesktopBorder