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 |
22
README.md
22
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
|
_Termux_ sends SIGINT on `Ctrl`+`c` instead, and _K-9 Mail_ composes a new
|
||||||
message.
|
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`+`c` injects `COPY`
|
||||||
- `MOD`+`x` injects `CUT`
|
- `MOD`+`x` injects `CUT`
|
||||||
- `MOD`+`v` injects `PASTE` (after computer-to-device clipboard
|
- `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
|
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.
|
pasting (for example in _Termux_), but it can break non-ASCII content.
|
||||||
|
|
||||||
*WARNING:* Pasting the computer clipboard to the device (either via `Ctrl`+`v`
|
**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
|
or `MOD`+`v`) copies the content into the device clipboard. As a consequence,
|
||||||
Android application could read its content. You should avoid to paste sensitive
|
any Android application could read its content. You should avoid to paste
|
||||||
content (like passwords) that way.
|
sensitive content (like passwords) that way.
|
||||||
|
|
||||||
#### Text injection preference
|
#### Text injection preference
|
||||||
|
|
||||||
@@ -590,19 +590,23 @@ Also see [issue #14].
|
|||||||
## Shortcuts
|
## Shortcuts
|
||||||
|
|
||||||
In the following list, `MOD` is the shortcut modifier. By default, it's (left)
|
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`,
|
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
|
```bash
|
||||||
# use RCtrl for shortcuts
|
# use RCtrl for shortcuts
|
||||||
scrcpy --shortcut-mod=rctrl
|
scrcpy --shortcut-mod=rctrl
|
||||||
|
|
||||||
# use either LCtrl+LAlt or LCmd for shortcuts
|
# use either LCtrl+LAlt or LSuper for shortcuts
|
||||||
scrcpy --shortcut-mod=lctrl+lalt,lcmd
|
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
|
| Action | Shortcut
|
||||||
| ------------------------------------------- |:-----------------------------
|
| ------------------------------------------- |:-----------------------------
|
||||||
| Switch fullscreen mode | `MOD`+`f`
|
| Switch fullscreen mode | `MOD`+`f`
|
||||||
|
|||||||
@@ -151,13 +151,13 @@ The device serial number. Mandatory only if several devices are connected to adb
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-shortcut\-mod " key[+...]][,...]
|
.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 ','.
|
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
|
.TP
|
||||||
.B \-S, \-\-turn\-screen\-off
|
.B \-S, \-\-turn\-screen\-off
|
||||||
@@ -218,7 +218,7 @@ Default is 0 (automatic).\n
|
|||||||
.SH SHORTCUTS
|
.SH SHORTCUTS
|
||||||
|
|
||||||
In the following list, MOD is the shortcut modifier. By default, it's (left)
|
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
|
.TP
|
||||||
.B MOD+f
|
.B MOD+f
|
||||||
|
|||||||
@@ -139,17 +139,17 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
" are connected to adb.\n"
|
" are connected to adb.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" --shortcut-mod key[+...]][,...]\n"
|
" --shortcut-mod key[+...]][,...]\n"
|
||||||
" Specify the modifiers to use for scrcpy shortcuts. Possible\n"
|
" Specify the modifiers to use for scrcpy shortcuts.\n"
|
||||||
" keys are \"lctrl\", \"rctrl\", \"lalt\", \"ralt\", \"lcmd\"\n"
|
" Possible keys are \"lctrl\", \"rctrl\", \"lalt\", \"ralt\",\n"
|
||||||
" and \"rcmd\".\n"
|
" \"lsuper\" and \"rsuper\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
" A shortcut can consist in several keys, separated by '+'.\n"
|
" A shortcut can consist in several keys, separated by '+'.\n"
|
||||||
" Several shortcuts can be specified, separated by ','.\n"
|
" Several shortcuts can be specified, separated by ','.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" For example, to use either LCtrl+LAlt or LCmd for scrcpy\n"
|
" For example, to use either LCtrl+LAlt or LSuper for scrcpy\n"
|
||||||
" shortcuts, pass \"lctrl+lalt,lcmd\".\n"
|
" shortcuts, pass \"lctrl+lalt,lsuper\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Default is \"lalt,lcmd\" (left-Alt or left-Cmd).\n"
|
" Default is \"lalt,lsuper\" (left-Alt or left-Super).\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -S, --turn-screen-off\n"
|
" -S, --turn-screen-off\n"
|
||||||
" Turn the device screen off immediately.\n"
|
" Turn the device screen off immediately.\n"
|
||||||
@@ -199,7 +199,7 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
"Shortcuts:\n"
|
"Shortcuts:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" In the following list, MOD is the shortcut modifier. By default,\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"
|
" --shortcut-mod.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" MOD+f\n"
|
" MOD+f\n"
|
||||||
@@ -521,10 +521,10 @@ parse_shortcut_mods_item(const char *item, size_t len) {
|
|||||||
mod |= SC_MOD_LALT;
|
mod |= SC_MOD_LALT;
|
||||||
} else if (STREQ("ralt", item, key_len)) {
|
} else if (STREQ("ralt", item, key_len)) {
|
||||||
mod |= SC_MOD_RALT;
|
mod |= SC_MOD_RALT;
|
||||||
} else if (STREQ("lcmd", item, key_len)) {
|
} else if (STREQ("lsuper", item, key_len)) {
|
||||||
mod |= SC_MOD_LCMD;
|
mod |= SC_MOD_LSUPER;
|
||||||
} else if (STREQ("rcmd", item, key_len)) {
|
} else if (STREQ("rsuper", item, key_len)) {
|
||||||
mod |= SC_MOD_RCMD;
|
mod |= SC_MOD_RSUPER;
|
||||||
} else {
|
} else {
|
||||||
LOGW("Unknown modifier key: %.*s", (int) key_len, item);
|
LOGW("Unknown modifier key: %.*s", (int) key_len, item);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -548,7 +548,7 @@ parse_shortcut_mods(const char *s, struct sc_shortcut_mods *mods) {
|
|||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
unsigned current = 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 (;;) {
|
for (;;) {
|
||||||
char *comma = strchr(s, ',');
|
char *comma = strchr(s, ',');
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ to_sdl_mod(unsigned mod) {
|
|||||||
if (mod & SC_MOD_RALT) {
|
if (mod & SC_MOD_RALT) {
|
||||||
sdl_mod |= KMOD_RALT;
|
sdl_mod |= KMOD_RALT;
|
||||||
}
|
}
|
||||||
if (mod & SC_MOD_LCMD) {
|
if (mod & SC_MOD_LSUPER) {
|
||||||
sdl_mod |= KMOD_LGUI;
|
sdl_mod |= KMOD_LGUI;
|
||||||
}
|
}
|
||||||
if (mod & SC_MOD_RCMD) {
|
if (mod & SC_MOD_RSUPER) {
|
||||||
sdl_mod |= KMOD_RGUI;
|
sdl_mod |= KMOD_RGUI;
|
||||||
}
|
}
|
||||||
return sdl_mod;
|
return sdl_mod;
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ enum sc_shortcut_mod {
|
|||||||
SC_MOD_RCTRL = 1 << 1,
|
SC_MOD_RCTRL = 1 << 1,
|
||||||
SC_MOD_LALT = 1 << 2,
|
SC_MOD_LALT = 1 << 2,
|
||||||
SC_MOD_RALT = 1 << 3,
|
SC_MOD_RALT = 1 << 3,
|
||||||
SC_MOD_LCMD = 1 << 4,
|
SC_MOD_LSUPER = 1 << 4,
|
||||||
SC_MOD_RCMD = 1 << 5,
|
SC_MOD_RSUPER = 1 << 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_shortcut_mods {
|
struct sc_shortcut_mods {
|
||||||
@@ -95,7 +95,7 @@ struct scrcpy_options {
|
|||||||
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
||||||
}, \
|
}, \
|
||||||
.shortcut_mods = { \
|
.shortcut_mods = { \
|
||||||
.data = {SC_MOD_LALT, SC_MOD_LCMD}, \
|
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
|
||||||
.count = 2, \
|
.count = 2, \
|
||||||
}, \
|
}, \
|
||||||
.max_size = DEFAULT_MAX_SIZE, \
|
.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[0] == SC_MOD_RCTRL);
|
||||||
assert(mods.data[1] == SC_MOD_LALT);
|
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(ok);
|
||||||
assert(mods.count == 3);
|
assert(mods.count == 3);
|
||||||
assert(mods.data[0] == SC_MOD_LCMD);
|
assert(mods.data[0] == SC_MOD_LSUPER);
|
||||||
assert(mods.data[1] == (SC_MOD_RCMD | SC_MOD_LALT));
|
assert(mods.data[1] == (SC_MOD_RSUPER | SC_MOD_LALT));
|
||||||
assert(mods.data[2] == (SC_MOD_LCTRL | SC_MOD_RCTRL | SC_MOD_RALT));
|
assert(mods.data[2] == (SC_MOD_LCTRL | SC_MOD_RCTRL | SC_MOD_RALT));
|
||||||
|
|
||||||
ok = sc_parse_shortcut_mods("", &mods);
|
ok = sc_parse_shortcut_mods("", &mods);
|
||||||
|
|||||||
Reference in New Issue
Block a user