-
Notifications
You must be signed in to change notification settings - Fork 66
feat: allow to specify master keyboard #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,8 @@ static unsigned char ignored; | |
| static XSyncCounter idler_counter = 0; | ||
| static XSyncAlarm idle_alarm = None; | ||
|
|
||
| static char *master_keyboard_device; | ||
|
|
||
| static int debug = 0; | ||
| #define DPRINTF(x) { if (debug) { printf x; } }; | ||
|
|
||
|
|
@@ -94,7 +96,7 @@ main(int argc, char *argv[]) | |
| {"all", -1}, | ||
| }; | ||
|
|
||
| while ((ch = getopt(argc, argv, "adi:m:t:s")) != -1) | ||
| while ((ch = getopt(argc, argv, "adi:k:m:t:s")) != -1) | ||
| switch (ch) { | ||
| case 'a': | ||
| always_hide = 1; | ||
|
|
@@ -109,6 +111,10 @@ main(int argc, char *argv[]) | |
| ignored |= mods[i].mask; | ||
|
|
||
| break; | ||
| case 'k': | ||
| // choose which keyboard device to listen only (in case of xremap or Kmonad being used) | ||
| master_keyboard_device = strdup(optarg); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But in this case, there should be zero reason to duplicate the string to begin with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx, should be fixed |
||
| break; | ||
| case 'm': | ||
| if (strcmp(optarg, "nw") == 0) | ||
| move = MOVE_NW; | ||
|
|
@@ -463,6 +469,10 @@ snoop_xinput(Window win) | |
| ici++, j++) { | ||
| switch (ici->input_class) { | ||
| case KeyClass: | ||
| if (master_keyboard_device && | ||
| strncmp(master_keyboard_device, devinfo[i].name, strlen(master_keyboard_device)) != 0) | ||
| continue; | ||
|
|
||
| DPRINTF(("attaching to keyboard device %s " | ||
| "(use %d)\n", devinfo[i].name, | ||
| devinfo[i].use)); | ||
|
|
@@ -587,7 +597,7 @@ set_alarm(XSyncAlarm *alarm, XSyncTestType test) | |
| void | ||
| usage(char *progname) | ||
| { | ||
| fprintf(stderr, "usage: %s [-a] [-d] [-i mod] [-m [w]nw|ne|sw|se|+/-xy] " | ||
| fprintf(stderr, "usage: %s [-a] [-d] [-i mod] [-k master_keyboard] [-m [w]nw|ne|sw|se|+/-xy] " | ||
| "[-t seconds] [-s]\n", progname); | ||
| exit(1); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation seems messed up, ensure you're using TABs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fixed. I forgot to change my editor config. I added an .editorconfig file just for me 😄