Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DISPLAY environment variable for browser on Linux #5706

Merged
merged 3 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Library/Homebrew/manpages/brew.1.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ Note that environment variables must have a value set to be detected. For exampl
If set, Homebrew will tweak behaviour to be more relevant for Homebrew
developers (active or budding), e.g. turning warnings into errors.

* `HOMEBREW_DISPLAY`:
If set, Homebrew will use this X11 display when opening a page in a browser,
for example with `brew home`. Primarily useful on Linux.

*Default:* the value of the user's `DISPLAY` environment variable.

* `HOMEBREW_EDITOR`:
If set, Homebrew will use this editor when editing a single formula, or
several formulae in the same directory.
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ def exec_browser(*args)
browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN)
return unless browser

ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"]

safe_exec(browser, *args)
end

Expand Down
2 changes: 1 addition & 1 deletion bin/brew
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
# Whitelist and copy to HOMEBREW_* all variables previously mentioned in
# manpage or used elsewhere by Homebrew.
for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \
BROWSER EDITOR GIT NO_COLOR PATH VISUAL
BROWSER DISPLAY EDITOR GIT NO_COLOR PATH VISUAL
do
# Skip if variable value is empty.
[[ -z "${!VAR}" ]] && continue
Expand Down
6 changes: 6 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,12 @@ Note that environment variables must have a value set to be detected. For exampl
If set, Homebrew will tweak behaviour to be more relevant for Homebrew
developers (active or budding), e.g. turning warnings into errors.

* `HOMEBREW_DISPLAY`:
If set, Homebrew will use this X11 display when opening a page in a browser,
for example with `brew home`. Primarily useful on Linux.

*Default:* the value of the user's `DISPLAY` environment variable.

* `HOMEBREW_EDITOR`:
If set, Homebrew will use this editor when editing a single formula, or
several formulae in the same directory.
Expand Down
7 changes: 7 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,13 @@ If set, any commands that can emit debugging information will do so\.
If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\.
.
.TP
\fBHOMEBREW_DISPLAY\fR
If set, Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\.
.
.IP
\fIDefault:\fR the value of the user\'s \fBDISPLAY\fR environment variable\.
.
.TP
\fBHOMEBREW_EDITOR\fR
If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory\.
.
Expand Down