-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: allow to specify master keyboard #79
base: master
Are you sure you want to change the base?
Conversation
Provide a new argument -k to specify which keyboard device name should the program attach to. Useful in case where you have xremap running.
xbanish.c
Outdated
@@ -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); |
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.
strdup
can fail since it allocates memory and so the return value needs to be checked.
But in this case, there should be zero reason to duplicate the string to begin with.
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.
thx, should be fixed
xbanish.c
Outdated
@@ -109,6 +111,10 @@ main(int argc, char *argv[]) | |||
ignored |= mods[i].mask; | |||
|
|||
break; | |||
case 'k': |
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 😄
The issue that I encountered was that after I setup xremap, the cursor was flickering like in #78 and so I looked into this and realized that in that case, xbanish should only attach and listen to the new virtual keyboard created by xremap.
So this patch implement a new argument
-k
to specify which keyboard device name should the program attach to.This implementation is basic and simple, I may forgot edge cases.