mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 23:16:18 +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, '\\\\ ')} &&` : '';
|
cd = dir ? `cd ${dir.replace(/ /g, '\\\\ ')} &&` : '';
|
||||||
command = fs.existsSync('/Applications/iTerm.app') ?
|
command = fs.existsSync('/Applications/iTerm.app') ?
|
||||||
`osascript -e 'tell application "iTerm"
|
`osascript -e 'tell application "iTerm"
|
||||||
create window with default profile
|
if application "iTerm" is running then
|
||||||
tell current session of current window to write text "clear && ${cd} ${cmdline}"
|
create window with default profile
|
||||||
end tell'` :
|
end if
|
||||||
|
tell current session of first window to write text "clear && ${cd} ${cmdline}"
|
||||||
|
activate
|
||||||
|
end tell'` :
|
||||||
`osascript -e 'tell application "Terminal"
|
`osascript -e 'tell application "Terminal"
|
||||||
do script "clear && ${cd} ${cmdline}"
|
if application "Terminal" is running then
|
||||||
activate
|
do script "clear && ${cd} ${cmdline}"
|
||||||
end tell'`;
|
else
|
||||||
|
do script "clear && ${cd} ${cmdline}" in window 1
|
||||||
|
end if
|
||||||
|
activate
|
||||||
|
end tell'`;
|
||||||
}
|
}
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
@ -680,4 +686,4 @@ window.quickcommandHttpServer = () => {
|
|||||||
run,
|
run,
|
||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user