ENH add log contraints to spawnpipe

This commit is contained in:
Nathan Dwarshuis 2023-01-02 19:55:44 -05:00
parent 0895586cf7
commit 6891238793
2 changed files with 10 additions and 4 deletions

View File

@ -210,7 +210,7 @@ runClipMenu = sometimesIO_ "clipboard manager" "rofi greenclip" tree act
-- Shortcut menu
runShowKeys
:: MonadUnliftIO m
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
=> Always ([((KeyMask, KeySym), NamedAction)] -> m ())
runShowKeys =
Always "keyboard menu" $
@ -225,7 +225,7 @@ runShowKeys =
defNoteError {body = Just $ Text "could not display keymap"}
showKeysDMenu
:: MonadUnliftIO m
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
=> SubfeatureRoot ([((KeyMask, KeySym), NamedAction)] -> m ())
showKeysDMenu =
Subfeature
@ -233,7 +233,10 @@ showKeysDMenu =
, sfData = IORoot_ showKeys $ Only_ dmenuDep
}
showKeys :: MonadUnliftIO m => [((KeyMask, KeySym), NamedAction)] -> m ()
showKeys
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
=> [((KeyMask, KeySym), NamedAction)]
-> m ()
showKeys kbs = do
h <- spawnPipe cmd
B.hPut h $ BC.unlines $ BC.pack <$> showKm kbs

View File

@ -85,7 +85,10 @@ spawn :: MonadIO m => T.Text -> m ()
spawn = X.spawn . T.unpack
-- | Run 'XMonad.Run.Utils.spawnPipe' with 'Text' input.
spawnPipe :: MonadIO m => T.Text -> m Handle
spawnPipe
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
=> T.Text
-> m Handle
spawnPipe = XR.spawnPipe . T.unpack
-- | Run 'XMonad.Core.spawn' with a command and arguments