packages feed

workflow-osx 0.0.0 → 0.0.1

raw patch · 5 files changed

+70/−17 lines, 5 filesdep ~workflow-osx

Dependency ranges changed: workflow-osx

Files

README.md view
@@ -2,9 +2,7 @@  a (free) monad, with Objective-C bindings, for "Workflow" actions.  -e.g. press some keys, click the mouse, get and set the clipboard. GHC's C FFI takes only microseconds.--for examples, see the documentation on hackage <https://hackage.haskell.org/package/workflow-osx>+for detailed examples, see the documentation on hackage <https://hackage.haskell.org/package/workflow-osx> or github (<http://sboosali.github.io/documentation/workflow-osx/index.html).    # Issues 
sources/Workflow/OSX.hs view
@@ -77,6 +77,25 @@ @  +Example 5:++@+-- | cut the currently selected region+cut :: (MonadWorkflow m) => m String+cut = do+ 'sendKeyChord' ['CommandModifier'] 'XKey'+ 'delay' 250+ 'getClipboard'++-- | transform the currently selected region from Haskell, via the clipboard  +transformClipboard :: (MonadWorkflow m) => (String -> String) -> m () +transformClipboard f = do+ contents <- 'cut'+ 'setClipboard' (f contents) + 'sendKeyChord' ['CommandModifier'] 'VKey'+@++ -} module Workflow.OSX  ( module Workflow.OSX.Types
sources/Workflow/OSX/Execute.hs view
@@ -45,7 +45,7 @@  -- iterM :: (Monad m, Functor f) => (f (m a) -> m a) -> Free f a -> m a   SendKeyChord    flags key k      -> threadDelay (t*1000) >> ObjC.pressKey flags key             >> k- SendText        s k              -> runWorkflow (sendTextAsKeypressesWithDelay t s)              >> k+ SendText        s k              -> runWorkflow (sendTextAsKeypressesWithDelay 1 s)             >> k   GetClipboard    f                -> threadDelay (t*1000) >> ObjC.getClipboard                   >>= f  SetClipboard    s k              -> threadDelay (t*1000) >> ObjC.setClipboard s                 >> k
sources/Workflow/OSX/Types.hs view
@@ -3,6 +3,7 @@ import Workflow.OSX.Extra  import Control.Monad.Free (MonadFree, Free)+import Control.Monad.Free.Church  (F) import           Control.Monad.Catch          (MonadThrow) import Foreign.C.Types @@ -31,6 +32,11 @@ type Workflow = Free WorkflowF  type Workflow_ = Workflow ()++-- | church-encoded+type CWorkflow = F WorkflowF++type CWorkflow_ = CWorkflow ()  -- | the "Workflow Functor". data WorkflowF k
workflow-osx.cabal view
@@ -1,5 +1,5 @@ name: workflow-osx-version: 0.0.0+version: 0.0.1 cabal-version: >=1.10 build-type: Simple license: GPL-3@@ -11,16 +11,46 @@ bug-reports: https://github.com/sboosali/workflow-osx/issues synopsis: a "Desktop Workflow" monad with Objective-C bindings  description:- a \"Desktop Workflow\" monad with Objective-C bindings- . - e.g. press some keys, click the mouse, get/set the clipboard- . - see @Workflow.OSX@ for several examples- .- (if the build fails, see the <https://github.com/sboosali/workflow-osx#the-build README>)- . - (this package is on hackage for convenience, but it's still a prerelease)+  a \"Desktop Workflow\" monad with Objective-C bindings. +  . +  includes bindings to: +  .+  * press keys with modifiers+  . +  * get/set the clipboard+  . +  * launch/focus applications+  . +  * get the name of the current application +  .+  * open URLs +  .+  for example: +  . +  > -- | cut the currently highlighted region+  > cut :: (MonadWorkflow m) => m String+  > cut = do+  >  sendKeyChord [CommandModifier] XKey+  >  delay 250+  >  getClipboard+  .+  > -- | transform the currently highlighted region, via the clipboard+  > transformClipboard :: (MonadWorkflow m) => (String -> String) -> m () +  > transformClipboard f = do+  >  contents <- cut+  >  setClipboard (f contents) +  >  sendKeyChord [CommandModifier] VKey+  . +  see @Workflow.OSX@ for several more examples+  .+  (if hackage won't build the docs, see them at <http://sboosali.github.io/documentation/workflow-osx/index.html>)+  . +  (this package is on hackage for convenience, but it's still a prerelease)+  .  +-- * get the name of the current window+-- * click the mouse+ category: Accessibility, Apple, Automation, Bindings, Desktop, FFI  author: Spiros Boosalis tested-with: GHC ==7.10.1@@ -35,8 +65,8 @@  library     -    if !os(osx)-        buildable: False+    -- if !os(osx)+    --     buildable: False      exposed-modules:         Workflow.OSX@@ -85,7 +115,7 @@ executable example     main-is: Main.hs     build-depends:-        workflow-osx ==0.0.0,+        workflow-osx ==0.0.1,         base ==4.8.*     default-language: Haskell2010     hs-source-dirs: .