Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 420a649e6f65db30aa7451f64d08ff92 > files > 734

ghc-xmonad-contrib-devel-0.9.2-4.fc16.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XMonad.Util.XSelection</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_XMonad-Util-XSelection.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/XMonad-Util-XSelection.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">xmonad-contrib-0.9.2: Third party extensions for xmonad</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>unportable</td></tr><tr><th>Stability</th><td>unstable</td></tr><tr><th>Maintainer</th><td>Gwern Branwen &lt;gwern0@gmail.com&gt;</td></tr></table><p class="caption">XMonad.Util.XSelection</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Usage
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A module for accessing and manipulating X Window's mouse selection (the buffer used in copy and pasting).
<code><a href="XMonad-Util-XSelection.html#v:getSelection">getSelection</a></code> and <code><a href="XMonad-Util-XSelection.html#v:putSelection">putSelection</a></code> are adaptations of Hxsel.hs and Hxput.hs from the XMonad-utils, available:
</p><pre> $ darcs get &lt;http://gorgias.mine.nu/repos/xmonad-utils&gt;
</pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:getSelection">getSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; m <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li class="src short"><a href="#v:promptSelection">promptSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:safePromptSelection">safePromptSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:transformPromptSelection">transformPromptSelection</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:transformSafePromptSelection">transformSafePromptSelection</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:putSelection">putSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">Usage
</h1><div class="doc"><p>Add <code>import XMonad.Util.XSelection</code> to the top of Config.hs
   Then make use of getSelection or promptSelection as needed; if
   one wanted to run Firefox with the selection as an argument (perhaps
   the selection string is an URL you just highlighted), then one could add
   to the xmonad.hs a line like thus:
</p><pre> , ((modm .|. shiftMask, xK_b), promptSelection &quot;firefox&quot;)
</pre><p>There are a number of known problems with XSelection:
</p><ul><li> Unicode handling is busted. But it's still better than calling
      <code>chr</code> to translate to ASCII, at least.
      As near as I can tell, the mangling happens when the String is
      outputted somewhere, such as via promptSelection's passing through
      the shell, or GHCi printing to the terminal. utf-string has IO functions
      which can fix this, though I do not know have to use them here. It's
      a complex issue; see
      <a href="http://www.haskell.org/pipermail/xmonad/2007-September/001967.html">http://www.haskell.org/pipermail/xmonad/2007-September/001967.html</a>
      and <a href="http://www.haskell.org/pipermail/xmonad/2007-September/001966.html">http://www.haskell.org/pipermail/xmonad/2007-September/001966.html</a>.
</li><li> Needs more elaborate functionality: Emacs' registers are nice; if you
      don't know what they are, see <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Registers.html#Registers">http://www.gnu.org/software/emacs/manual/html_node/emacs/Registers.html#Registers</a> 
</li></ul></div><div class="top"><p class="src"><a name="v:getSelection" class="def">getSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; m <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a><a href="src/XMonad-Util-XSelection.html#getSelection" class="link">Source</a></p><div class="doc"><p>Returns a String corresponding to the current mouse selection in X; if there is none, an empty string is returned. Note that this is
 really only reliable for ASCII text and currently escapes or otherwise mangles more complex UTF-8 characters.
</p></div></div><div class="top"><p class="src"><a name="v:promptSelection" class="def">promptSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/XMonad-Util-XSelection.html#promptSelection" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:safePromptSelection" class="def">safePromptSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/XMonad-Util-XSelection.html#safePromptSelection" class="link">Source</a></p><div class="doc"><p>A wrapper around <code><a href="XMonad-Util-XSelection.html#v:getSelection">getSelection</a></code>. Makes it convenient to run a program with the current selection as an argument.
This is convenient for handling URLs, in particular. For example, in your Config.hs you could bind a key to
         <code>promptSelection &quot;firefox&quot;</code>;
this would allow you to highlight a URL string and then immediately open it up in Firefox.
</p><p><code><a href="XMonad-Util-XSelection.html#v:promptSelection">promptSelection</a></code> passes strings through the system shell, /bin/sh; if you do not wish your selected text
to be interpreted or mangled by the shell, use <code><a href="XMonad-Util-XSelection.html#v:safePromptSelection">safePromptSelection</a></code>. safePromptSelection will bypass the
shell using <code><a href="XMonad-Util-Run.html#v:safeSpawn">safeSpawn</a></code> from <a href="XMonad-Util-Run.html">XMonad.Util.Run</a>; see its documentation for more
details on the advantages and disadvantages of using safeSpawn. 
</p></div></div><div class="top"><p class="src"><a name="v:transformPromptSelection" class="def">transformPromptSelection</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/XMonad-Util-XSelection.html#transformPromptSelection" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:transformSafePromptSelection" class="def">transformSafePromptSelection</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; X <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/XMonad-Util-XSelection.html#transformSafePromptSelection" class="link">Source</a></p><div class="doc"><p>A wrapper around <code><a href="XMonad-Util-XSelection.html#v:promptSelection">promptSelection</a></code> and its safe variant. They take two parameters, the first is a function that transforms strings, and the second is the application to run. The transformer essentially transforms the selection in X.
One example is to wrap code, such as a command line action copied out of the browser to be run as <code><a href="sudo.html">sudo</a> ++ cmd</code> or <code><a href="su - -c &quot;.html">su - -c &quot;</a>++ cmd ++<a href="&quot;.html">&quot;</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:putSelection" class="def">putSelection</a> :: <a href="/usr/share/doc/ghc/html/libraries/transformers-0.2.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a> -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/XMonad-Util-XSelection.html#putSelection" class="link">Source</a></p><div class="doc"><p>Set the current X Selection to a specified string.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>