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

Add "Trigger another shortcut" action to have multiple ways to trigger the same shortcut #93

Closed
ambrt opened this issue Nov 29, 2017 · 8 comments

Comments

@ambrt
Copy link

ambrt commented Nov 29, 2017

I have "ctrl+ernter' shortcut, how can i trigger it from 'alt+enter' without copying one to other?

@crittermike
Copy link
Owner

Currently there's no way to do that, but we could add a "Trigger other shortcut" action I suppose. Can I ask what the use case is? Like, why do you want 2 different ways to trigger the same shortcut?

@crittermike crittermike changed the title Trigger other shortcut Add "Trigger another shortcut" action to have multiple ways to trigger the same shortcut Nov 29, 2017
@sterbalr
Copy link

Typically I want to do this in other applications where I use the keyboard differently for different situations. The most common is in SQL Server Management studio. If I'm holding the mouse to select text I might use the F5 key to execute, otherwise I use the CTRL+E shortcut.

@ambrt
Copy link
Author

ambrt commented Dec 4, 2017

The original case is that i have multiple jQuery queries for a websites (submit buttons on different pages) in one big function.

The need for different shortcuts for same functionality is that i'm used to different shortcuts used in other enviroments (like linux nano has ctrl+o to save, and windows notepad has ctrl+s to save) so sometimes i habitually use one of them.

When i adding new part of a function or adding a new shortcut with same func, i'd need to copy whole updated function to different shortcuts every time i change something.

@mikecrittenden If i understand well, You suggest to add Trigger another shortcut from "Behavior" menu. I'd suggest to also allow triggering it from within the Js code to be more flexible and cover use case like @sterbalr well described.

@crittermike
Copy link
Owner

Good point @ambrt. That seems possible. I was hoping you could just call Mousetrap.trigger('ctrl+a') directly like the docs suggest https://craig.is/killing/mice#api.trigger but since Mousetrap lives as a content script, and your custom JS lives as an actual script tag that's inserted into the page, that doesn't work unfortunately. But I'm sure I could find a workaround for that.

@ambrt
Copy link
Author

ambrt commented Dec 6, 2017

But I'm sure I could find a workaround for that.

That would be great. Keep us in the loop about it!

@crittermike
Copy link
Owner

I pushed 10ae3f5 which does the following:

2017-12-08 at 9 26 pm

What do you all think of that? Obviously it's a little awkward that the text field is super wide, but otherwise, is that kind of what you had in mind?

@ambrt
Copy link
Author

ambrt commented Dec 10, 2017

I wouldn't mind the width issue. Will you push it to chrome store? It looks good to me.

@crittermike
Copy link
Owner

Pushed to v2.2.5 and uploaded to webstore. Thanks!

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

No branches or pull requests

3 participants