a "Desktop Workflow" monad with Objective-C bindings.
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)
workflow-osx
a (free) monad, with Objective-C bindings, for "Workflow" actions.
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
the build
foreign dependencies always complicate the build process. it's known to work with the following:
OS
$ sw_vers ProductName: Mac OS X ProductVersion: 10.9.5 BuildVersion: 13F34
C compiler
$ gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix
Haskell compiler
$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.1
TODO
platform agnosticism
exploit the free monad's flexibility to define platform-agnostic workflows
problem: windows (Linux/Windows) versus processes (OS X)
problem: keyboards. Apple keyboards don't have the Windows key, Windows keyboards don't have the Apple key. some keyboards have a dozen random extra unbound keys.
automatic delay
insertion
problem: currently, delays must be inserted manually. keyboard shortcuts in Emacs succeed with no delay. keyboard shortcuts in Chrome, like closing a tab with M-w
, may drop without a long delay (like 250ms). furthermore, different actions need different delays between them (e.g. inserting text into Chrome can be done without delay).