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

Add a command to translate keysyms to keycodes universally #5409

Closed
Architector4 opened this issue Jun 2, 2020 · 3 comments
Closed

Add a command to translate keysyms to keycodes universally #5409

Architector4 opened this issue Jun 2, 2020 · 3 comments

Comments

@Architector4
Copy link

Architector4 commented Jun 2, 2020

The problem

I use multiple keyboard layouts, and a binding like bindsym $mod+w thing works only on the Latin layout, so pressing $mod+ц - same 2 keys but on another layout - doesn't trigger the binding.

As a result, in contrast to i3, to be able to reasonably use Sway, I have to append --to-code to every single instance of bindsym. This becomes annoying quickly, and makes it hard to make my i3 and Sway configs matching, because tools like diff and vimdiff highlight all bindings as different.

I did read the part of wiki that mentioned it - it doesn't seem to suggest any other way.

bindcode also exists, but, as bindsym --to-code, it is still a different command to i3's bindsym. I am looking for a way to use identical binding lines across both configs, which neither solutions seem to provide.


Proposed solution/enhancement

I think it would be reasonable to add a command like keysyms_to_codes 1 to be able to switch the behavior to the one seen in i3 without having to modify every single binding.

When such a command is used, --to-code would be ignored, and --to-sym (or something) would allow using the original untranslated behavior for specific bindings.

@Architector4
Copy link
Author

The issue of my specific use case is solved by mapping a variable via set $mybind bindsym --to-code (or just bindsym in i3 config), and then doing $mybind $mod+w thing for all bindings in the two configs with no differences.

I suppose that lack of such a command proposed in this post is not actually an issue as I don't think there are any other use cases for it, so I guess I should close the issue.

@emersion
Copy link
Member

emersion commented Jun 2, 2020

You can also use blocks like so:

bindsym --to-code {
    $mod+w thing
    $mod+h stuff
    …
}

@Architector4
Copy link
Author

You can also use blocks like so:

bindsym --to-code {
    $mod+w thing
    $mod+h stuff
    …
}

True, but one can't put a mode thing {...} block inside of a bindsym block (at least in i3), and as a result I'd still have to use bindsym --to-code multiple times, not really solving the initial issue.

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

No branches or pull requests

2 participants