From 5a8fd56e9d1ee3cf08d93dbf99880a7f4663fd3b Mon Sep 17 00:00:00 2001 From: Paul David Date: Wed, 3 Jul 2019 21:22:08 +1000 Subject: [PATCH] Add auto-launch instructions. Fixes #2. --- README.md | 44 +++++++++++++++++++++++++++++++++++++++ com.debounceMac.app.plist | 24 +++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 com.debounceMac.app.plist diff --git a/README.md b/README.md index a795300..173e2b9 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,50 @@ $ sudo ./debounce It needs root because it intercepts keystrokes. +If you really want, you can "install" it. Assuming that +`/usr/local/bin` is in your `$PATH` (which it is if you use Homebrew) +you can: + +```ShellSession +$ make install +``` + +### Auto-start at login + +Another [helpful +contribution](https://github.com/toothbrush/debounce-mac/issues/2), +this time from @cpouldev. If you'd like to auto-start `debounce` at +login, you might find something like the [included LaunchAgent +configuration](./com.debounceMac.app.plist) helpful. + +Put that somewhere `launchctl` can find it, like +`~/Library/LaunchAgents/com.debounceMac.app.plist`, then load the +configuration. macOS will automatically prompt you to give `debounce` +Accessibility access, this is needed to be able to intercept and +modify keystrokes. + +```ShellSession +$ launchctl load ~/Library/LaunchAgents/com.debounceMac.app.plist +``` + +macOS will automatically prompt you to give `debounce` Accessibility +access, this is needed to be able to intercept and modify keystrokes. +When that's done, start it. + +```ShellSession +$ launchctl start com.debounceMac.app +``` + +To remove / uninstall completely: + +```ShellSession +$ launchctl stop com.debounceMac.app +$ launchctl unload ~/Library/LaunchAgents/com.debounceMac.app.plist +$ rm ~/Library/LaunchAgents/com.debounceMac.app.plist +$ launchctl list +$ rm /usr/local/bin/debounce +``` + ### Accessibility / permissions You might get an error something like the following, even when running diff --git a/com.debounceMac.app.plist b/com.debounceMac.app.plist new file mode 100644 index 0000000..3a64b7b --- /dev/null +++ b/com.debounceMac.app.plist @@ -0,0 +1,24 @@ + + + + + EnvironmentVariables + + PATH + /usr/local/bin + + KeepAlive + + SuccessfulExit + + + Label + com.debounceMac.app + ProgramArguments + + /usr/local/bin/debounce + + RunAtLoad + + +