5
|
1 smartopen
|
|
2 =========
|
|
3
|
|
4 smartopen is a command line program that will transform text according
|
|
5 to handlers to URLs and open them
|
|
6
|
|
7 Usage
|
|
8 -----
|
|
9
|
|
10 ``smartopen --help`` displays the program usage:
|
|
11
|
|
12 """
|
|
13 Usage: smartopen [options]
|
|
14
|
|
15 Options:
|
|
16 -h, --help show this help message and exit
|
|
17 -c CONFIG, --config=CONFIG
|
|
18 config file to read
|
|
19 -u, --url print the first url handled
|
|
20 -a, --all print all handlers that match the query
|
|
21 -H HANDLERS, --handler=HANDLERS
|
|
22 name of the handler to use, in order
|
|
23 --print-handlers print all handlers in order they would be tried
|
|
24 """
|
|
25
|
|
26 smartopen reads text from standard input or command line arguments.
|
|
27 The handlers are then iterated through in a configurable order and, if
|
|
28 the handler can transform the text into a URL, the URL is then
|
|
29 processed. Unless otherwise specified by command line options
|
|
30 (e.g. --url, --all), the first matching URL is then opened in firefox.
|
|
31
|
|
32
|
|
33 Handlers
|
|
34 --------
|
|
35
|
|
36 smartopen has a pluggable system of configurable handlers. The
|
|
37 setuptools entry point ``[smartopen.locations]`` is an extension point
|
|
38 for the handlers. Several handlers come with smartopen, or you can
|
|
39 write your own.
|
|
40
|
|
41 URL: a resolvable URL
|
|
42 Google: a google search
|
|
43 Wikipedia: a Wikipedia article
|
|
44 GoogleMaps: an address in google maps
|
|
45
|
|
46
|
|
47 Configuration
|
|
48 -------------
|
|
49
|
|
50 smartopen uses a configuration file that defines the order of the
|
|
51 handlers and their behavior.
|
|
52
|
|
53
|
|
54 Interfacing With Your Environment
|
|
55 ---------------------------------
|
|
56
|
|
57 While smartopen is useful of its own right, its utility may be
|
|
58 enhanced by using as part of an environment. For instance, I run the
|
|
59 fluxbox window manager which allows the use of hotkeys. By binding
|
|
60 smartopen to Ctrl+Alt+s and using xclip, I can open a URL that is
|
|
61 mappable to a smartopen handler with a keyboard shortcut. The
|
|
62 relevant line from my ~/.fluxbox/keys file reads:
|
|
63
|
|
64 Control Mod1 s :ExecCommand /home/jhammel/python/smartopen.py "$(xclip -o)" # smartopen
|
|
65
|
|
66
|