aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/Search.hs
diff options
context:
space:
mode:
authorv.dijk.bas <v.dijk.bas@gmail.com>2008-01-31 13:26:20 +0100
committerv.dijk.bas <v.dijk.bas@gmail.com>2008-01-31 13:26:20 +0100
commit24dc09aa48e7b2a569aa8c0201c485cfec04ef55 (patch)
tree30bae9c00879a202e49d8dff7e4c06756f9315ab /XMonad/Actions/Search.hs
parent07f59a98c143519d021bfec4b05a3cc5a569529b (diff)
downloadXMonadContrib-24dc09aa48e7b2a569aa8c0201c485cfec04ef55.tar.gz
XMonadContrib-24dc09aa48e7b2a569aa8c0201c485cfec04ef55.tar.xz
XMonadContrib-24dc09aa48e7b2a569aa8c0201c485cfec04ef55.zip
Added a handy tip to the documentation of XMonad.Actions.Search
The tip explains how to use the submap action to create a handy submap of keybindings for searching. darcs-hash:20080131122620-4237f-af8af65fe7f3189e5d6d9c6b162afdf214765756.gz
Diffstat (limited to 'XMonad/Actions/Search.hs')
-rw-r--r--XMonad/Actions/Search.hs48
1 files changed, 47 insertions, 1 deletions
diff --git a/XMonad/Actions/Search.hs b/XMonad/Actions/Search.hs
index 3e1b325..caae13c 100644
--- a/XMonad/Actions/Search.hs
+++ b/XMonad/Actions/Search.hs
@@ -28,6 +28,9 @@ module XMonad.Actions.Search ( -- * Usage
scholar,
wayback,
wikipedia
+ -- * Tip
+ -- $tip
+
) where
import Data.Char (chr, ord, isAlpha, isMark, isDigit)
@@ -79,7 +82,50 @@ import XMonad.Util.XSelection (getSelection)
* 'wikipedia' -- basic Wikipedia search.
Feel free to add more!
+-}
+
+{- $tip
+
+In combination with "XMonad.Actions.Submap" you can create a powerfull
+and easy way to search without adding a whole bunch of bindings:
+
+First import the necessary modules:
+
+@
+import qualified XMonad.Prompt as P
+import qualified XMonad.Actions.Submap as SM
+import qualified XMonad.Actions.Search as S
+@
+
+Then add the following to your key bindings:
+
+@
+ -- Search commands
+ , ((modm, xK_s), SM.submap $ searchEngineMap $ S.promptSearch P.defaultXPConfig)
+ , ((modm .|. shiftMask, xK_s), SM.submap $ searchEngineMap $ S.selectSearch)
+@
+
+where:
+
+@
+ searchEngineMap method = M.fromList $
+ [ ((0, xK_g), method \"firefox\" S.google)
+ , ((0, xK_h), method \"firefox\" S.hoogle)
+ , ((0, xK_w), method \"firefox\" S.wikipedia)
+ ]
+@
+
+Make sure to set firefox to open new pages in a new window instead of in a new tab:
+Firefox -> Edit -> Preferences -> Tabs -> New pages should be opened in...
+
+Now /modm-s g/ \/ /h/ \/ /w/ prompts you for a search string, then opens a new
+firefox window that performs the search on Google, Hoogle or
+Wikipedia respectively.
+
+If you select something in whatever application and hit /modm-shift-s g/ \/ /h/ \/ /w/
+it will search the selected string with the specified engine.
+Happy searching!
-}
-- A customized prompt.
@@ -164,4 +210,4 @@ promptSearch config browser site = mkXPrompt Search config (getShellCompl []) $
-}
selectSearch :: MonadIO m => Browser -> SearchEngine -> m ()
-selectSearch browser searchEngine = search browser searchEngine =<< getSelection \ No newline at end of file
+selectSearch browser searchEngine = search browser searchEngine =<< getSelection