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

Binding keyboard shortcut to Mac (OS X) Command Key #150

Open
edcache opened this issue May 24, 2019 · 6 comments
Open

Binding keyboard shortcut to Mac (OS X) Command Key #150

edcache opened this issue May 24, 2019 · 6 comments

Comments

@edcache
Copy link

edcache commented May 24, 2019

Hi!

I have for long been annoyed with the lack of "duplicate line" in MatLab, so I was thrilled to find this plugin. I was able to install it on my Mac, despite the instruction seems written for Windows. However, how do I bind the Duplicate Line action to the keyboard shortcut: "Command + D"? (I.e. "⌘+D")

Thanks for your plugin!!

@GavriYashar
Copy link
Owner

GavriYashar commented Jun 5, 2019

Hi!

I honestly don't know if the -key is recognized the same way as CTRL is. but you could try to use META instead of CONTROL

e.g.:

# opens up the file structure browser
kb.fileStructure = CONTROL + F12
# opens up the file structure browser
kb.fileStructure = META + F12

notes for myself:
https://alvinalexander.com/blog/post/jfc-swing/how-program-apple-command-key-keystroke-java-swing-mac-osx
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK);
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());

https://stackoverflow.com/questions/15418987/java-robot-keypress-command-key
https://coderanch.com/t/331234/java/Apple-Command-Key
KeyEvent.VK_META

@danielrohrbach
Copy link

Hi,

the META key is not assigned in the KeyStrokeUtil.java, this can be fixed easily to allow to set the Command key for MAC OS. I modified the code and compiled it and it seems to work fine on my MAC now. Let me know if you are interested in the code.

And yes, thank for the plugin, its great.

@GavriYashar
Copy link
Owner

@danielrohrbach yes I'm interested.

Thank you, but let's say it's good enough.

@danielrohrbach
Copy link

I send you an email over the weekend which contains the code with the changes. Let me know if you got it.

@GavriYashar
Copy link
Owner

Could you try this jar? I've implemented your code
MEP_1.39.jar.zip

GavriYashar pushed a commit that referenced this issue Feb 20, 2021
@danielrohrbach
Copy link

danielrohrbach commented Feb 23, 2021 via email

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

No branches or pull requests

3 participants