Disable Spotlight keyboard shortcut for selected applications

4

3

Spotlight search is activated by Ctrl+Space.

Unfortunately, this collides with code completion in Eclipse.

I could change the shortcut for either function, but I'd like to stick with the defaults.

Is there a way to disable the Spotlight shortcut when a given application is active (in this case Eclipse)?

Thilo

Posted 2009-10-08T06:22:06.603

Reputation: 2 975

It's actually cmd+space and, granted, I know there is a solution for this answer, but I couldn't find it right now. – cregox – 2010-04-30T00:00:28.947

Answers

4

I don't think it is possible to disable the Spotlight shortcut just when a specific application is in focus. The closest thing for you to do would be to re-map the shortcut (either Spotlight's or Eclipse's).

To change the keyboard shortcut systemwide for Spotlight:

  • In System Preferences, go to Keyboard, then Keyboard Shortcuts.
  • In the column on the left, select Spotlight.
  • Double click the shortcut (in this case ⌘ Space) and hold down the new shortcut. I suggest something similar, such as option + Space.

enter image description here

Josh Hunt

Posted 2009-10-08T06:22:06.603

Reputation: 20 095

1

Follow these steps:

  1. System Preferences
  2. Spotlight
  3. Untick Spotlight menu keyboard shortcut

Simon

Posted 2009-10-08T06:22:06.603

Reputation: 11

0

Change the keyboard shortcut for showing the Spotlight menu to something like control-command-space:

Then use a private.xml like this with KeyRemap4MacBook:

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>ECLIPSE</appname>
    <equal>org.eclipse.eclipse</equal>
  </appdef>
  <item>
    <name>test</name>
    <identifier>test</identifier>
    <not>ECLIPSE</not>
    <autogen>__KeyToKey__ KeyCode::SPACE, VK_COMMAND | ModifierFlag::NONE,
    KeyCode::SPACE, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>
  </item>
</root>

Lri

Posted 2009-10-08T06:22:06.603

Reputation: 34 501

-2

Sounds like a job for Autohotkey. Use the ifwinactive or ifwinexist functions. Can't yet work out the exact code, but shouldn't be too hard with a bit of time.

outsideblasts

Posted 2009-10-08T06:22:06.603

Reputation: 6 297

There is an autohotkey for mac tho: Iron AHK http://code.google.com/p/ironahk/ and there's also an automator alternative that you can drag n' drop commands that resembles AHK, but I can't remember its name.

– cregox – 2010-04-29T23:59:52.097

1Umm… Spotlight is for OS X. Autohotkey is for Windows... – Josh Hunt – 2009-10-08T06:32:54.193

Whoops. Should have read closer sorry. – outsideblasts – 2009-10-08T06:44:08.833

Think I read Spotlight as Silverlight. – outsideblasts – 2009-10-08T06:47:04.290