XCode Simulator: how to change its shortcuts? - xcode

When the simulator in XCode is running, the default shortcuts for rotation are Cmd+Left and Cmd+Right.
Is there any way to change them? For example, change them to Ctrl+Left & Ctrl+Right?

I was able to change Simulator shortcuts by doing the following:
Open Simulator
Right click the icon in the tray
Select Options > Show in Finder
Copy Simulator.app to your /Applications directory
At this point, you won't be able to run Simulator.app from the /Applications directory, but that's ok, we're just going to use it there for setting the shortcut(s). To do that, follow the steps you would to change any other app's shortcuts:
System Preferences > Keyboard > Shortcuts
App Shortcuts > add [+]
Select the Simulator.app from the list (wouldn't appear unless we had already completed the steps above.)
Exact name of Menu item and shortcut.
Add
Now go ahead and delete Simulator.app from /Applications. The shortcut will still be changeable and the app will be listed from now on.

I could use Jason's answer without having to duplicate Simulator.app into Applications and then delete it.
Not sure the needed Other... and Search options required some particular MacOS, so I'm copying the adapted steps here :
System Preferences > Keyboard > Shortcuts
App Shortcuts > add [+]
Open list of Applications, select Other... at the bottom
Use the search box to search for Simulator.app
Simulator.app should appear, double click it
Exact name of Menu item, and shortcut
Add

Related

is it possibile to open iTerm in current Finder position

Sometimes it could be very useful to open new iTerm window. I've seen this feature in Gnome window manager. It is possible to get same feature on MaxOsX? Is there a software to do that?
Go to System Preferences -> Keyboard -> Shortcuts -> Services -> Files and Folders and give preferred shortcuts.
The shortcut will open iTerm at the selected folder, instead of from the folder that has been opened.
You can right-click on the folder where you want iTerm2 to open, then select Services -> New iTerm2 Tab here.
You can also find other options in the Services menu to open iTerm2 and Terminal.
This was tested on iTerm2 3.x and Catalina and above.
There are two apps called "Go2Shell" and "ShellHere". Both place a small icon at the top of the finder window. When the icon is clicked a terminal window opens in the same directory as the finder window.
Go2Shell
Go2Shell can be downloaded from Mac App Store or developer's website. It is possible that you won't be able to install it from Mac App Store, because Go2Shell wasn't updated for a long time.
Go2Shell allows users to specify whether to open shell in Terminal or iTerm2.
ShellHere
Shellhere can be downloaded from here.
ShellHere allows users to open a folder only in uses only MacOS Terminal.
Problem with current solutions: Doesn't work in current folder. Only if you right click a folder.
So do this:
In Finder, press ⌥ + ⌘ + P to show the path bar.
Then, right click your folder and choose the option. Voila!
Try https://github.com/wonderyue/Go2ShellAppleScript.
Something like Go2Shell. The latest update of Go2Shell is five years ago, due to the compatibility problem, I make a similar one with AppleScript.
If you want to open iTerm in current Finder position try the following:
OpenInTerminal
https://github.com/Ji4n1ng/OpenInTerminal
Alternative and a bit older
TermHere
https://hashbang.productions/apps/termhere/ (last updated on 2016)
Both work without issues in MacOS Catalina
cdto doesn't support opening the folder in iTerm, so its a no go
If you have BetterTouchTool, you can just create a Finder trigger with action "Open Active/Selected Folder With Specific App" and select "iTerm". Works for me!
BetterTouchTool screenshot
EDIT:
You can even add Hotkey Window hotkey before "Open Active/Selected Folder With Specific App" to open the terminal in the hotkey window (as a tab). Really neat.
In hotkey window
I've been using cdto forever before accidentally stumbling on to the accepted answer. Will definitely try out the accepted answer, but leaving a link to cdto here if someone finds in useful
https://github.com/jbtule/cdto

How to define a shortcut key for opening a terminal in Mac OS [duplicate]

One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window.
In Ubuntu, I was using (window+Alt+T) to open Terminal. But now I use a Macbook at my programming job.
Sometimes I use Spotlight to search "Terminal", and press Enter.
I'd like to know if I can assign a keyboard hotkey to do it.
I tested the following procedure under macOS Mojave 10.14.6 (18G3020).
Launch Automator. Create a document of type “Quick Action”:
(In older versions of macOS, use the “Service” template.)
In the new Automator document, add a “Run AppleScript” action. (You can type “run applescript” into the search field at the top of the action list to find it.) Here's the AppleScript to paste into the action:
on run {input, parameters}
tell application "Terminal"
if it is running then
do script ""
end if
activate
end tell
end run
Set the “Workflow receives” popup to “no input”. It should look like this overall:
Save the document with the name “New Terminal”. Then go to the Automator menu (or the app menu in any running application) and open the Services submenu. You should now see the “New Terminal” quick action:
If you click the “New Terminal” menu item, you'll get a dialog box:
Click OK to allow the action to run. You'll see this dialog once in each application that's frontmost when you use the action. In other words, the first time you use the action while Finder is frontmost, you'll see the dialog. And the first time you use the action while Safari is frontmost, you'll see the dialog. And so on.
After you click OK in the dialog, Terminal should open a new window.
To assign a keyboard shortcut to the quick action, choose the “Services Preferences…” item from the Services menu. (Or launch System Preferences, choose the Keyboard pane, then choose the Shortcuts tab, then choose Services from the left-hand list.) Scroll to the bottom of the right-hand list and find the New Terminal service. Click it and you should see an “Add Shortcut” button:
Click the button and press your preferred keyboard shortcut. Then, scratch your head, because (when I tried it) the Add Shortcut button reappears. But click the button again and you should see your shortcut:
Now you should be able to press your keyboard shortcut in most circumstances to get a new terminal window.
As programmers we want the quickest, most fool-proof way to get our tools in order so we can start hacking. Here are how I got it to work in MacOS 10.13.1 (High Sierra):
Option 1: Go to System Preferences | Keyboard | Shortcut | Services.
Under Files and Folders section, enable New Terminal at Folder
and/or New Terminal Tab at Folder and assign a shortcut key to it.
Option 2: If you want the shortcut key to work anywhere, create a new Service using Automator, then go to the Keyboard Shortcut to assign a shortcut key to it. Known limitation: not work from the desktop
Notes:
If the shortcut doesn't work, it might be in conflict with another
key binding (and the OS wouldn't warn you), try something else, e.g.
if ⇧⌥T doesn't work, try ⇧⌘T.
Don't spell-correct MacOS, that's not necessary.
iTerm2 - an alternative to Terminal - has an option to use configurable system-wide hotkey to show/hide (initially set to Alt+Space, disabled by default)
There is a third party app called hotkey app which can launch apps based on the configured shortcuts.
You can install it and setup required shortcut.
https://codenuts.de/en/posts/hotkey/
As others mentioned already, use the keyboard shortcut from services. I also had to restart the computer to take into effect.
mac - "command + t" will open a new terminal window.
Try command + t.
It works for me.

Is there a keyboard shortcut (hotkey) to open Terminal in macOS?

One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window.
In Ubuntu, I was using (window+Alt+T) to open Terminal. But now I use a Macbook at my programming job.
Sometimes I use Spotlight to search "Terminal", and press Enter.
I'd like to know if I can assign a keyboard hotkey to do it.
I tested the following procedure under macOS Mojave 10.14.6 (18G3020).
Launch Automator. Create a document of type “Quick Action”:
(In older versions of macOS, use the “Service” template.)
In the new Automator document, add a “Run AppleScript” action. (You can type “run applescript” into the search field at the top of the action list to find it.) Here's the AppleScript to paste into the action:
on run {input, parameters}
tell application "Terminal"
if it is running then
do script ""
end if
activate
end tell
end run
Set the “Workflow receives” popup to “no input”. It should look like this overall:
Save the document with the name “New Terminal”. Then go to the Automator menu (or the app menu in any running application) and open the Services submenu. You should now see the “New Terminal” quick action:
If you click the “New Terminal” menu item, you'll get a dialog box:
Click OK to allow the action to run. You'll see this dialog once in each application that's frontmost when you use the action. In other words, the first time you use the action while Finder is frontmost, you'll see the dialog. And the first time you use the action while Safari is frontmost, you'll see the dialog. And so on.
After you click OK in the dialog, Terminal should open a new window.
To assign a keyboard shortcut to the quick action, choose the “Services Preferences…” item from the Services menu. (Or launch System Preferences, choose the Keyboard pane, then choose the Shortcuts tab, then choose Services from the left-hand list.) Scroll to the bottom of the right-hand list and find the New Terminal service. Click it and you should see an “Add Shortcut” button:
Click the button and press your preferred keyboard shortcut. Then, scratch your head, because (when I tried it) the Add Shortcut button reappears. But click the button again and you should see your shortcut:
Now you should be able to press your keyboard shortcut in most circumstances to get a new terminal window.
As programmers we want the quickest, most fool-proof way to get our tools in order so we can start hacking. Here are how I got it to work in MacOS 10.13.1 (High Sierra):
Option 1: Go to System Preferences | Keyboard | Shortcut | Services.
Under Files and Folders section, enable New Terminal at Folder
and/or New Terminal Tab at Folder and assign a shortcut key to it.
Option 2: If you want the shortcut key to work anywhere, create a new Service using Automator, then go to the Keyboard Shortcut to assign a shortcut key to it. Known limitation: not work from the desktop
Notes:
If the shortcut doesn't work, it might be in conflict with another
key binding (and the OS wouldn't warn you), try something else, e.g.
if ⇧⌥T doesn't work, try ⇧⌘T.
Don't spell-correct MacOS, that's not necessary.
iTerm2 - an alternative to Terminal - has an option to use configurable system-wide hotkey to show/hide (initially set to Alt+Space, disabled by default)
There is a third party app called hotkey app which can launch apps based on the configured shortcuts.
You can install it and setup required shortcut.
https://codenuts.de/en/posts/hotkey/
As others mentioned already, use the keyboard shortcut from services. I also had to restart the computer to take into effect.
mac - "command + t" will open a new terminal window.
Try command + t.
It works for me.

disable command-delete osx shortcut

I can't seem to find a way to disable command-delete shortcut in OSX.
This shortcut deletes files without warning also from save-as and load finder pages (e.g. when you save a page on disk from chrome, you can still accidentally remove a folder!)
Any suggestion is appreciated
alfonso
It is possible, although not recommended.
Go to System Preferences > Keyboard > Shortcuts > App Shortcuts. Then click the + button. Choose 'Finder' as your application, Menu title has to be exactly "Move to Trash" and enter a new shortcut. Click add, and you're all set.
If you have any more questions, please shoot :)
screenshot: http://i.imgur.com/VygU7Om.png

Launch default editor in Xcode

I've configured MacVim to be my default editor in Xcode. I can invoke it from Xcode by double clicking the file in the project view. Is there any keyboard shortcut I can configure or invoke to open the file being viewed in the Xcode editor in my default configured editor?
I am using Xcode 4.3. You can assign a shortcut to open the file in an external editor using the menu item File/Open with External Editor. To assign the shortcut you will need to go to System Preferences/Keyboard/Keyboard Shortcuts, choose Applications Shortcuts, click on the plus button, choose Xcode from the drop down menu, write 'Open with External Editor' in the Menu Title field and choose your shortcut.
Try Option-Command-O - if that doesn't work then you may need to go to Key Bindings in Preferences and set it up (I use the BBEdit Compatible key bindings which include this shortcut as standard).
I made a little write up here fwiw:
https://tmsh.github.io/visual-guide-opening-files-externally-xcode/

Resources