After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678171 - add keyboard layout options
add keyboard layout options
Status: RESOLVED FIXED
Product: gnome-tweak-tool
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Tweak Tool maintainer(s)
GNOME Tweak Tool maintainer(s)
: 682893 (view as bug list)
Depends on: 679075 684802 684803
Blocks:
 
 
Reported: 2012-06-15 14:56 UTC by Matthias Clasen
Modified: 2012-12-02 18:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add XKB options to the Typing group (5.76 KB, patch)
2012-09-25 18:27 UTC, Rui Matos
accepted-commit_now Details | Review
Show the XKB option group description instead of ID as tweak summary (958 bytes, patch)
2012-09-25 18:31 UTC, Rui Matos
none Details | Review
Add XKB options to typing group (5.92 KB, patch)
2012-09-25 20:42 UTC, John Stowers
committed Details | Review
Show the XKB option group description instead of ID as tweak summary (1.11 KB, patch)
2012-10-05 15:07 UTC, Rui Matos
committed Details | Review

Description Matthias Clasen 2012-06-15 14:56:05 UTC
For 3.6, we are implementing http://live.gnome.org/ThreePointFive/Features/IBus
The design http://live.gnome.org/Design/SystemSettings/RegionAndLanguage (see the table) calls for several xkb options to be moved to the tweak tool:

Remap or disable Caps Lock

Map a Meta key

Enable Ctrl+Alt+Delete to kill XServer
Comment 1 John Stowers 2012-07-03 16:39:40 UTC
Is there an API for xkb or does one just execute /usr/bin/setxkbmap -option bla ?
Comment 2 Rui Matos 2012-07-03 16:44:13 UTC
(In reply to comment #1)
> Is there an API for xkb or does one just execute /usr/bin/setxkbmap -option bla
> ?

You shouldn't apply the options from g-t-t. Please see bug 679075 for how g-s-d will apply the options. I'm also working on API in gnome-desktop to give you access to all the options defined in xkeyboard-config but it's quite finished yet.
Comment 3 Bastien Nocera 2012-08-29 15:45:05 UTC
*** Bug 682893 has been marked as a duplicate of this bug. ***
Comment 4 Owen Taylor 2012-09-07 19:00:33 UTC
For those in dire need of a workaround, you can set xkbd options by doing:

 gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"

(value is a comma-separated list.) The option names can be found in:

 /usr/share/X11/xkb/rules/evdev.xml
Comment 5 John Stowers 2012-09-08 06:32:22 UTC
yeah sorry, I have a paper due on Monday, I'll get this done before release.
Comment 6 Alexander Larsson 2012-09-11 08:07:14 UTC
Also, it would rule if we could just migrate the old xkb options to the new system.
Comment 7 John Stowers 2012-09-11 08:49:28 UTC
(In reply to comment #6)
> Also, it would rule if we could just migrate the old xkb options to the new
> system.

Where did the old options live?
Comment 8 Rui Matos 2012-09-11 09:07:39 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Also, it would rule if we could just migrate the old xkb options to the new
> > system.
> 
> Where did the old options live?

org.gnome.libgnomekbd.keyboard

It's not just dropping a .convert file unfortunately. I could probably do it in gnome-settings-daemon but I didn't find any prior art about doing it yet.
Comment 9 Matthias Clasen 2012-09-12 18:54:02 UTC
I think you can probably steal the approach of the gconf conversion: have a 'stamp' file in ~/.config somewhere.

So you would only copy the old settings if
1. there are old settings
2. there are no new settings
3. the stamp file does not exist

Does that make sense ?
Comment 10 Rui Matos 2012-09-25 18:27:31 UTC
Created attachment 225154 [details] [review]
Add XKB options to the Typing group

--

The code is a bit funny because each option is actually an element in
a gsettings string array. Also because my python foo is almost
non-existent.

This needs the patch in bug 684802 to work.
Comment 11 Rui Matos 2012-09-25 18:31:54 UTC
Created attachment 225156 [details] [review]
Show the XKB option group description instead of ID as tweak summary

--

When doing GnomeXkbInfo I forgot to add a method to get the option
group description so the previous patch just uses the group ID as the
tweak summary. This patch uses the proper string now but needs the
patch in bug 684803 which I didn't want to bother the r-t with for
today's release, so this can only go in after that lands, probably for
3.6.1.
Comment 12 John Stowers 2012-09-25 20:42:32 UTC
Created attachment 225177 [details] [review]
Add XKB options to typing group
Comment 13 John Stowers 2012-09-25 20:44:55 UTC
(In reply to comment #10)
> Created an attachment (id=225154) [details] [review]
> Add XKB options to the Typing group
> 
> --
> 
> The code is a bit funny because each option is actually an element in
> a gsettings string array. Also because my python foo is almost
> non-existent.
> 
> This needs the patch in bug 684802 to work.

Rui,

Could you check out my patch (attachment 225177 [details] [review]) for how I would recommend doing this in a more pythonic way (no globals, etc)?

The patch is un-tested, but it should be close to working. I will download the GNOME beta livecd and try it there, if you don't beat me to it.

John
Comment 14 John Stowers 2012-09-25 20:46:04 UTC
> Could you check out my patch (attachment 225177 [details] [review]) 

Oh, and obviously remove my FIXME code which I was using to test against my older GNOME version.
Comment 15 John Stowers 2012-09-25 20:53:18 UTC
Review of attachment 225154 [details] [review]:

See my comment for the recommended way to do this, but otherwise this is OK.
Comment 16 John Stowers 2012-09-25 20:53:38 UTC
Review of attachment 225156 [details] [review]:

sure
Comment 17 Rui Matos 2012-09-25 21:31:54 UTC
Review of attachment 225177 [details] [review]:

Hey, thanks, it certainly looks more elegant this way and works with the 2 small fixes I noted below. Shall I push?

::: gtweak/tweaks/tweak_typing.py
@@ +62,3 @@
+
+    def reload(self):
+        for v in self._parent_settings.get_strv(self.XKB_GSETTINGS_NAME):

TypingTweakGroup.XKB_GSETTINGS_NAME

@@ +91,3 @@
+            self._parent_settings.setting_add_to_list(TypingTweakGroup.XKB_GSETTINGS_NAME, new_value)
+            #FIXME: did you need to set this somewhere?
+            #self._value = new_value

no need IMO as it gets set on reload() but can be if you prefer

@@ +106,3 @@
+        try:
+            self._kbdsettings = GSettingsSetting("org.gnome.desktop.input-sources")
+            self._kbdsettings.connect("changed::"+self.self.XKB_GSETTINGS_NAME, self._on_changed)

there's and extra self there
Comment 18 John Stowers 2012-09-25 22:19:25 UTC
(In reply to comment #17)
> Review of attachment 225177 [details] [review]:
> 
> Hey, thanks, it certainly looks more elegant this way and works with the 2
> small fixes I noted below. Shall I push?

Yep, please push with the fixes you suggest. Keep the self._value setting as you wrote, I missed it.

Thanks a lot!
Comment 19 Rui Matos 2012-09-25 22:58:59 UTC
Pushed. I'm going to leave this open until bug 684803 is fixed so that we can then commit attachment 225156 [details] [review].
Comment 20 Rui Matos 2012-10-05 15:07:40 UTC
Created attachment 225889 [details] [review]
Show the XKB option group description instead of ID as tweak summary

--

Since gnome-desktop 3.6.0 didn't get this API would you prefer
somehing like this patch to handle both old and new versions of the
library or should we add a versioned dependency in configure.ac?
Comment 21 John Stowers 2012-12-02 18:54:15 UTC
Attachment 225889 [details] pushed as fe467c6 - Show the XKB option group description instead of ID as tweak summary