GithubHelp home page GithubHelp logo

Comments (13)

spl237 avatar spl237 commented on June 23, 2024 1

Tested - works for me. Many thanks!

from labwc.

stefonarch avatar stefonarch commented on June 23, 2024

Take a look at the example file:

## If multiple layouts are used, specify the toggle-keybind using

Any option can be used among the ones listed here:
localectl list-x11-keymap-options | grep grp:

from labwc.

spl237 avatar spl237 commented on June 23, 2024

Ah - while that does indeed handle the on-the-fly switching between a predefined set of keymaps, it doesn't solve the actual problem I am having! If the user wants to change keyboard to one not previously defined - say switching from a US to UK keyboard layout because they have plugged in a new keyboard, or as part of an initial setup wizard where the user sets their keyboard layout before setting their password for the first time - it needs to be possible for the keyboard layout to be changed to any other layout on the fly.

from labwc.

Consolatis avatar Consolatis commented on June 23, 2024

We do read the environment file on reconfigure and also apply it to the environment so spawing new applications after that point will include the changes.

However, we do currently not re-create the xkb layout (nor the xcursor theme). I think there is an issue for that somewhere. It should be possible to implement, although it might become a bit finicky if combined with layoutScope=window as we only store the "group" modifier index per window. Thus if the new keyboard layout now suddenly changes their meaning (or even the count) things might get a bit quirky.

from labwc.

spl237 avatar spl237 commented on June 23, 2024

We do read the environment file on reconfigure and also apply it to the environment so spawing new applications after that point will include the changes.

Just tried that - it doesn't seem to work.
So if I have XKB_DEFAULT_LAYOUT=gb in ~/.config/labwc/environment and hence a GB keyboard layout, if I change that line to XKB_DEFAULT_LAYOUT=us, save the file and then run labwc --reconfigure in a terminal, I still get the GB keyboard layout on newly-opened applications thereafter.

It also doesn't seem to update the environment. If I do the above, close the terminal and re-open it and look at the value of XKB_DEFAULT_LAYOUT, it is unchanged.

from labwc.

Consolatis avatar Consolatis commented on June 23, 2024

if I change that line to XKB_DEFAULT_LAYOUT=us, save the file and then run labwc --reconfigure in a terminal, I still get the GB keyboard layout on newly-opened applications thereafter.

Right, because as said above we do not recreate the xkb state on reconfigure. env | grep -i layout should show the updated env var in a new terminal though. But that obviously doesn't help regarding the issue.

from labwc.

spl237 avatar spl237 commented on June 23, 2024

Right, because as said above we do not recreate the xkb state on reconfigure. env | grep -i layout should show the updated env var in a new terminal though. But that obviously doesn't help regarding the issue.

See my edited comment above - if I do exactly that, the environment variable hasn't updated for me in the new terminal.

from labwc.

Consolatis avatar Consolatis commented on June 23, 2024

Right, because as said above we do not recreate the xkb state on reconfigure. env | grep -i layout should show the updated env var in a new terminal though. But that obviously doesn't help regarding the issue.

See my edited comment above - if I do exactly that, the environment variable hasn't updated for me in the new terminal.

Just tested again with foot in a nested labwc session and for me that works. E.g. in ~/.config/labwc/environment: XKB_DEFAULT_LAYOUT=de,us -> XKB_DEFAULT_LAYOUT=de,nl -> labwc --reconfigure -> env | grep -i layout in the old terminal: de,us > spawning a new terminal: de,nl. Maybe in your case the terminal emulator uses some kind of master process that keeps its environment and uses it when spawning new instances?

from labwc.

johanmalm avatar johanmalm commented on June 23, 2024

We ought to support this. It's one of the few things that currently requires a compositor re-start to take effect.

Might be as simple as called keyboard_init() (minus the wlr_keyboard_group_create()) on reconfigure.
I'm not sure how we best handle view->keyboard_layout if indeed XKB_DEFAULT_LAYOUT has changed. Maybe we just set them all to 0?

from labwc.

spl237 avatar spl237 commented on June 23, 2024

Right, because as said above we do not recreate the xkb state on reconfigure. env | grep -i layout should show the updated env var in a new terminal though. But that obviously doesn't help regarding the issue.

See my edited comment above - if I do exactly that, the environment variable hasn't updated for me in the new terminal.

Just tested again with foot in a nested labwc session and for me that works. E.g. in ~/.config/labwc/environment: XKB_DEFAULT_LAYOUT=de,us -> XKB_DEFAULT_LAYOUT=de,nl -> labwc --reconfigure -> env | grep -i layout in the old terminal: de,us > spawning a new terminal: de,nl. Maybe in your case the terminal emulator uses some kind of master process that keeps its environment and uses it when spawning new instances?

OK, found what I was doing wrong! I wasn't thinking and was launching the new instance of the terminal from the taskbar, which is running as a different process from labwc itself, so has a different environment. If I launch the terminal from a labwc keyboard shortcut, the environment has updated as expected.

from labwc.

spl237 avatar spl237 commented on June 23, 2024

Might be as simple as called keyboard_init() (minus the wlr_keyboard_group_create()) on reconfigure.

Just tried that and it doesn't seem to work, but I could have been doing it wrong!

All I did was to add keyboard_init(g_server->seat) to the end of the reload_config_and_theme function in server.c, and to modify keyboard_init to have an "inited" flag so that wlr_keyboard_group_create was only ever called once.

Edit - digging about, I can see that the keymap generated in keyboard_init has changed to reflect the updated environment variable, so it looks as if using wlr_keyboard_set_keymap is having no effect for some reason.

from labwc.

spl237 avatar spl237 commented on June 23, 2024

A bit more fiddling suggests that should have been keyboard_init (&(g_server->seat)), but it still seems to make no difference; I can now see the environment variable changing in the terminal, but the terminal is still using the original keymap.

from labwc.

spl237 avatar spl237 commented on June 23, 2024

I've got this working - see above PR.

from labwc.

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.