aboutsummaryrefslogtreecommitdiffstats
path: root/HomebrewFormula/dome-key.rb
blob: c5e4a70069bcddc779806d521039bd1bb1ea7b53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class DomeKey < Formula
  desc "Control your computer with a pair of headphones"
  homepage "https://domekey.teddywing.com"
  version "1.0"
  url "https://domekey.teddywing.com/downloads/dome-key_1.0.tar.bz2"
  sha256 "a724bd988d1d40103057216c6f08ab0c768a172c8167aaef7a9f692a5aa784e9"

  # Rust code requires at least 10.7
  depends_on :macos => :lion

  def install
    bin.install "dome-key"
    man1.install "dome-key.1"
    man7.install "dome-key-mappings.7"
  end

  def plist_name
    "com.teddywing.dome-key"
  end

  def caveats; <<~EOS
    To get started with a set of mappings, try running the these commands:

    mkdir -p $HOME/.config/dome-key
    cat <<EOM > $HOME/.config/dome-key/mappings.dkmap
    map <Play> <Nop>

    mode <Play><Play> {
        map <Up> <Left>
        map <Play> <Space>
        map <Down> <Right>
    }
    EOM
  EOS
  end

  plist_options :manual => "dome-key --daemon --audio"

  def plist; <<~EOS
    <?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>
  EOS
  end
end