From e747622d84b2200b5316afa8bff1620cc575089d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 15 Nov 2018 06:43:59 +0100 Subject: Add manual pages Also a section linking to them on the home page. Generated in the main DomeKey repository with: $ a2x --no-xmllint --format xhtml doc/dome-key.1.intermediate.txt $ a2x --no-xmllint --format xhtml doc/dome-key-mappings.7.txt Deciding to go with the AsciiDoc CSS for now and not bother with making these pages fit with the site's style to make things easy. --- doc/docbook-xsl.css | 329 +++++++++++++++++++++++++++++++++++++++++++ doc/dome-key-mappings.7.html | 183 ++++++++++++++++++++++++ doc/dome-key.1.html | 106 ++++++++++++++ index.html | 6 + 4 files changed, 624 insertions(+) create mode 100644 doc/docbook-xsl.css create mode 100644 doc/dome-key-mappings.7.html create mode 100644 doc/dome-key.1.html diff --git a/doc/docbook-xsl.css b/doc/docbook-xsl.css new file mode 100644 index 0000000..ee9ca46 --- /dev/null +++ b/doc/docbook-xsl.css @@ -0,0 +1,329 @@ +/* + CSS stylesheet for XHTML produced by DocBook XSL stylesheets. +*/ + +body { + font-family: Georgia,serif; +} + +code, pre { + font-family: "Courier New", Courier, monospace; +} + +span.strong { + font-weight: bold; +} + +body blockquote { + margin-top: .75em; + line-height: 1.5; + margin-bottom: .75em; +} + +html body { + margin: 1em 5% 1em 5%; + line-height: 1.2; +} + +body div { + margin: 0; +} + +h1, h2, h3, h4, h5, h6 +{ + color: #527bbd; + font-family: Arial,Helvetica,sans-serif; +} + +div.toc p:first-child, +div.list-of-figures p:first-child, +div.list-of-tables p:first-child, +div.list-of-examples p:first-child, +div.example p.title, +div.sidebar p.title +{ + font-weight: bold; + color: #527bbd; + font-family: Arial,Helvetica,sans-serif; + margin-bottom: 0.2em; +} + +body h1 { + margin: .0em 0 0 -4%; + line-height: 1.3; + border-bottom: 2px solid silver; +} + +body h2 { + margin: 0.5em 0 0 -4%; + line-height: 1.3; + border-bottom: 2px solid silver; +} + +body h3 { + margin: .8em 0 0 -3%; + line-height: 1.3; +} + +body h4 { + margin: .8em 0 0 -3%; + line-height: 1.3; +} + +body h5 { + margin: .8em 0 0 -2%; + line-height: 1.3; +} + +body h6 { + margin: .8em 0 0 -1%; + line-height: 1.3; +} + +body hr { + border: none; /* Broken on IE6 */ +} +div.footnotes hr { + border: 1px solid silver; +} + +div.navheader th, div.navheader td, div.navfooter td { + font-family: Arial,Helvetica,sans-serif; + font-size: 0.9em; + font-weight: bold; + color: #527bbd; +} +div.navheader img, div.navfooter img { + border-style: none; +} +div.navheader a, div.navfooter a { + font-weight: normal; +} +div.navfooter hr { + border: 1px solid silver; +} + +body td { + line-height: 1.2 +} + +body th { + line-height: 1.2; +} + +ol { + line-height: 1.2; +} + +ul, body dir, body menu { + line-height: 1.2; +} + +html { + margin: 0; + padding: 0; +} + +body h1, body h2, body h3, body h4, body h5, body h6 { + margin-left: 0 +} + +body pre { + margin: 0.5em 10% 0.5em 1em; + line-height: 1.0; + color: navy; +} + +tt.literal, code.literal { + color: navy; +} + +.programlisting, .screen { + border: 1px solid silver; + background: #f4f4f4; + margin: 0.5em 10% 0.5em 0; + padding: 0.5em 1em; +} + +div.sidebar { + background: #ffffee; + margin: 1.0em 10% 0.5em 0; + padding: 0.5em 1em; + border: 1px solid silver; +} +div.sidebar * { padding: 0; } +div.sidebar div { margin: 0; } +div.sidebar p.title { + margin-top: 0.5em; + margin-bottom: 0.2em; +} + +div.bibliomixed { + margin: 0.5em 5% 0.5em 1em; +} + +div.glossary dt { + font-weight: bold; +} +div.glossary dd p { + margin-top: 0.2em; +} + +dl { + margin: .8em 0; + line-height: 1.2; +} + +dt { + margin-top: 0.5em; +} + +dt span.term { + font-style: normal; + color: navy; +} + +div.variablelist dd p { + margin-top: 0; +} + +div.itemizedlist li, div.orderedlist li { + margin-left: -0.8em; + margin-top: 0.5em; +} + +ul, ol { + list-style-position: outside; +} + +div.sidebar ul, div.sidebar ol { + margin-left: 2.8em; +} + +div.itemizedlist p.title, +div.orderedlist p.title, +div.variablelist p.title +{ + margin-bottom: -0.8em; +} + +div.revhistory table { + border-collapse: collapse; + border: none; +} +div.revhistory th { + border: none; + color: #527bbd; + font-family: Arial,Helvetica,sans-serif; +} +div.revhistory td { + border: 1px solid silver; +} + +/* Keep TOC and index lines close together. */ +div.toc dl, div.toc dt, +div.list-of-figures dl, div.list-of-figures dt, +div.list-of-tables dl, div.list-of-tables dt, +div.indexdiv dl, div.indexdiv dt +{ + line-height: normal; + margin-top: 0; + margin-bottom: 0; +} + +/* + Table styling does not work because of overriding attributes in + generated HTML. +*/ +div.table table, +div.informaltable table +{ + margin-left: 0; + margin-right: 5%; + margin-bottom: 0.8em; +} +div.informaltable table +{ + margin-top: 0.4em +} +div.table thead, +div.table tfoot, +div.table tbody, +div.informaltable thead, +div.informaltable tfoot, +div.informaltable tbody +{ + /* No effect in IE6. */ + border-top: 3px solid #527bbd; + border-bottom: 3px solid #527bbd; +} +div.table thead, div.table tfoot, +div.informaltable thead, div.informaltable tfoot +{ + font-weight: bold; +} + +div.mediaobject img { + margin-bottom: 0.8em; +} +div.figure p.title, +div.table p.title +{ + margin-top: 1em; + margin-bottom: 0.4em; +} + +div.calloutlist p +{ + margin-top: 0em; + margin-bottom: 0.4em; +} + +a img { + border-style: none; +} + +@media print { + div.navheader, div.navfooter { display: none; } +} + +span.aqua { color: aqua; } +span.black { color: black; } +span.blue { color: blue; } +span.fuchsia { color: fuchsia; } +span.gray { color: gray; } +span.green { color: green; } +span.lime { color: lime; } +span.maroon { color: maroon; } +span.navy { color: navy; } +span.olive { color: olive; } +span.purple { color: purple; } +span.red { color: red; } +span.silver { color: silver; } +span.teal { color: teal; } +span.white { color: white; } +span.yellow { color: yellow; } + +span.aqua-background { background: aqua; } +span.black-background { background: black; } +span.blue-background { background: blue; } +span.fuchsia-background { background: fuchsia; } +span.gray-background { background: gray; } +span.green-background { background: green; } +span.lime-background { background: lime; } +span.maroon-background { background: maroon; } +span.navy-background { background: navy; } +span.olive-background { background: olive; } +span.purple-background { background: purple; } +span.red-background { background: red; } +span.silver-background { background: silver; } +span.teal-background { background: teal; } +span.white-background { background: white; } +span.yellow-background { background: yellow; } + +span.big { font-size: 2em; } +span.small { font-size: 0.6em; } + +span.underline { text-decoration: underline; } +span.overline { text-decoration: overline; } +span.line-through { text-decoration: line-through; } diff --git a/doc/dome-key-mappings.7.html b/doc/dome-key-mappings.7.html new file mode 100644 index 0000000..526f348 --- /dev/null +++ b/doc/dome-key-mappings.7.html @@ -0,0 +1,183 @@ + +
Table of Contents
The mappings file lives at ~/.config/dome-key/mappings.dkmap. All +mappings should be written there. Three types of mappings can be defined: +maps, commands, and modes.
Maps are used to simulate keyboard keys. Commands run shell commands. +Modes, when activated, enable you to define multiple actions for the same +headphone buttons.
Map and command mappings are composed of three parts, each separated by +whitespace (one or more spaces or tabs):
MAP_TYPE TRIGGER ACTION
Mappings must be written on a single line. No line continuation operator +is available.
Comment lines are prefixed with a ‘#’ and must appear on their own line. +They are not permitted on the same line as mapping definitions.
ACTION corresponds to a sequence of keyboard keys that will be pressed +virtually. For example,
map <Up> Hello<Enter>
will type "Hello" with a newline at the end. Simulated keys are pressed in +succession as quickly as possible. There is no way to wait or sleep +between keys.
ACTION must be a shell command. In:
cmd <Down> say "Good morning"
the /usr/bin/say command will be executed, playing "Good morning" in +audible speech.
This map type is useful for running arbitrary code that can’t be expressed +by simulating keyboard keys with a map.
Commands are executed with $SHELL -c ACTION. If $SHELL isn’t set, +/bin/sh is used instead.
You can think of modes like Vim modes. They enable you to map the same +trigger more than once. Let’s look at an example:
cmd <Play> open -a Firefox
mode <Up> {
+ map <Play> <Space>
+}Here, the <Play> headphone button will open Firefox. But when the mode +is active, pressing <Play> instead simulates the Space key.
Modes are both activated and deactivated by pressing the TRIGGER sequence +written after the mode keyword. The trigger functions as a toggle. In +our example, pressing <Up> activates the mode. If the mode is active, +pressing <Up> will deactivate the mode, causing top-level mappings to +become available again.
Any number of maps and commands can be defined inside a mode. These are +enclosed by curly braces. Mode mappings should not use the same trigger +as the mode’s. Mappings with the same trigger are ignored:
mode <Play> {
+ # The following mapping is ignored:
+ map <Play> Hello
+}Modes cannot be nested.
Special keys are enclosed in ‘<’ ‘>’ brackets (e.g. <Play>). These are +used in map actions to simulate a key press.
Home, End, PageUp, PageDown
CapsLock, NumLock
Tab, Space
BrightnessUp, BrightnessDown, ContrastUp, ContrastDown
Help
Power, Eject
Modifiers can be applied to any key used in map actions. Modifiers can +also be chained. Modifiers must be prefixed to the key they’re modifying, +both of which are surrounded by ‘<’ ‘>’ brackets.
Video controls:
map <Up> <Left> +map <Play> <Space> +map <Down> <Right>
Don’t launch iTunes when pressing the middle button:
map <Play> <Nop>
Let volume buttons function normally, and activate video controls when +pressing <Play> twice:
mode <Play><Play> {
+ map <Up> <Left>
+ map <Play> <Space>
+ map <Down> <Right>
+}Open frequently used applications:
cmd <Up> open -a Terminal +cmd <Play> open -a Xcode +cmd <Down> open -a Firefox +cmd <Up><Play> open -a Dictionary
Compile code in Vim:
map <Play> <Esc>:make<CR>
Table of Contents
Enables customisation of headphone buttons. The dome-key program runs +in the background listening to button events, executing user-defined +actions in response to these events.
Headphone button mappings are defined in a file called +~/.config/dome-key/mappings.dkmap. See MAPPINGS or +dome-key-mappings(7) for more information.
An optional configuration file can be added at +~/.config/dome-key/config.toml.
Presently, only one configuration option is available. Here’s an example +config:
timeout = 400
Mappings are defined in ~/.config/dome-key/mappings.dkmap. See +dome-key-mappings(7) for a complete explanation of the syntax.
If a button is not mapped, it retains its normal function. The following +mappings apply when undefined, even without a mappings file:
map <Up> <VolumeUp> +map <Play> <Play> +map <Down> <VolumeDown>
It’s recommended that you run the program in the background using +launchd(8). Here’s an example plist:
<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" + "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>com.teddywing.dome-key</string> + <key>ProgramArguments</key> + <array> + <string>/usr/local/bin/dome-key</string> + <string>--daemon</string> + <string>--audio</string> + </array> + <key>RunAtLoad</key> + <true/> + <key>KeepAlive</key> + <true/> + <key>StandardErrorPath</key> + <string>/tmp/dome-key.log</string> +</dict> +</plist>
You can also use brew services to do this automatically if the program +was installed with Homebrew.
Copyright © 2018 Teddy Wing
Copyright © 2005-2010 Lucas Newman and other contributors. All rights +reserved.
Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmd <Play> osascript -e 'activate application "Terminal"' -e 'tell application "System Events" to keystroke "2" using command down'+
+ dome-key(1), + dome-key-mappings(7) +
+