-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simulate keyboard and mouse events -- @package robot @version 1.4 -- | 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 Switch type, along with some constants and -- utilities. module Test.Robot.Types -- | Either a key on the keyboard, or a mouse button or scroll wheel. -- -- Note that the scroll wheel is treated as two mouse buttons: one -- scrolling up, and one scrolling down. data Switch Key :: KEYSYM -> Switch Button :: BUTTON -> Switch leftButton :: Switch middleButton :: Switch rightButton :: Switch scrollUp :: Switch scrollDown :: Switch scrollLeft :: Switch scrollRight :: Switch backButton :: Switch forwardButton :: Switch _Backspace :: Switch _Tab :: Switch _LineFeed :: Switch _Clear :: Switch _Return :: Switch _Pause :: Switch _ScrollLock :: Switch _SysReq :: Switch _Escape :: Switch _Delete :: Switch _Home :: Switch _Left :: Switch _Up :: Switch _Right :: Switch _Down :: Switch _Prior :: Switch _PageUp :: Switch _Next :: Switch _PageDown :: Switch _End :: Switch _Begin :: Switch _Select :: Switch _Print :: Switch _Execute :: Switch _Insert :: Switch _Undo :: Switch _Redo :: Switch _Menu :: Switch _Find :: Switch _Cancel :: Switch _Help :: Switch _Break :: Switch _ModeSwitch :: Switch _ScriptSwitch :: Switch _NumLock :: Switch _KP_Space :: Switch _KP_Tab :: Switch _KP_Enter :: Switch _KP_F1 :: Switch _KP_F2 :: Switch _KP_F3 :: Switch _KP_F4 :: Switch _KP_Home :: Switch _KP_Left :: Switch _KP_Up :: Switch _KP_Right :: Switch _KP_Down :: Switch _KP_Prior :: Switch _KP_PageUp :: Switch _KP_Next :: Switch _KP_PageDown :: Switch _KP_End :: Switch _KP_Begin :: Switch _KP_Insert :: Switch _KP_Delete :: Switch _KP_Multiply :: Switch _KP_Add :: Switch _KP_Separator :: Switch _KP_Subtract :: Switch _KP_Decimal :: Switch _KP_Divide :: Switch _KP_Equal :: Switch _KP_0 :: Switch _KP_1 :: Switch _KP_2 :: Switch _KP_3 :: Switch _KP_4 :: Switch _KP_5 :: Switch _KP_6 :: Switch _KP_7 :: Switch _KP_8 :: Switch _KP_9 :: Switch _F1 :: Switch _F2 :: Switch _F3 :: Switch _F4 :: Switch _F5 :: Switch _F6 :: Switch _F7 :: Switch _F8 :: Switch _F9 :: Switch _F10 :: Switch _F11 :: Switch _F12 :: Switch _F13 :: Switch _F14 :: Switch _F15 :: Switch _F16 :: Switch _F17 :: Switch _F18 :: Switch _F19 :: Switch _Shift :: Switch _Shift_L :: Switch _Shift_R :: Switch _Ctrl :: Switch _Control :: Switch _Control_L :: Switch _Control_R :: Switch _CapsLock :: Switch _ShiftLock :: Switch _Meta :: Switch _Meta_L :: Switch _Meta_R :: Switch _Alt :: Switch _Alt_L :: Switch _Alt_R :: Switch _Super :: Switch _Super_L :: Switch _Super_R :: Switch _Hyper :: Switch _Hyper_L :: Switch _Hyper_R :: Switch _Space :: Switch _Exclamation :: Switch _Quotation :: Switch _NumberSign :: Switch _Dollar :: Switch _Percent :: Switch _Ampersand :: Switch _Apostrophe :: Switch _ParenLeft :: Switch _ParenRight :: Switch _Asterisk :: Switch _Plus :: Switch _Comma :: Switch _Minus :: Switch _Period :: Switch _Slash :: Switch _0 :: Switch _1 :: Switch _2 :: Switch _3 :: Switch _4 :: Switch _5 :: Switch _6 :: Switch _7 :: Switch _8 :: Switch _9 :: Switch _Colon :: Switch _Semicolon :: Switch _Less :: Switch _Equal :: Switch _Greater :: Switch _Question :: Switch _At :: Switch _A :: Switch _B :: Switch _C :: Switch _D :: Switch _E :: Switch _F :: Switch _G :: Switch _H :: Switch _I :: Switch _J :: Switch _K :: Switch _L :: Switch _M :: Switch _N :: Switch _O :: Switch _P :: Switch _Q :: Switch _R :: Switch _S :: Switch _T :: Switch _U :: Switch _V :: Switch _W :: Switch _X :: Switch _Y :: Switch _Z :: Switch _BracketLeft :: Switch _Backslash :: Switch _BracketRight :: Switch _Circumflex :: Switch _Underscore :: Switch _Grave :: Switch _BraceLeft :: Switch _Bar :: Switch _BraceRight :: Switch _Tilde :: Switch -- | 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 switch :: Bool -> Switch -> 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 single Switch -- or a list of Switches. 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 Switch