aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-11-15Add doc/dome-key-mappings.7.txt man pageoTeddy Wing
This describes the syntax of the `mappings.dkmap` file.
2018-11-15doc/dome-key.1.txt: Add "Files" sectionTeddy Wing
Learned that files should be described in the man page.
2018-11-14Add generated doc/dome-key.1 man pageTeddy Wing
2018-11-14Makefile(doc): Don't remove intermediate fileTeddy Wing
Prevent the man page from always building even without changes to the input file.
2018-11-14doc/dome-key.1.txt: Add copyrightTeddy Wing
Include the Aquatic Prime copyright notice as stipulated by its license.
2018-11-14doc/dome-key.1.txt: Add "Launchd" sectionTeddy Wing
Include the program's launchd plist in the man page.
2018-11-14doc/dome-key.1.txt: Add "Mappings" sectionTeddy Wing
2018-11-14doc/dome-key.1.txt: Add "Configuration" sectionTeddy Wing
Describe the `timeout` configuration option.
2018-11-14doc/dome-key.1.txt: Add real descriptions of command line optionsTeddy Wing
2018-11-14doc/dome-key.1.txt: Fix closing quoteTeddy Wing
Used the wrong terminator, '`' instead of '''.
2018-11-11Update TODOTeddy Wing
2018-11-11pkg/dome-key.in.rb: Add the command to run if you don't use launchdTeddy Wing
Now that I think about it, a daemon would execute in the background, not take over the shell. But whatever, not going to change that now when I'm about to release the program.
2018-11-11pkg/dome-key.in.rb: Add sample config setup to Brew CaveatsTeddy Wing
Make it faster to try out the program by providing copy-pastable commands to get a sample config. `HOME` needs two `$` to escape it from the Python templater.
2018-11-11Update TODOTeddy Wing
2018-11-10Add doc/extract_special_key_names.shTeddy Wing
Script to extract the names of special keys like `<VolumeUp>` from `parser.rs`. Need these for the mappings syntax manual.
2018-11-06Makefile(dist/dome-key): Copy binary from xcarchiveTeddy Wing
The release build is 1.5 Mb, while the archive is 1.1 Mb. Not sure what additional optimisations Xcode applies when it archives, but clearly that's the build we should be distributing.
2018-11-06Add file size optimisations to Release buildTeddy Wing
* Remove `dome-key-map/target/debug` from Release library search paths. This was causing the Release build to link against the debug version of dome-key-map, resulting in a 25 Mb binary. * Strip debug symbols * Turn on link-time optimisation This takes the Release binary down to 1.5 Mb. Added an `archive` target to the Makefile. This does additional optimisations (maybe stripping symbols?), and gives us a final binary size of 1.1 Mb. Much better.
2018-11-05Remove lib/char_to_key_code.*Teddy Wing
We don't need these functions any more now that key simulation is handled by the Rust library. The files can be safely removed.
2018-11-05lib/dome-key-map: Update to latestTeddy Wing
Fixes parse error when the mappings file starts with blank lines or comment lines.
2018-11-05Makefile: Organise targetsTeddy Wing
Split the targets into more logical sections.
2018-11-05Makefile: Add dist targetsTeddy Wing
We'll stick the binary and man pages in this directory for packaging.
2018-11-05Makefile: Use project-local build directoryTeddy Wing
Set 'DerivedData' path in `xcodebuild` to give us a local build directory. Doing this because when the 'Debug', or 'Release' directories in 'Build/Products/' don't exist, Make doesn't build our recipes. Make seems to prefer local files, and I don't imagine the wildcard in the path does us any favours. When I changed the DerivedData path, I ended up with this error: In file included from DomeKey/DomeKey/HeadphoneKey.m:9: DomeKey/DomeKey/HeadphoneKey.h:10:9: fatal error: 'DDHidLib/DDHidAppleMikey.h' file not found #import <DDHidLib/DDHidAppleMikey.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Couldn't figure out what the problem was, and what changed there when I changed the DerivedData directory. So I just fixed it in the only way I could think of: adding the DDHidLib 'lib' directory to `HEADER_SEARCH_PATHS` and updating the `#import` to point to the new location. We also create a release target in this commit, which gives us a release build of the program.
2018-11-05lib/dome-key-map: Update to latestTeddy Wing
2018-11-04Update TODOTeddy Wing
2018-11-04main(): Remove "Hello, World" `NSLog`Teddy Wing
Don't need this any more.
2018-11-04reload_mappings(): Print a log message when mappings are reloadedTeddy Wing
In the daemon, we should print a log message when the mappings file gets reloaded. This allows you to follow along in the log file.
2018-11-04Replace `NSLog`ged error messages with `teprintf`Teddy Wing
Use our own custom error formatter. I think `NSLog` messages get sent to syslog in a release build. This allows us to format the error messages the way we want and ensure they get printed to stderr.
2018-11-04Add `teprintf()` functionTeddy Wing
A new function to print to stderr prefixed with a timestamp. The idea is to make the printed line's format match the Rust logger's. The Rust logger prints timestamps like this: 2018-11-04T03:16:31.938+01:00 `teprintf` does: 2018-11-04T15:02:21+0100 Unfortunately, I wasn't able to reproduce it exactly. It's missing the milliseconds because I didn't want to deal with using `gettimeofday`, and the time zone format isn't right because I didn't know how to format it easily with a colon. Resources: Getting the time in C: https://stackoverflow.com/questions/9596945/how-to-get-appropriate-timestamp-in-c-for-logs#9596994 Variadic functions in C: https://stackoverflow.com/questions/205529/passing-variable-number-of-arguments-around Getting milliseconds in C: https://stackoverflow.com/questions/10192903/time-in-milliseconds#10192994 https://stackoverflow.com/questions/3673226/how-to-print-time-in-format-2009-08-10-181754-811 https://stackoverflow.com/questions/361363/how-to-measure-time-in-milliseconds-using-ansi-c Concatenating strings in C: https://stackoverflow.com/questions/308695/how-do-i-concatenate-const-literal-strings-in-c#308712 https://stackoverflow.com/questions/8465006/how-do-i-concatenate-two-strings-in-c
2018-11-04Update TODOTeddy Wing
2018-11-04Mappings: Print parse error messages when running with `-r`Teddy Wing
Otherwise, the error messages only get printed in the daemon process' output. Much more convenient to print the error messages directly after running the command with `--reload-mappings`.
2018-11-04Get mapping reloader to reload mappings for realTeddy Wing
Previously I got the inter-process communication set up, but left the work of actually reloading the mappings into memory for later. That later is now. Make `Mappings` solely responsible for loading and reloading mappings. What used to be in `HeadphoneKey` for this has now been moved. HeadphoneKey: * Store a reference to a `Mappings` instance * Load mappings using the `Mappings` API instead of calling `dome_key_state_load_map_group()` directly. * Move the call to `observeReloadNotification` here from `main()`. Made more sense to me to have it with the other related mappings setup method calls. * Move the `_state` variable into `Mappings`, since that's where it's used most. Get it from an accessor in the one spot we need it. Mappings: * Make `observeReloadNotification` an instance method. While not necessary, since I decided to call it in `HeadphoneKey` after initialising `_mappings` and calling `reloadMappings`, I figured it made sense to call the method on the instance. * Make `reloadMappings` both an instance method and a class method. Made sense to call it on the instance since we instantiate `Mappings` just before calling it in `HeadphoneKey`. But we also need to be able to call it from `reload_mappings`, the C function, which has no knowledge of the `Mappings` instance. That's why we make it a class method also. * Add a `_state` static variable. Not ideal. Would rather have an instance variable, but this value needs to be accessible from the `reload_mappings` C function, which doesn't have access to instance variables.
2018-11-03Move `dome_key_logger_init` call to `main()`Teddy Wing
Doesn't make sense to have this in the `HeadphoneKey` initialiser. Since it's something that needs to be done near the start of the program, move it into `main()`.
2018-11-03lib/dome-key-map: Update to latestTeddy Wing
New trial encryption key.
2018-11-03lib/dome-key-map: Update to latest, good error messagesTeddy Wing
2018-11-03doc/dome-key.1.txt: Add a rough descriptionTeddy Wing
* Make "OPTIONS" in the Synopsis section lowercase to match other man pages * Add a description of the program. Still not happy with it yet, but it's a start. * Add a "See Also" section that refers to an uncreated man page that should describe the syntax of the dkmap mappings file.
2018-11-03Update TODOTeddy Wing
2018-11-02pkg/dome-key.in.rb: Set dependency on Mac OS X 10.7Teddy Wing
While the Objective-C/Cocoa code is designed to work on at least 10.6, the Rust code requires >=10.7, as something in Rust, maybe the standard library, requires at least that version of Mac OS.
2018-11-02Add the beginning of a man pageTeddy Wing
Copy-pasted options from the `--help` output and reordered them alphabtically. Includes a few stub sections that I think are needed.
2018-11-02Update TODOTeddy Wing
2018-10-30Update TODOTeddy Wing
2018-10-30Update TODOTeddy Wing
2018-10-30Update TODOTeddy Wing
2018-10-30Add a skeleton Homebrew formulaTeddy Wing
The start of a Homebrew formula for the program. Needs a bunch of fields filled out. For now, we're mostly getting it to work as an input template for an accompanying generator script. The script will fill in some values automatically, including the plist file, so that the launchd plist can be activated using Homebrew's services.
2018-10-30Add launchd plistTeddy Wing
2018-10-30Update TODOTeddy Wing
2018-10-30lib/dome-key-map: Update to include default mappingsTeddy Wing
2018-10-29Update TODOTeddy Wing
2018-10-29HeadphoneKey: Play audio only with the `--audio` command line flagTeddy Wing
Allow users to decide whether interface audio (mode activated & deactivated) should play. The flag value is in a `Config`, so to make it easier to pass both the audio flag and the timeout config value to `HeadphoneKey`, rename `initWithTimeout:` to `initWithConfig:`. Only allocate a `Sounds` instance if `--audio` is passed, because there's no reason to allocate memory for it otherwise. Add a `_play_audio` flag as a static variable to make it accessible to the `on_mode_change()` function, just like we did for `sounds_inst`. In `on_mode_change()`, don't play any audio if `_play_audio` is on.
2018-10-29lib/dome-key-map: Update to get `--audio` flag handlingTeddy Wing
2018-10-29HeadphoneKey: Remove unused `_in_mode` instance variableTeddy Wing
This was for when I was trying to store the current mode in this class. It's now stored in a `State` variable.