Results 1 to 5 of 5

Thread: Changing Keyboard Layout Options via gconftool-2

  1. #1
    Join Date
    Jul 2007
    Beans
    9

    Changing Keyboard Layout Options via gconftool-2

    Since my laptop is often (dis)connected from the dock to which an Apple Keyboard is attached, I am looking for a convenient way to trigger some changes in keyboard layout through from the command line / script.

    The effect I want to achieve is the same as going to System Settings -> Keyboard Layout -> Options ... and tick the "Left Alt is swapped with Left Win" under "Alt/Win key behavior".
    After performing the above GUI operation, I can see that the command
    Code:
    gconftool-2 --get /desktop/gnome/peripherals/keyboard/kbd/options
    Produces the following output:
    Code:
    [altwin	altwin:swap_lalt_lwin]
    But, I want to achieve the same effect of via the command line instead. Therefore, I tried the following:
    Code:
    gconftool-2 --set --type=list --list-type=string /desktop/gnome/peripherals/keyboard/kbd/options "[altwin	altwin:swap_lalt_lwin]"
    which should effectively achieve the same effect as above (and indeed running the above get command confirms this).

    However, for some weird reason changes don't take effect (the key bindings are still unaffected), even though they are visible via both gconf-editor or gconftool-2.
    Moreover, when I go to the GUI the changes are not visible and if I am to make the change now the GUI crashes.

    Any ideas why it does not work?
    Last edited by leden; January 18th, 2013 at 06:12 AM.

  2. #2
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Changing Keyboard Layout Options via gconftool-2

    What release are you using?
    In 12.10 setting is in dconf.Use dconf-editor or the gsettings command.
    eg
    Get current..
    Code:
    gsettings get org.gnome.libgnomekbd.keyboard options

    Set "Left Alt is swapped with Left Win"...
    Code:
    gsettings set org.gnome.libgnomekbd.keyboard options "['altwin\taltwin:swap_lalt_lwin']"

    Set back to default...
    Code:
    gsettings reset org.gnome.libgnomekbd.keyboard options
    Last edited by stinkeye; January 18th, 2013 at 06:16 PM.

  3. #3
    Join Date
    Feb 2011
    Beans
    13

    Re: Changing Keyboard Layout Options via gconftool-2

    Hate to bump this thread, but I am looking for the same solution and neither option is working for me. I am running 12.04 LTS. Neither
    Code:
    gsettings set org.gnome.libgnomekbd.keyboard options "['altwin\taltwin:swap_lalt_lwin']"
    or
    Code:
    gconftool-2 --set --type=list --list-type=string /desktop/gnome/peripherals/keyboard/kbd/options "[altwin	altwin:swap_lalt_lwin]"
    actually change anything.

  4. #4
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Changing Keyboard Layout Options via gconftool-2

    The gsettings command works here in 13.04. and 12.10

    What does dconf-editor show. (2nd pic)
    Attached Images Attached Images
    Last edited by stinkeye; March 14th, 2013 at 06:20 PM.

  5. #5
    Join Date
    Feb 2011
    Beans
    13

    Re: Changing Keyboard Layout Options via gconftool-2

    I don't know why it wasn't working before, it is now! Now I can easily alias a command to switch between my two keyboard layouts. Thanks for the help!

    Just to confirm,

    Code:
    gsettings set org.gnome.libgnomekbd.keyboard options "['altwin\taltwin:swap_lalt_lwin']"
    Does in fact work on 12.04 LTS.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •