mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 20:21:51 -07:00
Added the alignment option 'AlignRightOffset'
This commit is contained in:
@@ -143,7 +143,7 @@ textExtentsXMF (Xft xftfont) _ = io $ do
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
-- | String position
|
-- | String position
|
||||||
data Align = AlignCenter | AlignRight | AlignLeft
|
data Align = AlignCenter | AlignRight | AlignLeft | AlignRightOffset Int
|
||||||
|
|
||||||
-- | Return the string x and y 'Position' in a 'Rectangle', given a
|
-- | Return the string x and y 'Position' in a 'Rectangle', given a
|
||||||
-- 'FontStruct' and the 'Align'ment
|
-- 'FontStruct' and the 'Align'ment
|
||||||
@@ -156,6 +156,7 @@ stringPosition dpy fs (Rectangle _ _ w h) al s = do
|
|||||||
AlignCenter -> fi (w `div` 2) - fi (width `div` 2)
|
AlignCenter -> fi (w `div` 2) - fi (width `div` 2)
|
||||||
AlignLeft -> 1
|
AlignLeft -> 1
|
||||||
AlignRight -> fi (w - (fi width + 1));
|
AlignRight -> fi (w - (fi width + 1));
|
||||||
|
AlignRightOffset offset -> fi (w - (fi width + 1)) - fi offset;
|
||||||
return (x,y)
|
return (x,y)
|
||||||
|
|
||||||
printStringXMF :: (Functor m, MonadIO m) => Display -> Drawable -> XMonadFont -> GC -> String -> String
|
printStringXMF :: (Functor m, MonadIO m) => Display -> Drawable -> XMonadFont -> GC -> String -> String
|
||||||
|
@@ -254,7 +254,7 @@ fixedWidthL a str n logger = do
|
|||||||
case a of
|
case a of
|
||||||
AlignCenter -> toL (take n $ padhalf l ++ l ++ cs)
|
AlignCenter -> toL (take n $ padhalf l ++ l ++ cs)
|
||||||
AlignRight -> toL (reverse (take n $ reverse l ++ cs))
|
AlignRight -> toL (reverse (take n $ reverse l ++ cs))
|
||||||
AlignLeft -> toL (take n $ l ++ cs)
|
_ -> toL (take n $ l ++ cs)
|
||||||
where
|
where
|
||||||
toL = return . Just
|
toL = return . Just
|
||||||
cs = cycle str
|
cs = cycle str
|
||||||
|
Reference in New Issue
Block a user