Giter Site home page Giter Site logo

andrewchidden / btt-services Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 4.0 212 KB

Simple command-line utilities designed for BetterTouchTool presets.

Home Page: https://andrewchidden.com

License: Other

Objective-C 99.89% C 0.11%
bettertouchtool objective-c eventkit audiotoolbox nsevent ocmockito andrewchidden

btt-services's Introduction

btt-services

Simple command-line utilities designed for BetterTouchTool presets. Able to use BetterTouchTool’s integrated web server to send low-latency refresh widget messages.

Most utilities require controller scripts for appearance state and process persistence, which can be found at andrewchidden/btt-controllers.

Article about the preset at andrewchidden.com.

EventKit Service

About

Observes EventKit for changes and outputs the upcoming calendar event information in a readable text format. May be extended to read reminders in the future.

API

Usage: ./eventkit-service
  --lookahead=<minutes>, -l <minutes>
        How long in minutes to look into the future for events.

  --status-path=<path>, -p <path>
        The file path to save the latest event status message. Intermediary directories must exist.

  --empty-message=<message>, -m <message>
        The status message to show when there are no events within `lookahead`. If not specified,
        a default message will be shown instead when there are no events.

  --btt-url=<url>, -u <url>
        The optional base URL to BetterTouchTool's web server in the format `protocol://hostname:port`.
        If not specified, the service will not push updates to BetterTouchTool.

  --btt-secret=<secret>, -s <secret>
        The optional shared secret to authenticate with BetterTouchTool's web server.

  --widget-uuid=<uuid>, -w <uuid>
        The UUID of the BetterTouchTool widget to refresh on update pushes. If not specified, the
        service will not push updates to BetterTouchTool.

  --calendars=<names>, -c <names>
        An optional comma delimited list of case-sensitive calendar names to check for events. If
        not specified, the service checks all calendars for events.

  --delimiter=<delim>, -d <delim>
        The optional string delimiter to use for separating calendar names. If not specified, the
        service will use comma for the calendar name list delimiter.

Volume Service

About

Listens for volume changes from CoreAudio and outputs a serialized device volume state.

API

Usage: ./volume-service
  --status-path=<path>, -p <path>
        The file path to save the latest volume state. Intermediary directories must exist.

  --btt-url=<url>, -u <url>
        The optional base URL to BetterTouchTool's web server in the format `protocol://hostname:port`.
        If not specified, the service will not push updates to BetterTouchTool.

  --btt-secret=<secret>, -s <secret>
        The optional shared secret to authenticate with BetterTouchTool's web server.

  --widget-uuid=<uuid>, -w <uuid>
        The UUID of the BetterTouchTool widget to refresh on update pushes. If not specified, the
        service will not push updates to BetterTouchTool.

  --use-threshold=<bool>, -u <bool>
        Whether to only treat changes between volume appearance thresholds as valid events. See
        also, `--thresholds, -t`.

  --thresholds=<num_list>, -t <num_list>
        An optional list of comma-delimited, strictly-greater-than thresholds in descending order.
        If not specified, [65,32,0] is used instead, corresponding to the system thresholds.

Control Strip Service

About

Replicates system-level keyboard buttons (volume, brightness) and additional side effects (feedback sound, open preference pane) based on the current set of modifier keys (shift, option).

API

Usage: ./controlstrip-service
  --type=<volume|brightness>, -t <volume|brightness>
        The class of keyboard events to handle. Should be either `volume` or `brightness`.
        - `volume` modifier key behavior:
              [None] Adjusts volume.
              [Shift] Plays feedback sound.
              [Option] Opens Volume preference pane in System Preferences.
              [Shift+Option] Small volume adjustments.
        - `brightness` modifier key behavior:
              [None] Adjusts screen brightness.
              [Shift] Changes keyboard illumination.
              [Option] Opens Displays preference pane in System Preferences.
              [Shift+Option] Small screen brightness adjustments.

  --direction=<dir>, -d <dir>
        The direction of the change, either 0 or 1, where 0 is decrement, 1 is increment.

Building from Source

  1. Download and install the latest version of Xcode.
  2. Open ./btt-services.xcodeproj.
  3. Build each target (for Running = debug, for Profiling = release).

Contributing

Contributions welcomed. Some ground rules:

  • Please ensure that you follow the style of the codebase which takes inspiration from Google’s Objective-C style guide.
  • Add unit tests for all core service functionality. This project uses OCMockito for general-purpose mocking and verification.
    • To test services that use C-style function APIs, create a stub and forward invocations to a concrete mock. Examples can be found in ./Tests/Stubs.
    • Keep code coverage of services and service utilities above 95%, using the code coverage feature in Xcode.

Contact

"andrew"
"@"
"andrewchidden.com"

License

Copyright © 2018 CarbonTech Software LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

btt-services's People

Contributors

andrewchidden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

btt-services's Issues

Failing control strip and EventKit service unit tests

Preliminary changes are on master so that people who build from source can have the latest executables. However, changes break some of the more annoying unit tests to work with (control strip service).

Don’t have time to fix this right now, but will look into fixing soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.