mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-01 12:41:53 -07:00
replace multiple gets with a single get and record bind
This commit is contained in:
3
Main.hs
3
Main.hs
@@ -169,8 +169,7 @@ handle e@(CrossingEvent {event_type = t})
|
|||||||
|
|
||||||
-- configure a window
|
-- configure a window
|
||||||
handle e@(ConfigureRequestEvent {window = w}) = do
|
handle e@(ConfigureRequestEvent {window = w}) = do
|
||||||
dpy <- gets display
|
XState { display = dpy, workspace = ws } <- get
|
||||||
ws <- gets workspace
|
|
||||||
|
|
||||||
when (W.member w ws) $ -- already managed, reconfigure (see client:configure()
|
when (W.member w ws) $ -- already managed, reconfigure (see client:configure()
|
||||||
trace ("Reconfigure already managed window: " ++ show w)
|
trace ("Reconfigure already managed window: " ++ show w)
|
||||||
|
@@ -25,12 +25,9 @@ import qualified StackSet as W
|
|||||||
-- screen and raises the window.
|
-- screen and raises the window.
|
||||||
refresh :: X ()
|
refresh :: X ()
|
||||||
refresh = do
|
refresh = do
|
||||||
ws <- gets workspace
|
XState {workspace = ws, wsOnScreen = ws2sc, xineScreens = xinesc
|
||||||
ws2sc <- gets wsOnScreen
|
,display = d ,layoutDescs = fls ,defaultLayoutDesc = dfltfl } <- get
|
||||||
xinesc <- gets xineScreens
|
|
||||||
d <- gets display
|
|
||||||
fls <- gets layoutDescs
|
|
||||||
dfltfl <- gets defaultLayoutDesc
|
|
||||||
flip mapM_ (M.assocs ws2sc) $ \(n, scn) -> do
|
flip mapM_ (M.assocs ws2sc) $ \(n, scn) -> do
|
||||||
let sc = xinesc !! scn
|
let sc = xinesc !! scn
|
||||||
fl = M.findWithDefault dfltfl n fls
|
fl = M.findWithDefault dfltfl n fls
|
||||||
@@ -156,8 +153,7 @@ safeFocus w = do ws <- gets workspace
|
|||||||
-- | Explicitly set the keyboard focus to the given window
|
-- | Explicitly set the keyboard focus to the given window
|
||||||
setFocus :: Window -> X ()
|
setFocus :: Window -> X ()
|
||||||
setFocus w = do
|
setFocus w = do
|
||||||
ws <- gets workspace
|
XState { workspace = ws, wsOnScreen = ws2sc} <- get
|
||||||
ws2sc <- gets wsOnScreen
|
|
||||||
|
|
||||||
-- clear mouse button grab and border on other windows
|
-- clear mouse button grab and border on other windows
|
||||||
flip mapM_ (M.keys ws2sc) $ \n -> do
|
flip mapM_ (M.keys ws2sc) $ \n -> do
|
||||||
@@ -204,8 +200,7 @@ kill = withDisplay $ \d -> do
|
|||||||
ws <- gets workspace
|
ws <- gets workspace
|
||||||
whenJust (W.peek ws) $ \w -> do
|
whenJust (W.peek ws) $ \w -> do
|
||||||
protocols <- io $ getWMProtocols d w
|
protocols <- io $ getWMProtocols d w
|
||||||
wmdelt <- gets wmdelete
|
XState {wmdelete = wmdelt, wmprotocols = wmprot} <- get
|
||||||
wmprot <- gets wmprotocols
|
|
||||||
if wmdelt `elem` protocols
|
if wmdelt `elem` protocols
|
||||||
then io $ allocaXEvent $ \ev -> do
|
then io $ allocaXEvent $ \ev -> do
|
||||||
setEventType ev clientMessage
|
setEventType ev clientMessage
|
||||||
@@ -227,8 +222,7 @@ tag o = do
|
|||||||
-- | view. Change the current workspace to workspce at offset 'n-1'.
|
-- | view. Change the current workspace to workspce at offset 'n-1'.
|
||||||
view :: Int -> X ()
|
view :: Int -> X ()
|
||||||
view o = do
|
view o = do
|
||||||
ws <- gets workspace
|
XState { workspace = ws, wsOnScreen = ws2sc } <- get
|
||||||
ws2sc <- gets wsOnScreen
|
|
||||||
let m = W.current ws
|
let m = W.current ws
|
||||||
-- is the workspace we want to switch to currently visible?
|
-- is the workspace we want to switch to currently visible?
|
||||||
if M.member n ws2sc
|
if M.member n ws2sc
|
||||||
@@ -272,9 +266,8 @@ restart = do
|
|||||||
-- and -w options.)
|
-- and -w options.)
|
||||||
dmenu :: X ()
|
dmenu :: X ()
|
||||||
dmenu = do
|
dmenu = do
|
||||||
xinesc <- gets xineScreens
|
XState { xineScreens = xinesc, workspace = ws, wsOnScreen = ws2sc } <- get
|
||||||
ws <- gets workspace
|
|
||||||
ws2sc <- gets wsOnScreen
|
|
||||||
let curscreen = fromMaybe 0 (M.lookup (W.current ws) ws2sc)
|
let curscreen = fromMaybe 0 (M.lookup (W.current ws) ws2sc)
|
||||||
sc = xinesc !! curscreen
|
sc = xinesc !! curscreen
|
||||||
spawn $ "exe=`dmenu_path | dmenu -x " ++ (show $ rect_x sc) ++ " -w " ++ (show $ rect_width sc) ++ "` && exec $exe"
|
spawn $ concat [ "exe=`dmenu_path | dmenu -x ", show (rect_x sc)
|
||||||
|
, " -w " , show (rect_width sc) , "` && exec $exe" ]
|
||||||
|
Reference in New Issue
Block a user