[XMonad] Rewrite several functions w/o do notation
This commit is contained in:
parent
670a0719dd
commit
ff61b78ee9
@ -249,11 +249,12 @@ myBringWindow WindowBringerConfig{ menuCommand = cmd
|
|||||||
|
|
||||||
-- Dynamic Workspace Renaming
|
-- Dynamic Workspace Renaming
|
||||||
|
|
||||||
getClassRemap = do
|
windowClassFontAwesomeFile =
|
||||||
home <- getHomeDirectory
|
fmap (</> ".lib/resources/window_class_to_fontawesome.json") getHomeDirectory
|
||||||
-- TODO: handle the case where this file does not exist
|
|
||||||
text <- B.readFile $ home </> ".lib/resources/window_class_to_fontawesome.json"
|
getClassRemap =
|
||||||
return $ fromMaybe M.empty (decode text)
|
fmap (fromMaybe M.empty . decode) $
|
||||||
|
windowClassFontAwesomeFile >>= B.readFile
|
||||||
|
|
||||||
setWorkspaceNameToFocusedWindow workspace = do
|
setWorkspaceNameToFocusedWindow workspace = do
|
||||||
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
||||||
@ -267,9 +268,8 @@ remapNames namedWindows = do
|
|||||||
remap <- io getClassRemap
|
remap <- io getClassRemap
|
||||||
return $ map (\orig -> M.findWithDefault orig orig remap) namedWindows
|
return $ map (\orig -> M.findWithDefault orig orig remap) namedWindows
|
||||||
|
|
||||||
setWorkspaceNames = do
|
setWorkspaceNames =
|
||||||
ws <- gets windowset
|
gets windowset >>= mapM_ setWorkspaceNameToFocusedWindow . W.workspaces
|
||||||
mapM_ setWorkspaceNameToFocusedWindow (W.workspaces ws)
|
|
||||||
|
|
||||||
data WorkspaceNamesHook a = WorkspaceNamesHook deriving (Show, Read)
|
data WorkspaceNamesHook a = WorkspaceNamesHook deriving (Show, Read)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user