Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

noniq
Copy link
Member

@noniq noniq commented Aug 17, 2014

Set TM_TERMINAL_NEW_WINDOW if you prefer to open a new window instead.

Set `TM_TERMINAL_NEW_WINDOW` if you prefer to open a new window instead.
@infininight
Copy link
Member

Pulled as c1077db, thanks!

@noniq noniq deleted the use-tabs-in-terminal branch August 18, 2014 22:01
@sorbits
Copy link
Member

sorbits commented Oct 29, 2014

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).

@noniq
Copy link
Member Author

noniq commented Oct 29, 2014

I can confirm that it works unreliably under Yosemite 😞

@noniq
Copy link
Member Author

noniq commented Oct 29, 2014

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?

@sorbits
Copy link
Member

sorbits commented Oct 29, 2014

We probably also need to watch active process and wait for that to be
Terminal, before sending the keystroke.

Unsure if this is easily done.

On 29 Oct 2014, at 15:46, Stefan Daschek wrote:

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?


Reply to this email directly or view it on GitHub:
#20 (comment)

@noniq
Copy link
Member Author

noniq commented Oct 29, 2014

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.

@infininight
Copy link
Member

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.

@infininight
Copy link
Member

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.

infininight added a commit that referenced this pull request Nov 1, 2014
Due to lackluster AppleScript support in Terminal it is not possible to reliably open a new tab as you get an error if the user has not yet released the modifier keys required to initiate the command. This reverts c1077db from pull request #20.
@infininight
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants