New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default to open new tab. #20
Conversation
Set `TM_TERMINAL_NEW_WINDOW` if you prefer to open a new window instead.
Pulled as c1077db, thanks! |
Someone reported an issue on the mailing list with this, and it’s also not working for me (though for me it just never opens a tab, and it always beeps). I think sending keystrokes via AppleScript relies on timing, so I think we should revert this PR — we can still have the option, but not as default (as long as it’s fragile). |
I can confirm that it works unreliably under Yosemite 😞 |
In http://stackoverflow.com/questions/1794050/applescript-to-open-named-terminal-window there are two possible solutions mentioned: Keeping track of the number of tabs (and waiting for them to increase) before continuing with the script); or selecting the appropriate menu entry (requires “access for assistive devices” to be enabled and needs to use different menu titles according to the system locale). Should I give the first solution a try? |
We probably also need to watch active process and wait for that to be Unsure if this is easily done. On 29 Oct 2014, at 15:46, Stefan Daschek wrote:
|
You're right. If only apple would expose “New Tab” via AppleScript … 😠 So I too think this should be reverted, making “New window” the default behaviour again. I'll try and see if there's a way to make “New tab” more reliable. |
Added: tell application "System Events"
repeat while "Terminal" is not name of (process 1 where frontmost is true)
delay 0.1
end repeat
end tell And it almost fixes the issue, but it appears there can be a brief moment when Terminal is technically active but keyboard shortcuts don't work. Need to see if I can find something else to test for. |
Did some more testing tonight and I think actually that my code does fix the issue, but only if you take your hand off the modifier key before AppleScript presses the shortcut. Haven't found any way to detect if the modifiers are still help down or any way to counteract them yet. |
I've deployed a fix that works as long as you don't leave the modifier keys depressed too long when initiating the command, but I swapped back the default since I can't work around that issue. But for those that use the variable it should work better than before. |
Set
TM_TERMINAL_NEW_WINDOW
if you prefer to open a new window instead.