mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 21:46:12 +08:00
修复在终端显示时某些情况下会有弹出多个终端的 bug
This commit is contained in:
parent
0ff673c509
commit
3478bb0edb
@ -258,14 +258,20 @@ let getCommandToLaunchTerminal = (cmdline, dir) => {
|
||||
cd = dir ? `cd ${dir.replace(/ /g, '\\\\ ')} &&` : '';
|
||||
command = fs.existsSync('/Applications/iTerm.app') ?
|
||||
`osascript -e 'tell application "iTerm"
|
||||
create window with default profile
|
||||
tell current session of current window to write text "clear && ${cd} ${cmdline}"
|
||||
end tell'` :
|
||||
if application "iTerm" is running then
|
||||
create window with default profile
|
||||
end if
|
||||
tell current session of first window to write text "clear && ${cd} ${cmdline}"
|
||||
activate
|
||||
end tell'` :
|
||||
`osascript -e 'tell application "Terminal"
|
||||
do script "clear && ${cd} ${cmdline}"
|
||||
activate
|
||||
end tell'`;
|
||||
|
||||
if application "Terminal" is running then
|
||||
do script "clear && ${cd} ${cmdline}"
|
||||
else
|
||||
do script "clear && ${cd} ${cmdline}" in window 1
|
||||
end if
|
||||
activate
|
||||
end tell'`;
|
||||
}
|
||||
return command;
|
||||
}
|
||||
@ -680,4 +686,4 @@ window.quickcommandHttpServer = () => {
|
||||
run,
|
||||
stop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user