diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-17 11:28:44 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-17 11:28:44 +0530 |
| commit | 0c9d36aa5bb64029c254a6fcd645b892b37d5661 (patch) | |
| tree | d8cd3af6bfd8aeceaec921e491e6dc75e626561b /daemonic.c | |
| parent | 4b5384bcb6dd36d51aacc1e40ed8b020444f9882 (diff) | |
| download | shotkey-0c9d36aa5bb64029c254a6fcd645b892b37d5661.tar.gz shotkey-0c9d36aa5bb64029c254a6fcd645b892b37d5661.zip | |
Adds cli arguments
Diffstat (limited to '')
| -rw-r--r-- | daemonic.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -4,6 +4,8 @@ #include <X11/Xutil.h> #include <unistd.h> +#define VERSION "0.0.1" + typedef struct Command { char* command; unsigned int mode; @@ -16,6 +18,10 @@ typedef struct Key { Command command; } Key; +typedef struct ModeProperties { + char* label; +} ModeProperties; + #define cmd(c) (Command) { c, -1, False } #define mode(m, p) (Command) { NULL, m, p } @@ -124,7 +130,29 @@ void keypress(Display *dpy, Window win, XKeyEvent *ev) { } } -int main() { +char* get_mode_label() { + if (current_mode == -1) return ""; + ModeProperties props = mode_properties[current_mode]; + return props.label; +} + +void help_menu(char* x) { + printf("Usage: %s [-vh]\n", x); +} + +int main(int argc, char *argv[]) { + int opt; + while ((opt = getopt(argc, argv, "vh")) != -1) { + switch (opt) { + case 'v': printf("%s\n", VERSION); return 0; + /*case 'm': printf("%s\n", get_mode_label()); return 0;*/ + case 'h': + default: + help_menu(argv[0]); + return opt != 'h'; + } + } + XSetErrorHandler(error_handler); int running = 1, i = 0; |
