-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simulate keyboard and mouse events -- -- Generate native keyboard and mouse events. Using this library, -- applications will respond as if the user performed the action -- themselves. -- -- For examples, see the examples folder in the source -- distribution. @package robot @version 1.3 -- | Low-level wrappers around the XTest protocol. module Test.Robot.Internal.XTest keyboard :: Connection -> Bool -> KEYCODE -> IO () button :: Connection -> Bool -> BUTTON -> IO () motion :: Connection -> Bool -> (Int16, Int16) -> IO () -- | Return a structure mapping keysyms to their keycode. getKeysymMap :: Connection -> IO (Map KEYSYM KEYCODE) -- | Defines the Key and Button types, along with a list of -- constants of those types. module Test.Robot.Types -- | A key on the keyboard. data Key -- | A mouse button or scroll wheel. -- -- Note that the scroll wheel is treated as two separate buttons: one -- scrolling up, and one scrolling down. data Button customKey :: KEYSYM -> Key customButton :: BUTTON -> Button -- | Retrieve the internal identifier for this key. rawKey :: Key -> KEYSYM -- | Retrieve the internal identifier for this button. rawButton :: Button -> BUTTON leftButton :: Button middleButton :: Button rightButton :: Button scrollUp :: Button scrollDown :: Button scrollLeft :: Button scrollRight :: Button backButton :: Button forwardButton :: Button _Backspace :: Key _Tab :: Key _LineFeed :: Key _Clear :: Key _Return :: Key _Pause :: Key _ScrollLock :: Key _SysReq :: Key _Escape :: Key _Delete :: Key _Home :: Key _Left :: Key _Up :: Key _Right :: Key _Down :: Key _Prior :: Key _PageUp :: Key _Next :: Key _PageDown :: Key _End :: Key _Begin :: Key _Select :: Key _Print :: Key _Execute :: Key _Insert :: Key _Undo :: Key _Redo :: Key _Menu :: Key _Find :: Key _Cancel :: Key _Help :: Key _Break :: Key _ModeSwitch :: Key _ScriptSwitch :: Key _NumLock :: Key _KP_Space :: Key _KP_Tab :: Key _KP_Enter :: Key _KP_F1 :: Key _KP_F2 :: Key _KP_F3 :: Key _KP_F4 :: Key _KP_Home :: Key _KP_Left :: Key _KP_Up :: Key _KP_Right :: Key _KP_Down :: Key _KP_Prior :: Key _KP_PageUp :: Key _KP_Next :: Key _KP_PageDown :: Key _KP_End :: Key _KP_Begin :: Key _KP_Insert :: Key _KP_Delete :: Key _KP_Multiply :: Key _KP_Add :: Key _KP_Separator :: Key _KP_Subtract :: Key _KP_Decimal :: Key _KP_Divide :: Key _KP_Equal :: Key _KP_0 :: Key _KP_1 :: Key _KP_2 :: Key _KP_3 :: Key _KP_4 :: Key _KP_5 :: Key _KP_6 :: Key _KP_7 :: Key _KP_8 :: Key _KP_9 :: Key _F1 :: Key _F2 :: Key _F3 :: Key _F4 :: Key _F5 :: Key _F6 :: Key _F7 :: Key _F8 :: Key _F9 :: Key _F10 :: Key _F11 :: Key _F12 :: Key _F13 :: Key _F14 :: Key _F15 :: Key _F16 :: Key _F17 :: Key _F18 :: Key _F19 :: Key _Shift :: Key _Shift_L :: Key _Shift_R :: Key _Ctrl :: Key _Control :: Key _Control_L :: Key _Control_R :: Key _CapsLock :: Key _ShiftLock :: Key _Meta :: Key _Meta_L :: Key _Meta_R :: Key _Alt :: Key _Alt_L :: Key _Alt_R :: Key _Super :: Key _Super_L :: Key _Super_R :: Key _Hyper :: Key _Hyper_L :: Key _Hyper_R :: Key _Space :: Key _Exclamation :: Key _Quotation :: Key _NumberSign :: Key _Dollar :: Key _Percent :: Key _Ampersand :: Key _Apostrophe :: Key _ParenLeft :: Key _ParenRight :: Key _Asterisk :: Key _Plus :: Key _Comma :: Key _Minus :: Key _Period :: Key _Slash :: Key _0 :: Key _1 :: Key _2 :: Key _3 :: Key _4 :: Key _5 :: Key _6 :: Key _7 :: Key _8 :: Key _9 :: Key _Colon :: Key _Semicolon :: Key _Less :: Key _Equal :: Key _Greater :: Key _Question :: Key _At :: Key _A :: Key _B :: Key _C :: Key _D :: Key _E :: Key _F :: Key _G :: Key _H :: Key _I :: Key _J :: Key _K :: Key _L :: Key _M :: Key _N :: Key _O :: Key _P :: Key _Q :: Key _R :: Key _S :: Key _T :: Key _U :: Key _V :: Key _W :: Key _X :: Key _Y :: Key _Z :: Key _BracketLeft :: Key _Backslash :: Key _BracketRight :: Key _Circumflex :: Key _Underscore :: Key _Grave :: Key _BraceLeft :: Key _Bar :: Key _BraceRight :: Key _Tilde :: Key -- | Miscellaneous low-level functions. You should rarely need to use these -- directly. module Test.Robot.Internal -- | A Robot is a program that interacts with the GUI. -- -- Use runRobot to execute your Robot, and liftIO to -- perform arbitrary I/O. newtype Robot a Robot :: ReaderT (Connection, Map KEYSYM KEYCODE) IO a -> Robot a unRobot :: Robot a -> ReaderT (Connection, Map KEYSYM KEYCODE) IO a -- | Run the robot, connecting to the display automatically. runRobot :: Robot a -> IO a -- | Run the robot using an existing connection. runRobotWith :: Connection -> Robot a -> IO a -- | Connect to the X11 server. connect :: IO Connection mkRobot :: ((Connection, Map KEYSYM KEYCODE) -> IO a) -> Robot a mkRobot' :: (Connection -> IO a) -> Robot a keyboard :: Bool -> Key -> Robot () button :: Bool -> Button -> Robot () motion :: Bool -> Int -> Int -> Robot () instance Functor Robot instance Applicative Robot instance Monad Robot instance MonadIO Robot instance MonadCatch Robot instance MonadMask Robot instance MonadThrow Robot -- | Functions for managing connections manually. module Test.Robot.Connection -- | Run the robot using an existing connection. runRobotWith :: Connection -> Robot a -> IO a -- | Connect to the X11 server. connect :: IO Connection -- | The main Robot interface. module Test.Robot -- | A Robot is a program that interacts with the GUI. -- -- Use runRobot to execute your Robot, and liftIO to -- perform arbitrary I/O. data Robot a -- | Run the robot, connecting to the display automatically. runRobot :: Robot a -> IO a -- | Represents things that can be pressed: either a key on a keyboard or a -- button on a mouse. class Pressable x where hold = bracket_ <$> press <*> release press :: Pressable x => x -> Robot () release :: Pressable x => x -> Robot () hold :: Pressable x => x -> Robot a -> Robot a -- | Move the pointer by an offset. moveBy :: Int -> Int -> Robot () -- | Move the pointer to a point on the screen. moveTo :: Int -> Int -> Robot () -- | Press the argument, then release it. -- -- Note that the underlying events are fired very quickly; much faster -- than some applications (such as Xmonad) can handle. If this becomes an -- issue, you may introduce a delay using sleep: -- --
--   slowTap x = x `hold` sleep 0.1
--   
tap :: Pressable x => x -> Robot () -- | Do nothing for the specified number of seconds. sleep :: Rational -> Robot () instance Pressable x => Pressable [x] instance Pressable Button instance Pressable Key