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