Mercurial > hg > smartopen
annotate README.txt @ 18:122b9dcffdaa default tip
stub url2txt
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 03 Aug 2013 23:17:04 -0700 |
| parents | a815b73c8e19 |
| children |
| 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 |
| 16 | 82 - there should be a local version |
|
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
83 - better way of setting up handlers? |
| 16 | 84 - really, i want to push down to choose what i think the handler is; |
| 85 that is, in some ideal world, I press (e.g.) Ctrl+Alt+s ; if i | |
| 86 *release* then i get the default, but i am shown the several matches | |
| 87 and can A. make my choice at that point; -or- B. interact in an even | |
| 88 more creative way | |
| 17 | 89 * potential real answers: dialog, ??? |
|
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
90 |
| 16 | 91 See also mad scramblings from the comments atop |
| 92 http://k0s.org/programs.html | |
| 93 | |
|
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
94 Was reading about catfish....e.g. |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
95 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
|
96 ... |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
97 |
|
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 file search tool that support several different engines |
| 16 | 100 |
|
14
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
101 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
|
102 the command line. |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
103 |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
104 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
|
105 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
|
106 configuration options from the command line. |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
107 |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
108 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
|
109 supported as backends |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
110 """. |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
111 |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
112 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
|
113 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
|
114 |
|
a62fbff067f8
start bringing this whole thing up to speed
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
115 I mean, short of it being a neural network anyway.... |
