mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 20:21:51 -07:00
allow border colour to be specified in GSConfig
This commit is contained in:
@@ -205,7 +205,8 @@ data GSConfig a = GSConfig {
|
||||
gs_navigate :: TwoD a (Maybe a),
|
||||
gs_rearranger :: Rearranger a,
|
||||
gs_originFractX :: Double,
|
||||
gs_originFractY :: Double
|
||||
gs_originFractY :: Double,
|
||||
gs_bordercolor :: String
|
||||
}
|
||||
|
||||
-- | That is 'fromClassName' if you are selecting a 'Window', or
|
||||
@@ -322,15 +323,15 @@ diamondRestrict x y originX originY =
|
||||
findInElementMap :: (Eq a) => a -> [(a, b)] -> Maybe (a, b)
|
||||
findInElementMap pos = find ((== pos) . fst)
|
||||
|
||||
drawWinBox :: Window -> XMonadFont -> (String, String) -> Integer -> Integer -> String -> Integer -> Integer -> Integer -> X ()
|
||||
drawWinBox win font (fg,bg) ch cw text x y cp =
|
||||
drawWinBox :: Window -> XMonadFont -> (String, String) -> String -> Integer -> Integer -> String -> Integer -> Integer -> Integer -> X ()
|
||||
drawWinBox win font (fg,bg) bc ch cw text x y cp =
|
||||
withDisplay $ \dpy -> do
|
||||
gc <- liftIO $ createGC dpy win
|
||||
bordergc <- liftIO $ createGC dpy win
|
||||
liftIO $ do
|
||||
Just fgcolor <- initColor dpy fg
|
||||
Just bgcolor <- initColor dpy bg
|
||||
Just bordercolor <- initColor dpy borderColor
|
||||
Just bordercolor <- initColor dpy bc
|
||||
setForeground dpy gc fgcolor
|
||||
setBackground dpy gc bgcolor
|
||||
setForeground dpy bordergc bordercolor
|
||||
@@ -378,6 +379,7 @@ updateElementsWithColorizer colorizer elementmap = do
|
||||
colors <- colorizer element (pos == curpos)
|
||||
drawWinBox win font
|
||||
colors
|
||||
(gs_bordercolor gsconfig)
|
||||
cellheight
|
||||
cellwidth
|
||||
text
|
||||
@@ -390,7 +392,7 @@ stdHandle :: Event -> TwoD a (Maybe a) -> TwoD a (Maybe a)
|
||||
stdHandle (ButtonEvent { ev_event_type = t, ev_x = x, ev_y = y }) contEventloop
|
||||
| t == buttonRelease = do
|
||||
s @ TwoDState { td_paneX = px, td_paneY = py,
|
||||
td_gsconfig = (GSConfig ch cw _ _ _ _ _ _ _) } <- get
|
||||
td_gsconfig = (GSConfig ch cw _ _ _ _ _ _ _ _) } <- get
|
||||
let gridX = (fi x - (px - cw) `div` 2) `div` cw
|
||||
gridY = (fi y - (py - ch) `div` 2) `div` ch
|
||||
case lookup (gridX,gridY) (td_elementmap s) of
|
||||
@@ -714,10 +716,7 @@ decorateName' w = do
|
||||
|
||||
-- | Builds a default gs config from a colorizer function.
|
||||
buildDefaultGSConfig :: (a -> Bool -> X (String,String)) -> GSConfig a
|
||||
buildDefaultGSConfig col = GSConfig 50 130 10 col "xft:Sans-8" defaultNavigation noRearranger (1/2) (1/2)
|
||||
|
||||
borderColor :: String
|
||||
borderColor = "white"
|
||||
buildDefaultGSConfig col = GSConfig 50 130 10 col "xft:Sans-8" defaultNavigation noRearranger (1/2) (1/2) "white"
|
||||
|
||||
-- | Brings selected window to the current workspace.
|
||||
bringSelected :: GSConfig Window -> X ()
|
||||
|
Reference in New Issue
Block a user