Skip to content

Commit

Permalink
Listen for cmd-L as an alias for sh-cmd-F (Search…)
Browse files Browse the repository at this point in the history
The usual IB voodoo from whenever it sees a XIB.
  • Loading branch information
Fritz Anderson committed May 13, 2014
1 parent 42e1795 commit 0941548
Show file tree
Hide file tree
Showing 2 changed files with 297 additions and 1,598 deletions.
26 changes: 26 additions & 0 deletions src/DIGS/AKWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,30 @@ - (void)setTitle:(NSString *)aString
[super setTitle:aString];
}

/** Intercept cmd-L as equivalent to sh-cmd-F
@author Fritz Anderson <fritza@mac.com>
@date 13-May-2014
I keep hitting cmd-L as though the application had
a browser-style address/search bar. I see no harm
in honoring the usual key equivalent.
@bug This method puts a hidden restriction on the use of cmd-L
for other purposes.
*/
- (void) keyDown:(NSEvent *)theEvent
{
NSString * chars = theEvent.characters;
NSUInteger modifiers = theEvent.modifierFlags & NSDeviceIndependentModifierFlagsMask;
BOOL onlyCmdKey = (modifiers == NSCommandKeyMask);

if ([chars isEqualToString: @"l"] && onlyCmdKey) {
[NSApp sendAction: @selector(selectSearchField:) to: nil from: self];
}
else {
[super keyDown: theEvent];
}
}

@end
Loading

0 comments on commit 0941548

Please sign in to comment.