| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Workflow.OSX
Description
Example 1:
import qualified Data.ByteString.Char8 as BS
import qualified Network.HTTP.Types.URI as WAI
-- | google a query, in the default browser. properly encodes the url.
google :: (MonadWorkflow m) => String -> m ()
google (BS.pack -> query) = do
openURL (BS.unpack $ "https://www.google.com/search" <> WAI.renderQuery True [("q", Just query)])
Example 2:
-- | access the currently selected region from Haskell, via the clipboard copy :: (MonadWorkflow m) => m String copy = dosendKeyChord[CommandModifier]CKeydelay250getClipboard
Example 3:
import qualified Data.Char -- uppercase the contents of the clipboard, and paste the result uppercase_clipboard = do oldContents <-getClipboardlet newContents = fmap Data.Char.toUpper oldContentssetClipboardnewContentssendKeyChord[CommandModifier]VKey
Example 4:
-- pause/play the first YouTube tab open in the Chrome browser, by pressing a key after full-screening it -- -- (this script is super-duper-robust) youtube_toggle_sound = do app <-currentApplication-- save the currently open application reach_youtubesendKeyChord[CommandModifier]UpKey-- move to the top of the screendelaychromeDelay youtube_toggle_fullscreendelaychromeDelaysendKeyChord[]KKey-- pauses/plays the videodelaychromeDelay youtube_toggle_fullscreendelay2000openApplicationapp -- restore the previously open application youtube_toggle_fullscreen = dosendKeyChord[ShiftModifier]FKeyreach_youtube = doopenApplication"Google Chrome"switch_tab"YouTube.com" switch_tab s = dosendKeyChord[OptionModifier]TKey-- needs the Tab Ahead chrome extensiondelaychromeDelaysendTextssendKeyChord[]ReturnKeychromeDelay = 250 -- milliseconds
Documentation
module Workflow.OSX.Types
module Workflow.OSX.DSL
module Workflow.OSX.Bindings.Raw
module Workflow.OSX.Constants
module Workflow.OSX.Marshall
module Workflow.OSX.Execute