XMonad.Util.Paste

xmonad-contrib-0.12: Third party extensions for xmonad

Copyright | (C) 2008 Jérémy Bobbio, gwern
License | BSD3
Maintainer | none
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Util.Paste

Contents

- Usage

Description

A module for sending key presses to windows. This modules provides generalized and specialized functions for this task.

Synopsis

- pasteSelection :: X ()
- pasteString :: String -> X ()
- pasteChar :: KeyMask -> Char -> X ()
- sendKey :: KeyMask -> KeySym -> X ()
- sendKeyWindow :: KeyMask -> KeySym -> Window -> X ()
- noModMask :: KeyMask

# Usage

Import this module into your xmonad.hs as usual:

    import XMonad.Util.Paste

And use the functions. They all return `X` (), and so are appropriate for use as keybindings. Example:

             , ((m,              xK_d), pasteString "foo bar") ]

Don't expect too much of the functions; they probably don't work on complex texts.

pasteSelection :: X ()

Paste the current X mouse selection. Note that this uses `getSelection` from XMonad.Util.XSelection and so is heir to its flaws.

pasteString :: String -> X ()

Send a string to the window which is currently focused. This function correctly handles capitalization. Warning: in dealing with capitalized characters, this assumes a QWERTY layout.

pasteChar :: KeyMask -> Char -> X ()

Send a character to the current window. This is more low-level. Remember that you must handle the case of capitalization appropriately. That is, from the window's perspective:

    pasteChar mod2Mask 'F' ~> "f"

You would want to do something like:

    pasteChar shiftMask 'F'

Note that this function makes use of `stringToKeysym`, and so will probably have trouble with any `Char` outside ASCII.

sendKey :: KeyMask -> KeySym -> X ()

sendKeyWindow :: KeyMask -> KeySym -> Window -> X ()

The primitive. Allows you to send any combination of `KeyMask` and `KeySym` to any `Window` you specify.

noModMask :: KeyMask