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

[Wayland] add ability to load xkb keymap files #4855

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elParaguayo
Copy link
Member

Draft for now. This is based on a request on Discord.

Would welcome @jwijenbergh thoughts on this.

I think we also need to update the keyboard layout widget for this.

@tych0
Copy link
Member

tych0 commented May 31, 2024

would it be useful to have xkb support in xcffib? based on one of the other PRs I looked at adding it recently and I don't think it would be super hard.

@elParaguayo
Copy link
Member Author

Yes, would make sense if it's easy to do.

@jwijenbergh
Copy link
Contributor

I haven't tested it yet but this looks fine to me, any keymap file I can test with?

Comment on lines 249 to 256
xkbf = Path(xkb_file).expanduser()
if xkbf.is_file():
xkbf_name = xkbf.as_posix()
else:
raise ConfigError(f"kb_file {xkb_file} is not found.")

with open(xkbf_name, "r") as f:
keymap = self.xkb_context.keymap_new_from_file(f)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to a function maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could use this in x11 then, yes, makes sense.

@elParaguayo
Copy link
Member Author

Slight change, keymap_new_from_file gave me a PermissionError but using keymap_new_from_buffer works fine.

I tested by dumping my keymap and then editing it to swap a couple of keys round. Loading the keymap gave the expected behaviour.

@tych0
Copy link
Member

tych0 commented Jun 1, 2024

Yes, would make sense if it's easy to do.

ok, I spent some time messing around with it today and couldn't get my haskell-fu right, but I'll work on it.

Copy link

This PR is stale because it has been open 90 days with no activity. Remove the status: stale label or comment, or this will be closed in 30 days.

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 this pull request may close these issues.

3 participants