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

Detect Microsoft Edge install (if Google Chrome isn't) on MacOS #10162

Closed
Tracked by #10170
jmhammond opened this issue Jun 27, 2024 · 10 comments · Fixed by #10172
Closed
Tracked by #10170

Detect Microsoft Edge install (if Google Chrome isn't) on MacOS #10162

jmhammond opened this issue Jun 27, 2024 · 10 comments · Fixed by #10172
Labels
chromium enhancement New feature or request
Milestone

Comments

@jmhammond
Copy link

jmhammond commented Jun 27, 2024

Bug description

When trying to render documents that include diagrams, we need to have some chrome-based browser installed.
Because of work, I have Microsoft Edge installed, and I don't have Google Chrome, because the two browsers are both really large.

The line of code here:

    path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";

looks only for Chrome on MacOS, but checks for Edge when the OS is Windows. Is it possible to also look for /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge on MacOS?

Steps to reproduce

---
title: "In-Class: Relations - Digraphs"
format: 
  pdf: default
---
Any quarto document that includes a diagram and compiling a PDF; here's a sample:

...

` pretend these are connected... formatted for bugreport ``{dot}
//| fig-width: 2
digraph {
  node [shape = circle, width=0.5];
  rankdir = LR;
  1 -> 1;
  1 -> 2;
  2 -> 4; 
  1 -> 3;
  3 -> 4;
  4 -> 1;
}
` pretend these are connected... formatted for bugreport ``

Expected behavior

Detect Microsoft Edge as my chromium browser (as noted in the documentation).

Actual behavior

It says I need to install chrome.

Your environment

  • IDE: VS Code
  • OS: MacOS 14.5

Quarto check output

Quarto 1.4.556
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.556
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.1 (Conda)
      Path: /opt/homebrew/Caskroom/miniforge/base/envs/pysquirrel/bin/python
      Jupyter: 5.7.1
      Kernels: python3, ir, SageMath-10.1

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.46
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
@jmhammond jmhammond added the bug Something isn't working label Jun 27, 2024
@cscheid cscheid added enhancement New feature or request and removed bug Something isn't working labels Jun 27, 2024
@cscheid cscheid added this to the Future milestone Jun 27, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Jun 27, 2024

I don't Quarto should try to detect whatever chromium-based browser is installed.
There are way too many, installation path can be very different from one system to another, etc.

This being said, having a QUARTO_CHROMIUM environment variable would allow users to set whatever they think might work.

Note that chromium is not a full browser and not the same as Chrome.

Quarto needs chromium not a browser.

quarto install chromium

This being said, from the documentation:

Quarto can automatically use an existing version of Chrome or Edge on your system for rendering. Alternatively, if you don’t have either, you can install a minimal version of Chrome for use by Quarto with the following command

So Edge should be detected but maybe only on Windows.

@cscheid
Copy link
Collaborator

cscheid commented Jun 27, 2024

Note that chromium is not a full browser.

What do you mean?

@mcanouil
Copy link
Collaborator

Sorry, I meant Quarto does not use/install the full version of Chromium and that Chromium has a very minimalist user interface without all the features Chrome/Edge/Brave/etc have

@jmhammond
Copy link
Author

Having an environment variable would be really helpful.

My issue with the quarto install chromium at the moment is the version it’s pulling crashes every single time with not logging to diagnose the problem.

@cscheid
Copy link
Collaborator

cscheid commented Jun 27, 2024

We'll add an environment variable. Seems like a good thing to do for 1.6.

@cscheid cscheid modified the milestones: Future, v1.6 Jun 27, 2024
@mcanouil
Copy link
Collaborator

@cscheid we probably also need to update the documentation as we currently state that both Chrome and Edge are detected by Quarto.

@cderv
Copy link
Collaborator

cderv commented Jun 28, 2024

I have opened an macro issue to track a proper solution for all chromium based browser

as this is not the first time this Chromium configuration question is raised

@cderv
Copy link
Collaborator

cderv commented Jun 28, 2024

we probably also need to update the documentation as we currently state that both Chrome and Edge are detected by Quarto.

@mcanouil We do detect Edge I believe, but on Windows only it seems

} else if (Deno.build.os === "windows") {
// Try the HKLM key
const programs = ["chrome.exe", "msedge.exe"];
for (let i = 0; i < programs.length; i++) {
path = await readRegistryKey(
"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" +
programs[i],
"(Default)",
);
if (path && existsSync(path)) break;
}
// Try the HKCR key
if (!path) {
const regKeys = ["ChromeHTML", "MSEdgeHTM"];
for (let i = 0; i < regKeys.length; i++) {
path = await readRegistryKey(
`HKCR\\${regKeys[i]}\\shell\\open\\command`,
"(Default)",
);
path = path?.match(/"(.*)"/);
path = path ? path[1] : undefined;
if (path && existsSync(path)) break;
}
}

Documentation is not completely incorrect, it is probably just innacurate by not stating it is windows only.

So I believe this is the part of the code that could be fixed easily to indeed also find Edge on Mac as it is done on Windows, as it happens Edge is available on Mac and Windows.

@jmhammond where Edge is located on Mac ? Same place as Google Chrome ?

@mcanouil
Copy link
Collaborator

/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge from the original post.

@cderv
Copy link
Collaborator

cderv commented Jun 28, 2024

Ah thanks ! Missed it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromium enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants