mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-01 04:31:53 -07:00
Window borders
Colors taken from dwm's config.default.h and hard-coded in Operations instead of Config because of import cycle. Windows overlap slightly in the current tiling algorithm and sometimes prevent the active window from being completely surrounded by a red border.
This commit is contained in:
@@ -142,10 +142,16 @@ withServerX f = withDisplay $ \dpy -> do
|
||||
-- | Explicitly set the keyboard focus to the given window
|
||||
setFocus :: Window -> X ()
|
||||
setFocus w = do
|
||||
-- Remove the border for the window no longer in focus.
|
||||
ws <- gets workspace
|
||||
whenJust (W.peek ws) (\oldw -> setBorder oldw 0xdddddd)
|
||||
-- Set focus to the given window.
|
||||
withDisplay $ \d -> io $ setInputFocus d w revertToPointerRoot 0
|
||||
-- This does not use 'windows' intentionally. 'windows' calls refresh,
|
||||
-- which means infinite loops.
|
||||
modify (\s -> s { workspace = W.raiseFocus w (workspace s) })
|
||||
-- Set new border for raised window.
|
||||
setBorder w 0xff0000
|
||||
|
||||
-- | Set the focus to the window on top of the stack, or root
|
||||
setTopFocus :: X ()
|
||||
@@ -155,6 +161,10 @@ setTopFocus = do
|
||||
Just new -> setFocus new
|
||||
Nothing -> gets theRoot >>= setFocus
|
||||
|
||||
-- | Set the border color for a particular window.
|
||||
setBorder :: Window -> Pixel -> X ()
|
||||
setBorder w p = withDisplay $ \d -> io $ setWindowBorder d w p
|
||||
|
||||
-- | raise. focus to window at offset 'n' in list.
|
||||
-- The currently focused window is always the head of the list
|
||||
raise :: Ordering -> X ()
|
||||
|
Reference in New Issue
Block a user