forked from Dimentium/homebrew-autoraise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoraise.rb
57 lines (50 loc) · 1.86 KB
/
autoraise.rb
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
class Autoraise < Formula
desc "Focus-follows-mouse for MacOS"
homepage "https://github.com/sbmpost/AutoRaise"
version "3.1"
url "https://github.com/sbmpost/AutoRaise/archive/refs/tags/v#{version}.tar.gz"
sha256 "a5d8172fc7b57bf0ab4e65d046dddaf3825d89d5a5183296d2afbaa6dcc0265c"
license "GPL-3.0"
option "with-dalternative_task_switcher", "Build with compile flag -DALTERNATIVE_TASK_SWITCHER"
option "with-dold_activation_method", "Build with compile flag -DOLD_ACTIVATION_METHOD"
option "with-dexperimental_focus_first", "Build with compile flag -DEXPERIMENTAL_FOCUS_FIRST"
head do
url "https://github.com/sbmpost/AutoRaise.git"
end
def install
opts = []
opts << "-DALTERNATIVE_TASK_SWITCHER" if build.with? "dalternative_task_switcher"
opts << "-DOLD_ACTIVATION_METHOD" if build.with? "dold_activation_method"
opts << "-DEXPERIMENTAL_FOCUS_FIRST" if build.with? "dexperimental_focus_first"
cxxflags = "CXXFLAGS='#{opts.join(' ')}'" if !opts.empty?
system "make clean"
system ["make", cxxflags].join(' ')
bin.install "AutoRaise"
end
plist_options :manual => "AutoRaise"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/AutoRaise</string>
</array>
<key>StandardErrorPath</key>
<string>#{ENV["HOME"]}/Library/Logs/AutoRaise.log</string>
<key>StandardOutPath</key>
<string>#{ENV["HOME"]}/Library/Logs/AutoRaise.log</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
system "false"
end
end