aboutsummaryrefslogtreecommitdiff
path: root/src/skhd.c
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2018-07-20 19:26:15 +0200
committerkoekeishiya <aasvi93@hotmail.com>2018-07-20 19:26:15 +0200
commit0b03bdb56667fc3efcbf2624145409436cac9b78 (patch)
treebb5da0de9f7e18d7bcffda48f39acafd4c7a8df6 /src/skhd.c
parentbee00428694c093baa805858e093815bd59ff112 (diff)
downloadskhd-0b03bdb56667fc3efcbf2624145409436cac9b78.tar.gz
skhd-0b03bdb56667fc3efcbf2624145409436cac9b78.zip
#44 synthesize keypress; skhd -k "alt - h"
Diffstat (limited to 'src/skhd.c')
-rw-r--r--src/skhd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/skhd.c b/src/skhd.c
index 4d1ce63..972d75e 100644
--- a/src/skhd.c
+++ b/src/skhd.c
@@ -17,6 +17,7 @@
#include "tokenize.h"
#include "parse.h"
#include "hotkey.h"
+#include "synthesize.h"
#include "hotload.c"
#include "event_tap.c"
@@ -24,6 +25,7 @@
#include "tokenize.c"
#include "parse.c"
#include "hotkey.c"
+#include "synthesize.c"
#define internal static
extern bool CGSIsSecureEventInputSet();
@@ -123,10 +125,12 @@ internal bool
parse_arguments(int argc, char **argv)
{
int option;
- const char *short_option = "vc:";
+ const char *short_option = "vc:k:t:";
struct option long_option[] = {
{ "version", no_argument, NULL, 'v' },
{ "config", required_argument, NULL, 'c' },
+ { "key", required_argument, NULL, 'k' },
+ { "text", required_argument, NULL, 't' },
{ NULL, 0, NULL, 0 }
};
@@ -137,7 +141,15 @@ parse_arguments(int argc, char **argv)
return true;
} break;
case 'c': {
- config_file = strdup(optarg);
+ config_file = copy_string(optarg);
+ } break;
+ case 'k': {
+ synthesize_key(optarg);
+ return true;
+ } break;
+ case 't': {
+ synthesize_text(optarg);
+ return true;
} break;
}
}