Mercurial > hg > smartopen
annotate README.txt @ 14:a62fbff067f8
start bringing this whole thing up to speed
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 01 May 2013 06:56:12 -0700 |
parents | 7328744920de |
children | 12db2d46722d |
rev | line source |
---|---|
5 | 1 smartopen |
2 ========= | |
3 | |
4 smartopen is a command line program that will transform text according | |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
5 to handlers to URLs and open them |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
6 |
5 | 7 |
8 Usage | |
9 ----- | |
10 | |
11 ``smartopen --help`` displays the program usage: | |
12 | |
13 """ | |
14 Usage: smartopen [options] | |
15 | |
16 Options: | |
17 -h, --help show this help message and exit | |
18 -c CONFIG, --config=CONFIG | |
19 config file to read | |
20 -u, --url print the first url handled | |
21 -a, --all print all handlers that match the query | |
22 -H HANDLERS, --handler=HANDLERS | |
23 name of the handler to use, in order | |
24 --print-handlers print all handlers in order they would be tried | |
25 """ | |
26 | |
27 smartopen reads text from standard input or command line arguments. | |
28 The handlers are then iterated through in a configurable order and, if | |
29 the handler can transform the text into a URL, the URL is then | |
30 processed. Unless otherwise specified by command line options | |
31 (e.g. --url, --all), the first matching URL is then opened in firefox. | |
32 | |
33 | |
34 Handlers | |
35 -------- | |
36 | |
37 smartopen has a pluggable system of configurable handlers. The | |
38 setuptools entry point ``[smartopen.locations]`` is an extension point | |
39 for the handlers. Several handlers come with smartopen, or you can | |
40 write your own. | |
41 | |
42 URL: a resolvable URL | |
43 Google: a google search | |
44 Wikipedia: a Wikipedia article | |
45 GoogleMaps: an address in google maps | |
46 | |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
47 etc. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
48 |
5 | 49 |
50 Configuration | |
51 ------------- | |
52 | |
53 smartopen uses a configuration file that defines the order of the | |
54 handlers and their behavior. | |
55 | |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
56 A simple example is shown here: |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
57 http://k0s.org/hg/smartopen/file/tip/smartopen.ini |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
58 |
5 | 59 |
60 Interfacing With Your Environment | |
61 --------------------------------- | |
62 | |
63 While smartopen is useful of its own right, its utility may be | |
64 enhanced by using as part of an environment. For instance, I run the | |
65 fluxbox window manager which allows the use of hotkeys. By binding | |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
66 smartopen to ``Ctrl+Alt+s`` and using ``xclip``, I can open a URL that is |
5 | 67 mappable to a smartopen handler with a keyboard shortcut. The |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
68 relevant line from my ``~/.fluxbox/keys`` file reads: |
5 | 69 |
70 Control Mod1 s :ExecCommand /home/jhammel/python/smartopen.py "$(xclip -o)" # smartopen | |
71 | |
72 | |
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
73 ---- |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
74 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
75 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
76 Posterity is gained... |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
77 ---------------------- |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
78 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
79 I mostly wrote smartopen to help me. That it has. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
80 However...a few things.... |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
81 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
82 - better way of setting up handlers? |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
83 - really, i want to push down to choose what i think the handler is, |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
84 but only should we I release the hand that Jesus becomes Magic |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
85 (sorry, I hate the movie too) |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
86 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
87 ....and more? |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
88 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
89 Was reading about catfish....e.g. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
90 http://www.addictivetips.com/ubuntu-linux-tips/catfish-file-searching-tool-for-ubuntu-linux/ |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
91 ... |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
92 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
93 """ |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
94 file search tool that support several different engines |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
95 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
96 A file search tool using different backends which is configurable via |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
97 the command line. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
98 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
99 This program acts as a frontend for different file search engines. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
100 The interface is intentionally lightweight and simple. But it takes |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
101 configuration options from the command line. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
102 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
103 Currently find, locate, tracker, strigi, pinot, and beagle are |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
104 supported as backends |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
105 """. |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
106 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
107 Should smartopen....be a pluggable thing that takes text and finds |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
108 both *the handler* and *what to do with it*??? |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
109 |
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
110 I mean, short of it being a neural network anyway.... |