Many applications like Terminal also have a menu item like Window > Cycle Through Windows. It stays assigned to ⌘` even if you change the shortcut in the Keyboard & Text Input preferences.
You could add a custom shortcut for Cycle Through Windows in the Application Shortcuts preferences, or disable it with defaults write -g NSUserKeyEquivalents -dict-add "Cycle Through Windows" nul
.
You could also force TotalTerminal to use ⌘` by editing ~/Library/Preferences/com.apple.Terminal.plist
directly.
<key>ToggleVisor</key>
<dict>
<key>KeyCode</key>
<integer>50</integer>
<key>Modifiers</key>
<integer>9437184</integer>
</dict>
Karabiner comes with everything you need—a way to define a shortcut, and a way to move the mouse. The warp-mouse-cursor-position
utility lives in /Applications/Karabiner.app/Contents/Library/utilities/bin/
.
It has a default setting to warp the mouse to the center of the current window by tapping fn or holding ' or /, but for a customized version, add this to your ~/Library/Application Support/Karabiner/private.xml
: (After you’re done, go into Karabiner’s preferences and check the box inside Mouse Warping.)
<item>
<name>Mouse Warping</name>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_SHELL_mousetowindowcenter</name>
<url type="shell">
<![CDATA[
/Applications/Karabiner.app/Contents/Library/utilities/bin/warp-mouse-cursor-position front_window middle 0 center 0
]]>
</url>
</vkopenurldef>
<item>
<identifier>private.f14_mousetowindowcenter</identifier>
<name>F14 to move the mouse to the center of the current window</name>
<autogen>
--KeyToKey--
KeyCode::F14,
KeyCode::VK_OPEN_URL_SHELL_mousetowindowcenter
</autogen>
</item>
</item>
With Karabiner's utility, you can use the screen
option like this:
warp-mouse-cursor-position screen NUM VERTICAL X_OFFSET HORIZONTAL Y_OFFSET
VERTICAL
can be top
, middle
, or bottom
, and HORIZONTAL
can be left
, center
, or right
.
X_OFFSET
and Y_OFFSET
can be numerical values, like +10
or -10
. Just be careful to put the arguments in the right order—they seem oddly switched.
(For the front window, just use front_window
instead of screen
.)
Probably the most popular way, but in order to use it for moving to the middle of a window, you’d need an AppleScript to get the bounds of the current window, then calculate the center, etc.
Best Answer
No need of 3rd-party apps.
You can go to the Preferences Tab(Menu -> Terminal -> Preferences or
⌘,
), then go to Profiles -> Keyboard. There you can create shortcuts. Enter your command and end with an enter.For example, if you want to run
ls
each time you pressF1
, select F1 in theKey
tab, and press "ls <enter>", which appears likels\015
.I didn't find a way to bind characters though, but using all these keys should be enough.