From 0d4cfadcd516ae79a1dba47e72eae8a1c5e9f315 Mon Sep 17 00:00:00 2001 From: Toby Worland <47527939+tobyWorland@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:41:57 +0000 Subject: [PATCH 1/2] Support (and prefer) 64bit Chrome and Firefox on Windows --- src/plot/browser.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plot/browser.lisp b/src/plot/browser.lisp index 72ce9f9..5d7b92a 100644 --- a/src/plot/browser.lisp +++ b/src/plot/browser.lisp @@ -41,16 +41,18 @@ ;;; (defparameter *browser-commands* - (list (cons :chrome #+win32 "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" + (list (cons :chrome #+win32 (find-if #'probe-file (list "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" + "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")) #+(or macos darwin) "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" #+linux (find-chrome-executable-linux)) - (cons :firefox #+win32 "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" + (cons :firefox #+win32 (find-if #'probe-file (list "C:\\Program Files\\Mozilla Firefox\\firefox.exe" + "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")) #+(or macos darwin) "/Applications/Firefox.app/Contents/MacOS/firefox" #+linux "firefox") (cons :default #+win32 "explorer" #+(or macos darwin) "open" - #-(or macos darwin win32) "xdg-open") - "Maps browser names to system paths")) + #-(or macos darwin win32) "xdg-open")) + "Maps browser names to system paths") (defparameter *default-browser-options* nil) From 7418bee541bbff6cbd35bcd88be7015d783a5c57 Mon Sep 17 00:00:00 2001 From: Toby Worland <47527939+tobyWorland@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:43:21 +0000 Subject: [PATCH 2/2] Fix bug where chrome opens on Windows when simply loading the system This is caused by Windows' Google Chrome not responding to --version causing it instead to open a new window. --- src/plot/browser.lisp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plot/browser.lisp b/src/plot/browser.lisp index 5d7b92a..1a2785b 100644 --- a/src/plot/browser.lisp +++ b/src/plot/browser.lisp @@ -23,11 +23,13 @@ ;;; Chrome on Linux ;;; +#-win32 (defun executable-present-p (potential-executable) "Return T if POTENTIAL-EXECUTABLE responds to --version argument" (ignore-errors (zerop (nth-value 2 (uiop:run-program (list potential-executable "--version")))))) +#+linux (defun find-chrome-executable-linux () "Find Chrome's executable for Linux distributions" ;; Linux distributions unfortunately do not all use the same name for chrome, @@ -116,7 +118,8 @@ ;;; ;;; If passing custom options frequently, set these -(defparameter *default-browser-command* (if (executable-present-p (alexandria:assoc-value *browser-commands* :chrome)) +(defparameter *default-browser-command* (if #+win32(alexandria:assoc-value *browser-commands* :chrome) + #-win32(executable-present-p (alexandria:assoc-value *browser-commands* :chrome)) :chrome-app-mode :default)) (defparameter *default-browser-options* (when (eq *default-browser-command* :chrome-app-mode) *default-chrome-app-options*))