Compare commits
15 Commits
shortcut.1
...
shortcutmo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfb7324d7b | ||
|
|
d8b3ba170c | ||
|
|
7ad47dfaab | ||
|
|
56a115b5c5 | ||
|
|
8f64a5984b | ||
|
|
bccd12bf5c | ||
|
|
20d3925099 | ||
|
|
1223a72eb8 | ||
|
|
7683be8159 | ||
|
|
d4ca85d6a8 | ||
|
|
e6e528f228 | ||
|
|
a5f8b577c5 | ||
|
|
e4bb7c1d1f | ||
|
|
1b76d9fd78 | ||
|
|
63cb93d7d7 |
24
README.md
24
README.md
@@ -516,7 +516,7 @@ The actual behavior depends on the active application though. For example,
|
||||
_Termux_ sends SIGINT on `Ctrl`+`c` instead, and _K-9 Mail_ composes a new
|
||||
message.
|
||||
|
||||
To copy, cut and paste in all cases (but only supported on Android >= 7):
|
||||
To copy, cut and paste in such cases (but only supported on Android >= 7):
|
||||
- `MOD`+`c` injects `COPY`
|
||||
- `MOD`+`x` injects `CUT`
|
||||
- `MOD`+`v` injects `PASTE` (after computer-to-device clipboard
|
||||
@@ -526,10 +526,10 @@ In addition, `MOD`+`Shift`+`v` allows to inject the computer clipboard text as a
|
||||
sequence of key events. This is useful when the component does not accept text
|
||||
pasting (for example in _Termux_), but it can break non-ASCII content.
|
||||
|
||||
*WARNING:* Pasting the computer clipboard to the device (either via `Ctrl`+`v`
|
||||
or `MOD`+`v`) copies the content in the device clipboard. As a consequence, any
|
||||
Android application could read its content. You should avoid to paste sensitive
|
||||
content (like passwords) that way.
|
||||
**WARNING:** Pasting the computer clipboard to the device (either via `Ctrl`+`v`
|
||||
or `MOD`+`v`) copies the content into the device clipboard. As a consequence,
|
||||
any Android application could read its content. You should avoid to paste
|
||||
sensitive content (like passwords) that way.
|
||||
|
||||
#### Text injection preference
|
||||
|
||||
@@ -590,19 +590,23 @@ Also see [issue #14].
|
||||
## Shortcuts
|
||||
|
||||
In the following list, `MOD` is the shortcut modifier. By default, it's (left)
|
||||
`Alt` or (left) `Cmd`.
|
||||
`Alt` or (left) `Super`.
|
||||
|
||||
It can be changed using `--shortcut-mod`. Possible keys are `lctrl`, `rctrl`,
|
||||
`lalt`, `ralt`, `lcmd` and `rcmd`. For example:
|
||||
`lalt`, `ralt`, `lsuper` and `rsuper`. For example:
|
||||
|
||||
```bash
|
||||
# use RCtrl for shortcuts
|
||||
scrcpy --shortcut-mod=rctrl
|
||||
|
||||
# use either LCtrl+LAlt or LCmd for shortcuts
|
||||
scrcpy --shortcut-mod=lctrl+lalt,lcmd
|
||||
# use either LCtrl+LAlt or LSuper for shortcuts
|
||||
scrcpy --shortcut-mod=lctrl+lalt,lsuper
|
||||
```
|
||||
|
||||
_[Super] is typically the "Windows" or "Cmd" key._
|
||||
|
||||
[Super]: https://en.wikipedia.org/wiki/Super_key_(keyboard_button)
|
||||
|
||||
| Action | Shortcut
|
||||
| ------------------------------------------- |:-----------------------------
|
||||
| Switch fullscreen mode | `MOD`+`f`
|
||||
@@ -630,7 +634,7 @@ scrcpy --shortcut-mod=lctrl+lalt,lcmd
|
||||
| Enable/disable FPS counter (on stdout) | `MOD`+`i`
|
||||
|
||||
_¹Double-click on black borders to remove them._
|
||||
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
||||
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
||||
_³Only on Android >= 7._
|
||||
|
||||
All `Ctrl`+_key_ shortcuts are forwarded to the device, so they are handled by
|
||||
|
||||
@@ -151,13 +151,13 @@ The device serial number. Mandatory only if several devices are connected to adb
|
||||
|
||||
.TP
|
||||
.BI "\-\-shortcut\-mod " key[+...]][,...]
|
||||
Specify the modifiers to use for scrcpy shortcuts. Possible keys are "lctrl", "rctrl", "lalt", "ralt", "lcmd" and "rcmd".
|
||||
Specify the modifiers to use for scrcpy shortcuts. Possible keys are "lctrl", "rctrl", "lalt", "ralt", "lsuper" and "rsuper".
|
||||
|
||||
A shortcut can consist in several keys, separated by '+'. Several shortcuts can be specified, separated by ','.
|
||||
|
||||
For example, to use either LCtrl+LAlt or LCmd for scrcpy shortcuts, pass "lctrl+lalt,lcmd".
|
||||
For example, to use either LCtrl+LAlt or LSuper for scrcpy shortcuts, pass "lctrl+lalt,lsuper".
|
||||
|
||||
Default is "lalt,lcmd" (left-Alt or left-Cmd).
|
||||
Default is "lalt,lsuper" (left-Alt or left-Super).
|
||||
|
||||
.TP
|
||||
.B \-S, \-\-turn\-screen\-off
|
||||
@@ -218,7 +218,7 @@ Default is 0 (automatic).\n
|
||||
.SH SHORTCUTS
|
||||
|
||||
In the following list, MOD is the shortcut modifier. By default, it's (left)
|
||||
Alt or (left) Cmd, but it can be configured by \-\-shortcut-mod.
|
||||
Alt or (left) Super, but it can be configured by \-\-shortcut-mod.
|
||||
|
||||
.TP
|
||||
.B MOD+f
|
||||
|
||||
@@ -139,17 +139,17 @@ scrcpy_print_usage(const char *arg0) {
|
||||
" are connected to adb.\n"
|
||||
"\n"
|
||||
" --shortcut-mod key[+...]][,...]\n"
|
||||
" Specify the modifiers to use for scrcpy shortcuts. Possible\n"
|
||||
" keys are \"lctrl\", \"rctrl\", \"lalt\", \"ralt\", \"lcmd\"\n"
|
||||
" and \"rcmd\".\n"
|
||||
" Specify the modifiers to use for scrcpy shortcuts.\n"
|
||||
" Possible keys are \"lctrl\", \"rctrl\", \"lalt\", \"ralt\",\n"
|
||||
" \"lsuper\" and \"rsuper\".\n"
|
||||
"\n"
|
||||
" A shortcut can consist in several keys, separated by '+'.\n"
|
||||
" Several shortcuts can be specified, separated by ','.\n"
|
||||
"\n"
|
||||
" For example, to use either LCtrl+LAlt or LCmd for scrcpy\n"
|
||||
" shortcuts, pass \"lctrl+lalt,lcmd\".\n"
|
||||
" For example, to use either LCtrl+LAlt or LSuper for scrcpy\n"
|
||||
" shortcuts, pass \"lctrl+lalt,lsuper\".\n"
|
||||
"\n"
|
||||
" Default is \"lalt,lcmd\" (left-Alt or left-Cmd).\n"
|
||||
" Default is \"lalt,lsuper\" (left-Alt or left-Super).\n"
|
||||
"\n"
|
||||
" -S, --turn-screen-off\n"
|
||||
" Turn the device screen off immediately.\n"
|
||||
@@ -199,7 +199,7 @@ scrcpy_print_usage(const char *arg0) {
|
||||
"Shortcuts:\n"
|
||||
"\n"
|
||||
" In the following list, MOD is the shortcut modifier. By default,\n"
|
||||
" it's (left) Alt or (left) Cmd, but it can be configured by\n"
|
||||
" it's (left) Alt or (left) Super, but it can be configured by\n"
|
||||
" --shortcut-mod.\n"
|
||||
"\n"
|
||||
" MOD+f\n"
|
||||
@@ -521,10 +521,10 @@ parse_shortcut_mods_item(const char *item, size_t len) {
|
||||
mod |= SC_MOD_LALT;
|
||||
} else if (STREQ("ralt", item, key_len)) {
|
||||
mod |= SC_MOD_RALT;
|
||||
} else if (STREQ("lcmd", item, key_len)) {
|
||||
mod |= SC_MOD_LCMD;
|
||||
} else if (STREQ("rcmd", item, key_len)) {
|
||||
mod |= SC_MOD_RCMD;
|
||||
} else if (STREQ("lsuper", item, key_len)) {
|
||||
mod |= SC_MOD_LSUPER;
|
||||
} else if (STREQ("rsuper", item, key_len)) {
|
||||
mod |= SC_MOD_RSUPER;
|
||||
} else {
|
||||
LOGW("Unknown modifier key: %.*s", (int) key_len, item);
|
||||
return 0;
|
||||
@@ -548,7 +548,7 @@ parse_shortcut_mods(const char *s, struct sc_shortcut_mods *mods) {
|
||||
unsigned count = 0;
|
||||
unsigned current = 0;
|
||||
|
||||
// LCtrl+LAlt or RCtrl or LCtrl+RCmd: "lctrl+lalt,rctrl,lctrl+rcmd"
|
||||
// LCtrl+LAlt or RCtrl or LCtrl+RSuper: "lctrl+lalt,rctrl,lctrl+rsuper"
|
||||
|
||||
for (;;) {
|
||||
char *comma = strchr(s, ',');
|
||||
|
||||
@@ -28,10 +28,10 @@ to_sdl_mod(unsigned mod) {
|
||||
if (mod & SC_MOD_RALT) {
|
||||
sdl_mod |= KMOD_RALT;
|
||||
}
|
||||
if (mod & SC_MOD_LCMD) {
|
||||
if (mod & SC_MOD_LSUPER) {
|
||||
sdl_mod |= KMOD_LGUI;
|
||||
}
|
||||
if (mod & SC_MOD_RCMD) {
|
||||
if (mod & SC_MOD_RSUPER) {
|
||||
sdl_mod |= KMOD_RGUI;
|
||||
}
|
||||
return sdl_mod;
|
||||
|
||||
@@ -27,8 +27,8 @@ enum sc_shortcut_mod {
|
||||
SC_MOD_RCTRL = 1 << 1,
|
||||
SC_MOD_LALT = 1 << 2,
|
||||
SC_MOD_RALT = 1 << 3,
|
||||
SC_MOD_LCMD = 1 << 4,
|
||||
SC_MOD_RCMD = 1 << 5,
|
||||
SC_MOD_LSUPER = 1 << 4,
|
||||
SC_MOD_RSUPER = 1 << 5,
|
||||
};
|
||||
|
||||
struct sc_shortcut_mods {
|
||||
@@ -95,7 +95,7 @@ struct scrcpy_options {
|
||||
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
||||
}, \
|
||||
.shortcut_mods = { \
|
||||
.data = {SC_MOD_LALT, SC_MOD_LCMD}, \
|
||||
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
|
||||
.count = 2, \
|
||||
}, \
|
||||
.max_size = DEFAULT_MAX_SIZE, \
|
||||
|
||||
@@ -143,11 +143,11 @@ static void test_parse_shortcut_mods(void) {
|
||||
assert(mods.data[0] == SC_MOD_RCTRL);
|
||||
assert(mods.data[1] == SC_MOD_LALT);
|
||||
|
||||
ok = sc_parse_shortcut_mods("lcmd,rcmd+lalt,lctrl+rctrl+ralt", &mods);
|
||||
ok = sc_parse_shortcut_mods("lsuper,rsuper+lalt,lctrl+rctrl+ralt", &mods);
|
||||
assert(ok);
|
||||
assert(mods.count == 3);
|
||||
assert(mods.data[0] == SC_MOD_LCMD);
|
||||
assert(mods.data[1] == (SC_MOD_RCMD | SC_MOD_LALT));
|
||||
assert(mods.data[0] == SC_MOD_LSUPER);
|
||||
assert(mods.data[1] == (SC_MOD_RSUPER | SC_MOD_LALT));
|
||||
assert(mods.data[2] == (SC_MOD_LCTRL | SC_MOD_RCTRL | SC_MOD_RALT));
|
||||
|
||||
ok = sc_parse_shortcut_mods("", &mods);
|
||||
|
||||
Reference in New Issue
Block a user