Skip to content

Instantly share code, notes, and snippets.

@spdegabrielle
Created June 19, 2020 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spdegabrielle/c2c41db290c39a48f06d11671d571a59 to your computer and use it in GitHub Desktop.
Save spdegabrielle/c2c41db290c39a48f06d11671d571a59 to your computer and use it in GitHub Desktop.
open-terminal quickscript (not working)

tried to test with from user scripts folder but it fails. with an error

(system (string-append osascriptdir "open-terminal.scpt" "\"cd /Applications/Racket v7.7/bin/\"")

#lang racket/base
(require racket/system
racket/path
quickscript)
(script-help-string "Open a terminal in the current directory.")
(define-script open-terminal
#:label "Open terminal"
#:menu-path ("&Utils")
#:os-types (unix macosx)
#:output-to message-box
(cond
[(equal? (system-type 'os) 'unix)
(λ (str #:file f)
(define dir (path->string (path-only f)))
(system (string-append "gnome-terminal"
" --working-directory=\"" dir "\""
" -t \"" dir "\""
"&"))
#f)]
[(equal? (system-type 'os) 'macosx)
(λ (str #:file f)
(define dir (path->string (path-only f)))
(define osascriptdir (string-append
(path->string (find-system-path 'pref-dir))
"quickscript/user-scripts/"))
(system (string-append osascriptdir "open-terminal.scpt" " \"cd " dir "\""))
#f)]))
#!/usr/bin/osascript
on run argv
if length of argv is equal to 0
set command to ""
else
set command to item 1 of argv
end if
if length of argv is greater than 1
set profile to item 2 of argv
runWithProfile(command, profile)
else
runSimple(command)
end if
end run
on runSimple(command)
tell application "Terminal"
activate
set newTab to do script(command)
end tell
return newTab
end runSimple
on runWithProfile(command, profile)
set newTab to runSimple(command)
tell application "Terminal" to set current settings of newTab to (first settings set whose name is profile)
end runWithProfile
#lang racket/base
(require racket/system
racket/path)
(define f "/Applications/Racket v7.7/bin/slideshow")
(cond
[(equal? (system-type 'os) 'unix)
(λ (str #:file f)
(define dir (path->string (path-only f)))
(system (string-append "gnome-terminal"
" --working-directory=\"" dir "\""
" -t \"" dir "\""
"&"))
#f)]
[(equal? (system-type 'os) 'macosx)
(λ (str #:file f)
(define dir (path->string (path-only f)))
(define osascriptdir (string-append
(path->string (find-system-path 'pref-dir))
"quickscript/user-scripts/"))
(system (string-append osascriptdir "open-terminal.scpt" " \"cd " dir "\""))
#f)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment