-
Notifications
You must be signed in to change notification settings - Fork 112
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
Permit keymap conditions to test against wm_name #129
base: master
Are you sure you want to change the base?
Conversation
This allows bindings such as: define_keymap(lambda wm_class, device_name, wm_name: "Google Docs" in wm_name, { # Google Docs uses M-slash as an execute-extended-command binding, let's make it more emacsish K("M-x"): K("M-slash") }) Notes: * Xlib built-in get_wm_name function doesn't support UTF-8 window names, so we use a custom function. * Keymap condition testing still looks at the number of args expected, and additionally passes wm_name if the number of args is 3 respectively. It's a bit ugly, but backward compatible for anyone already using the two argument version. * device name seems only passed for various conditional modmap conditions, not global transform condition testing. Add example to config
BTW, I haven't tried using global keymap conditions that use device name - it seems to me that some calls to |
I've been using this feature for months. Really useful for me. |
Going to see about merging this into my dev branch on my fork. I have completely forgotten about this PR. Thanks @Lenbok! |
Just to note I had issues when merging this into my fork, the merge appeared to go ok though. Perhaps it was just my specific config file was too complicated in general or it is not as backwards compatible as it might seem. I am not sure. I will have to explore this more. One thing that I think would be better though would be to nest it.. so instead of
You'd write it like
At least this was the use case I had mind - and maybe I can write it that way already lol. I have not tried to do so. |
I couldn't get the branch to work for me, running from subprocess import run
(...)
wmname = run("xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_NAME",
capture_output=True, shell=True).stdout |
This allows bindings such as:
Notes:
Xlib built-in get_wm_name function doesn't support UTF-8 window names, so we use a custom function. Thanks to yoshinari-nomura@2a74e00
Keymap condition testing still looks at the number of args expected, and additionally passes
wm_name
if the number of args is 3 respectively. It's a bit ugly, but maintains backward compatibility for anyone already using the two argument version. This signature based condition testing was previously only used in the conditional modmap testing, now it is in global keymap testing intransform
, so conditions using device and window name should also work there.Fixes #122