Skip to content

Commit

Permalink
Reference pre-built binaries and restructure some for clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
gawashburn committed Dec 3, 2024
1 parent a6c0732 commit 9f83659
Showing 1 changed file with 66 additions and 50 deletions.
116 changes: 66 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,65 +26,27 @@ A simple command-line tool for manipulating the configuration of macOS displays.

## Installation

Until someone creates packages for knoll, probably the most common way to
install it will be to use cargo or Nix.
### Pre-built binaries

### Cargo
Pre-built Intel and Apple Silicon binaries are available from the GitHub
repository [releases](https://github.com/gawashburn/knoll/releases/) page.

If you already have a Rust environment set up, you can use the
`cargo install` command:
Note that after downloading and unpacking, as these binaries are not signed
you may need to run the following command so that macOS will allow them to
be run:

```bash
cargo install knoll
xattr -d com.apple.quarantine /path/to/knoll
```

### launchd

The recommended solution for running knoll as a daemon is to make use of
[
`launchd`](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html).
Choose a service name unique to your host using
the [reverse domain name](https://en.wikipedia.org/wiki/Reverse_domain_name_notation)
convention and create a `.plist` file in `~/Library/LaunchAgents`:

```xml
<?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>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>...</string>
</dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>my.service.knoll</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/knoll</string>
<string>daemon</string>
<string>-vvv</string>
<string>--input=/path/to/config-file</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/knoll.err</string>
<key>StandardOutPath</key>
<string>/tmp/knoll.out</string>
</dict>
</plist>
```
### Cargo

You can then enable and start service using
If you already have a Rust environment set up, you can use the
`cargo install` command:

```bash
launchctl enable gui/$(id -u)/my.service.knoll`
launchctl start gui/$(id -u)/my.service.knoll`
````
cargo install knoll
```

### Nix

Expand Down Expand Up @@ -130,6 +92,9 @@ use the following `launchd` definition like:
};
```

The particulars of the configuration file you craft in your Nix definition will
be explained in the subsequent sections.

## Usage

knoll has three primary usage modes: pipeline mode, listing mode, and
Expand Down Expand Up @@ -382,6 +347,57 @@ level of responsiveness, it can be configured:
host$ knoll daemon --wait=500ms --input=my_config.json
```

### launchd

The recommended solution for running knoll as a daemon is to make use of
[
`launchd`](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html).
If you are not using nix-darwin as described in
the [Installation](#installation)
section, you can still configure `launchd` manually.
Choose a service name unique to your host using
the [reverse domain name](https://en.wikipedia.org/wiki/Reverse_domain_name_notation)
convention and create a `.plist` file in `~/Library/LaunchAgents`:

```xml
<?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>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>...</string>
</dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>my.service.knoll</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/knoll</string>
<string>daemon</string>
<string>-vvv</string>
<string>--input=/path/to/config-file</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/knoll.err</string>
<key>StandardOutPath</key>
<string>/tmp/knoll.out</string>
</dict>
</plist>
```

You can then enable and start service using

```bash
launchctl enable gui/$(id -u)/my.service.knoll`
launchctl start gui/$(id -u)/my.service.knoll`
````

## Configuration reference

A configuration may contain the following fields:
Expand Down

0 comments on commit 9f83659

Please sign in to comment.