aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.c13
-rw-r--r--tools/gsr-ui-cli/main.c24
2 files changed, 27 insertions, 10 deletions
diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c
index f3fba62..c2bd75a 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.c
+++ b/tools/gsr-global-hotkeys/keyboard_event.c
@@ -575,6 +575,13 @@ static int parse_u8(const char *str, int size) {
return result;
}
+static bool is_key_alpha_numerical(uint8_t key) {
+ return (key >= KEY_1 && key <= KEY_0)
+ || (key >= KEY_Q && key <= KEY_P)
+ || (key >= KEY_A && key <= KEY_L)
+ || (key >= KEY_Z && key <= KEY_M);
+}
+
static bool keyboard_event_parse_bind_keys(const char *str, int size, uint8_t *key, uint32_t *modifiers) {
*key = 0;
*modifiers = 0;
@@ -609,13 +616,13 @@ static bool keyboard_event_parse_bind_keys(const char *str, int size, uint8_t *k
break;
}
- if(key == 0) {
+ if(*key == 0) {
fprintf(stderr, "Error: can't bind hotkey without a non-modifier key\n");
return false;
}
- if(modifiers == 0) {
- fprintf(stderr, "Error: can't bind hotkey without a modifier\n");
+ if(*modifiers == 0 && is_key_alpha_numerical(*key)) {
+ fprintf(stderr, "Error: can't bind hotkey without a modifier unless the key is a non alpha-numerical key\n");
return false;
}
diff --git a/tools/gsr-ui-cli/main.c b/tools/gsr-ui-cli/main.c
index 9f1eb03..c34888c 100644
--- a/tools/gsr-ui-cli/main.c
+++ b/tools/gsr-ui-cli/main.c
@@ -44,13 +44,22 @@ static void usage(void) {
printf("Run commands on the running gsr-ui instance.\n");
printf("\n");
printf("COMMANDS:\n");
- printf(" toggle-show Show/hide the UI.\n");
- printf(" toggle-record Start/stop recording.\n");
- printf(" toggle-pause Pause/unpause recording. Only applies to regular recording.\n");
- printf(" toggle-stream Start/stop streaming.\n");
- printf(" toggle-replay Start/stop replay.\n");
- printf(" replay-save Save replay.\n");
- printf(" take-screenshot Take a screenshot.\n");
+ printf(" toggle-show\n");
+ printf(" Show/hide the UI.\n");
+ printf(" toggle-record\n");
+ printf(" Start/stop recording.\n");
+ printf(" toggle-pause\n");
+ printf(" Pause/unpause recording. Only applies to regular recording.\n");
+ printf(" toggle-stream\n");
+ printf(" Start/stop streaming.\n");
+ printf(" toggle-replay\n");
+ printf(" Start/stop replay.\n");
+ printf(" replay-save\n");
+ printf(" Save replay.\n");
+ printf(" take-screenshot\n");
+ printf(" Take a screenshot.\n");
+ printf(" take-screenshot-region\n");
+ printf(" Take a screenshot of a region.\n");
printf("\n");
printf("EXAMPLES:\n");
printf(" gsr-ui-cli toggle-show\n");
@@ -67,6 +76,7 @@ static bool is_valid_command(const char *command) {
"toggle-replay",
"replay-save",
"take-screenshot",
+ "take-screenshot-region",
NULL
};