Giter Site home page Giter Site logo

Doesn't work with Wayland about xkb-switch HOT 10 OPEN

grwlf avatar grwlf commented on August 28, 2024 1
Doesn't work with Wayland

from xkb-switch.

Comments (10)

grwlf avatar grwlf commented on August 28, 2024 1

Unfortunately, it is a strictly X11 app right now. Try to find another tool for Wayland.

from xkb-switch.

grwlf avatar grwlf commented on August 28, 2024 1

@FrolovRuslan1 I would be happy to accept the PR. Have some questions:

  1. What do you think, can we write an abstraction which would run the existing code on X, and the wayland code you have prototyped if we are on wayland? I think we can depart from making this class a C-structure with function pointers pointing to either X11 or Wayland implementations depending on the build configuration flag? (I am ok with moving towards pure-C implementation)
  2. What changes do we need in the CMake?

from xkb-switch.

grwlf avatar grwlf commented on August 28, 2024

Originally I had no Wayland devices to think about it's support, but now I have a Pinephone which uses Wayland, so at least I can compile and run examples.

I think that it is not a good idea to integrate Wayland support to the originally-X11-only XkbSwitch.cpp files, but we may think about writing a separate tool with the same command-line interface.

Do you have any good examples of working with keyboard using this protocol?

from xkb-switch.

timsofteng avatar timsofteng commented on August 28, 2024

@grwlf I use sway and layout can be changed with swaymsg externally.
It should not be hard to implement it.

from xkb-switch.

grwlf avatar grwlf commented on August 28, 2024

Afaik, X applications should run under Wayland's X compatibility layer called XWayland https://wayland.freedesktop.org/docs/html/ch05.html
Has anybody tried it with xkb-switch?

from xkb-switch.

1nikolas avatar 1nikolas commented on August 28, 2024

Afaik, X applications should run under Wayland's X compatibility layer called XWayland https://wayland.freedesktop.org/docs/html/ch05.html Has anybody tried it with xkb-switch?

Yes it does run under xwayland but it seems xwayland doesn't sync the keyboard layouts with wayland.. It's like its own separate thing, I can set my layouts with setxkbmap and switch them/query them with xkb-switch but they don't affect the real keyboard layout in wayland. I have no idea where to open an issue about that..

from xkb-switch.

FrolovRuslan1 avatar FrolovRuslan1 commented on August 28, 2024

Afaik, X applications should run under Wayland's X compatibility layer called XWayland https://wayland.freedesktop.org/docs/html/ch05.html Has anybody tried it with xkb-switch?

Hello again. I can help develop xkb-switch under Wayland. Wayland support libxkbcommon and Wayland API libwayland. Here is my test code where I can get list of layouts. BUT how I found out here libxkbcommon doesnt have tools to switch layouts.

I have ru and us layouts.
Here tests on Debian:
In Plasma Wayland:
1.

-> % xkb-switch --list
us
-> % ./wxkb_switch    
It prints keyboard layout only via xkbcommon
num: 1
English (US)
It prints keyboard layout via xkbcommon and wayland
num: 2
English (US)
Russian

In Plasma X11:
1.

-> % xkb-switch --list
us
ru
-> % ./wxkb_switch
It prints keyboard layout only via xkbcommon
num: 1
English (US)
Failed to connect to Wayland display

from xkb-switch.

FrolovRuslan1 avatar FrolovRuslan1 commented on August 28, 2024

@FrolovRuslan1 I would be happy to accept the PR. Have some questions:

1. What do you think, can we write an abstraction which would run the existing code on X, and the wayland code you have prototyped if we are on wayland?  I think we can depart from making [this class](https://github.com/grwlf/xkb-switch/blob/master/src/XKeyboard.hpp) a C-structure with function pointers pointing to either X11 or Wayland implementations depending on the build configuration flag? (I am ok with moving towards pure-C implementation)

2. What changes do we need in the CMake?

I checked XKeyboard.hpp and yes, we can write an abstraction for Wayland. I think we can create Class automatically depends on environment variables. Or we can split the project on two. One for the X11 and one for Wayland because if we will be make project based on dependence of build configuration flag or runtime variable then the project growing up to unreadable size, moreover, I do not think that a new X11 analogue will appear under Linux in the near future.

P.S. I tested setxkbmap it is working but it crash DE switching. If you can please open issue for user help on Wayland and ask like that "Is Wayland have standard methods for switching keyboard layouts because xkbcommon doesnt have and setxkbmap crash DE switching layout." because for some reason I cant singup and register on Gitlab even through VPN it just doesnt send on google email.
I think if Wayland doesnt have such methods then we can use libxkbcommon for getting information about keyboard and setting via setxkbmap or yours implementation.

UPDATE 15.12.2023:
Open issue in Wayland.

from xkb-switch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.