Skip to content
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

Use special keys? For example <Tab> #3

Closed
ghost opened this issue Mar 9, 2021 · 8 comments · Fixed by #4
Closed

Use special keys? For example <Tab> #3

ghost opened this issue Mar 9, 2021 · 8 comments · Fixed by #4

Comments

@ghost
Copy link

ghost commented Mar 9, 2021

How can I use special keys like <Tab> in the patterns?
Also, will chords work?

@potamides
Copy link
Owner

potamides commented Mar 9, 2021

Hi,
for special keys you have to find out which string the callback function gets for a key. For <Tab> this is is 'Tab', so if you want to use <Tab> for a command your pattern should look like {'Tab'}. On a side note, you could also use {'T', 'a', 'b'}, but then you could also press <Shift>t, then a and then b for a match.

What do you mean with chords?

@ghost
Copy link
Author

ghost commented Mar 9, 2021

Hi,
for special keys you have to find out which string the callback function gets for a key. For <Tab> this is is 'Tab', so if you want to use <Tab> for a command your pattern should look like {'Tab'}. On a side note, you could also use {'T', 'a', 'b'}, but then you could also press <Shift>t, then a and then b for a match.

Hi, thanks for replying quickly. This works.

What do you mean with chords?

Keys combinations like <C-a> and <Shift-Tab>.

@potamides
Copy link
Owner

Keys combinations like <C-a> and <Shift-Tab>.

Ah I see. Support for this is limited. You can map <Shift> in combinations with letters, e.g. <S-a>, because then the callback function is called with the uppercase letter 'A', so a pattern like {'A'} works, but that's it.
It would be possible however to support other modifiers, since the callback is also called with a table of pressed modifiers, which is currently ignored.

@ghost
Copy link
Author

ghost commented Mar 9, 2021

It would be possible however to support other modifiers, since the callback is also called with a table of pressed modifiers, which is currently ignored.

And how can I do it?

@potamides
Copy link
Owner

Since as of now this functionality does not exist in modalawesome, you'd have to implement it first. I'd do it like this:

  1. add optional modifiers table to commands, which should contain required modifiers
  2. in keygrabber callback pass the modifiers table to parser function
  3. in parser function compare the modifier table of command with the one from the callback
  4. if there's a match execute corresponding handler

I have some time at the end of the month were I can take a look at this. Until then, pull requests are welcome :)

@ghost
Copy link
Author

ghost commented Mar 9, 2021

Okay,
I am new to lua and awesomewm. I will give it a shot and let you know.

@potamides
Copy link
Owner

So I finally had some time to take a look at this. The feature is now functional, but I still want to think about it a little bit more, before I merge this. Feel free to check out the pull request in the mean time and tell me if it suits your needs :)

@ghost
Copy link
Author

ghost commented Apr 4, 2021

Thanks a lot. I have been busy, I will check out the PR and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant