Simplified browser configuration for MacOS X
Add an optional #:browser argument to send-url/mac and export it. This makes it straightforward to use different browsers and/or to configure a different one: (require net/sendurl) (external-browser (lambda (url) (send-url/mac url #:browser "Conkeror")))
This commit is contained in:
parent
88551aa8c6
commit
1b6f2356e7
|
@ -5,7 +5,7 @@
|
|||
|
||||
(require racket/system racket/file racket/promise racket/port)
|
||||
|
||||
(provide send-url send-url/file send-url/contents
|
||||
(provide send-url send-url/file send-url/contents send-url/mac
|
||||
unix-browser-list browser-preference? external-browser)
|
||||
|
||||
(define separate-by-default?
|
||||
|
@ -156,8 +156,12 @@
|
|||
(send-url/file temp)))
|
||||
|
||||
(define osascript (delay/sync (find-executable-path "osascript" #f)))
|
||||
(define (send-url/mac url)
|
||||
(browser-run (force osascript) "-e" (format "open location \"~a\"" url)))
|
||||
(define (send-url/mac url #:browser [browser #f])
|
||||
(browser-run (force osascript) "-e"
|
||||
(if browser
|
||||
(format "tell application \"~a\" to open location \"~a\""
|
||||
browser url)
|
||||
(format "open location \"~a\"" url))))
|
||||
|
||||
(define (send-url/unix url separate-window?)
|
||||
;; in cases where a browser was uninstalled, we might get a preference that
|
||||
|
|
Loading…
Reference in New Issue
Block a user