# Use the keyboard and shortcuts

Click in a machine's window and the guest gets every key, until Control-Option gives the keyboard back.

## Give the keyboard to the guest

1. Click inside the machine's display. The guest gets every key, Command-Q and Command-W included.
2. Press Control-Option to give the keyboard back to your Mac.

Until you click, the window's subtitle says Click to type. A window that Terminal or an agent opened takes two clicks: one brings it forward, the next captures keys.

With VoiceOver on, Control-Option stays with VoiceOver. Choose **I/O > Release Keyboard** instead.

## Choose what Command does in the guest

In a Windows or Linux machine, choose **I/O > Keyboard Shortcuts**, then **Mac Style** or **PC Style**. With Mac Style, the default, Command works as on your Mac:

| You press | The guest gets |
|---|---|
| Command-C | Ctrl+C |
| Command-Tab | Alt+Tab |
| Command-Space | The Windows or Super key |
| Command-Q in Windows | Alt+F4 |

With PC Style, Command is the Windows or Super key. A macOS guest always gets keys unchanged. To switch from Terminal:

```sh
osmates vm set win --shortcuts pc
```

## Send keys your Mac keeps

Your Mac keeps Command-Space, Mission Control, and Command-Tab in a window. To send them to the guest:

1. Choose **I/O > Keyboard Shortcuts > Allow System Shortcuts**, then click **Continue**.
2. Choose **Apple menu > System Settings**, then click **Privacy & Security** in the sidebar.
3. Click **Device Control and Data Access**, turn on **OSMates**, then click the machine's window.

Like any app allowed there, OSMates can then press buttons and type in other apps.

For a key your keyboard lacks, such as Print Screen, choose it from **I/O > Send Keys** or the toolbar's **Keys**. ISO keys match their printed positions. JIS keys work in Windows and macOS machines.

## Type with another keyboard layout

`osmates vm type`, agents, and sign-in type on the guest's layout, dead keys and AltGr included.

| Guest | Types on | Typing is refused |
|---|---|---|
| Windows | The layout the guest agent reports, so Ctrl+A selects all on a French keyboard | When the guest agent can't tell, and setup used a layout other than US |
| macOS | Your Mac's copy of the guest's layout, so Dvorak and French work | Under an input method, or at the login window after setup with another layout |
| Linux | The US layout only | With any other layout |

Text that can't be typed is pasted through the guest's clipboard. `--method keys` only types, and `--method paste` only pastes.

If the Windows sign-in keyboard can't type your password, change the keyboard in Windows, then save the password again:

```sh
osmates vm password win
```

At a macOS login window that refuses typed text, sign in by typing in the machine's window yourself.

A Linux server console has no clipboard tools, so it takes no text until its layout is US:

```sh
localectl set-x11-keymap us
```

On macOS, `vm key` sends Command or Control with a letter to the matching key on the guest's layout.

## Keyboard shortcuts

In this table, ⌘ is Command, ⌥ is Option, ⌃ is Control, ⇧ is Shift, and ⌫ is Delete.

| Shortcut | Where | What it does |
|---|---|---|
| ⌘N | Library | New Machine |
| ⌘O | Library | Open an ISO, IPSW, disk image, or another app's machine |
| ⌘F | Library | Search Machines |
| ⌘1 | Library | Overview |
| ⌘2 | Library | Snapshots |
| ⌃⌘I | Library | Show or hide the inspector |
| ⌘0 | Library | Show the library window |
| ⌘, | Library | OSMates Settings |
| ⌥⌘, | Library and machine window | Machine Settings |
| ⌘R | Library and machine window | Start or Resume |
| ⌥⌘R | Library and machine window | Start with Basic Display |
| ⇧⌘R | Library and machine window | Shut Down |
| ⌘⌫ | Library | Delete Machine |
| ⌃⌥ | Machine window | Release the keyboard and the pointer |
| ⌃⌘P | Machine window | Capture or release the pointer |
| ⌃⌘F | Machine window | Enter or exit full screen |
| ⌥⌘T | Machine window | Show or hide the toolbar |
| ⌘Q | Machine window, keyboard released | Suspend or shut down the machine, after asking |
