diff options
| author | phinze | 2011-05-26 13:01:21 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-01-21 22:26:06 -0600 |
| commit | e5ae248478cdbf83f0435b70875dffd8cc291967 (patch) | |
| tree | 50f1dd7c08985c62aede3d03c491f7016921fc56 | |
| parent | c570b6b929ae78e8fbd933fabae89cc9c244df23 (diff) | |
| download | homebrew-e5ae248478cdbf83f0435b70875dffd8cc291967.tar.bz2 | |
New formula: reattach-to-user-namespace
A small utility that can be used to fix broken OSX clipboard integration
in a variety of tools, most notably tmux and screen.
Closes #8016.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -rw-r--r-- | Library/Formula/reattach-to-user-namespace.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Library/Formula/reattach-to-user-namespace.rb b/Library/Formula/reattach-to-user-namespace.rb new file mode 100644 index 000000000..aed66dadc --- /dev/null +++ b/Library/Formula/reattach-to-user-namespace.rb @@ -0,0 +1,38 @@ +require 'formula' + +class ReattachToUserNamespace < Formula + head 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git' + homepage 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard' + url 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git', :tag => 'dadea0aa48259c704d0b412b9588de2f5623e323' + version 'dadea0' + + def options + [ + ['--wrap-pbcopy-and-pbpaste', 'Include wrappers for pbcopy/pbpaste that shim in this fix'], + ['--wrap-launchctl', 'Include wrapper for launchctl with this fix'] + ] + end + + def install + system "make" + bin.install "reattach-to-user-namespace" + wrap_pbpasteboard_commands if ARGV.include? '--wrap-pbcopy-and-pbpaste' + wrap_launchctl if ARGV.include? '--wrap-launchctl' + end + + def wrap_pbpasteboard_commands + make_executable_with_content('pbcopy', 'cat - | reattach-to-user-namespace /usr/bin/pbcopy') + make_executable_with_content('pbpaste', 'reattach-to-user-namespace /usr/bin/pbpaste') + end + + def wrap_launchctl + make_executable_with_content('launchctl', 'reattach-to-user-namespace /bin/launchctl "$@"') + end + + def make_executable_with_content(executable_name, content_lines) + executable = bin.join(executable_name) + content = [*content_lines].unshift("#!/bin/sh").join("\n") + executable.write(content) + executable.chmod(0755) + end +end |
