mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-10 17:52:09 -07:00
Replace 'join . fmap' with =<<
This commit is contained in:
@@ -78,7 +78,7 @@ setWMName name = do
|
||||
getSupportWindow = withDisplay $ \dpy -> do
|
||||
atom_NET_SUPPORTING_WM_CHECK <- netSupportingWMCheckAtom
|
||||
root <- asks theRoot
|
||||
supportWindow <- join . fmap listToMaybe <$> io (getWindowProperty32 dpy atom_NET_SUPPORTING_WM_CHECK root)
|
||||
supportWindow <- (listToMaybe =<<) <$> io (getWindowProperty32 dpy atom_NET_SUPPORTING_WM_CHECK root)
|
||||
validateWindow (fmap fromIntegral supportWindow)
|
||||
|
||||
validateWindow :: Maybe Window -> X Window
|
||||
|
@@ -1204,7 +1204,7 @@ pasteString = pasteString' id
|
||||
-- | A variant of 'pasteString' which allows modifying the X selection before
|
||||
-- pasting.
|
||||
pasteString' :: (String -> String) -> XP ()
|
||||
pasteString' f = join $ io $ fmap (insertString . f) getSelection
|
||||
pasteString' f = insertString . f =<< getSelection
|
||||
|
||||
-- | Remove a character at the cursor position
|
||||
deleteString :: Direction1D -> XP ()
|
||||
|
@@ -85,8 +85,8 @@ getSelection = io $ do
|
||||
details on the advantages and disadvantages of using safeSpawn. -}
|
||||
promptSelection, safePromptSelection, unsafePromptSelection :: String -> X ()
|
||||
promptSelection = unsafePromptSelection
|
||||
safePromptSelection app = join $ io $ fmap (safeSpawn app . return) getSelection
|
||||
unsafePromptSelection app = join $ io $ fmap (unsafeSpawn . (\x -> app ++ " " ++ x)) getSelection
|
||||
safePromptSelection app = safeSpawn app . return =<< getSelection
|
||||
unsafePromptSelection app = unsafeSpawn . (\x -> app ++ " " ++ x) =<< getSelection
|
||||
|
||||
{- | A wrapper around 'promptSelection' and its safe variant. They take two parameters, the
|
||||
first is a function that transforms strings, and the second is the application to run.
|
||||
@@ -94,5 +94,5 @@ unsafePromptSelection app = join $ io $ fmap (unsafeSpawn . (\x -> app ++ " " ++
|
||||
One example is to wrap code, such as a command line action copied out of the browser
|
||||
to be run as @"sudo" ++ cmd@ or @"su - -c \""++ cmd ++"\""@. -}
|
||||
transformPromptSelection, transformSafePromptSelection :: (String -> String) -> String -> X ()
|
||||
transformPromptSelection f app = join $ io $ fmap (safeSpawn app . return . f) getSelection
|
||||
transformSafePromptSelection f app = join $ io $ fmap (unsafeSpawn . (\x -> app ++ " " ++ x) . f) getSelection
|
||||
transformPromptSelection f app = (safeSpawn app . return . f) =<< getSelection
|
||||
transformSafePromptSelection f app = unsafeSpawn . (\x -> app ++ " " ++ x) . f =<< getSelection
|
||||
|
Reference in New Issue
Block a user