[libgnomekbd] Support for xmodmap
- From: Sergey V. Udaltsov <svu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnomekbd] Support for xmodmap
- Date: Wed, 13 Oct 2010 22:41:43 +0000 (UTC)
commit 383f5f0fbfb52c8f97ecb5a81639c118c9aa54a7
Author: Sergey V. Udaltsov <svu gnome org>
Date: Wed Oct 13 23:39:31 2010 +0100
Support for xmodmap
Overcomplicated code from g-s-d is gone, simple version is supported by libgnomekbd now
libgnomekbd/gkbd-keyboard-config.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/libgnomekbd/gkbd-keyboard-config.c b/libgnomekbd/gkbd-keyboard-config.c
index 6ab4885..3074ce0 100644
--- a/libgnomekbd/gkbd-keyboard-config.c
+++ b/libgnomekbd/gkbd-keyboard-config.c
@@ -36,6 +36,8 @@
#define GROUP_SWITCHERS_GROUP "grp"
#define DEFAULT_GROUP_SWITCH "grp:shift_caps_toggle"
+#define XMODMAP_KNOWN_FILE ".xmodmap"
+#define XMODMAP_CMD "xmodmap"
const gchar GKBD_KEYBOARD_CONFIG_KEY_MODEL[] = "model";
const gchar GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS[] = "layouts";
@@ -563,6 +565,31 @@ gkbd_keyboard_config_activate (GkbdKeyboardConfig * kbd_config)
rv = xkl_config_rec_activate (data, kbd_config->engine);
g_object_unref (G_OBJECT (data));
+ /* Small bit of extensibility by using xmodmap */
+ if (rv) {
+ gchar *xmodmap_file = g_build_filename (g_get_home_dir (),
+ XMODMAP_KNOWN_FILE,
+ NULL);
+ if (g_file_test (xmodmap_file, G_FILE_TEST_EXISTS)) {
+ GError *error = NULL;
+ xkl_debug (150, "Loading custom xmodmap file %s\n",
+ xmodmap_file);
+ gchar *command =
+ g_strconcat (XMODMAP_CMD, " ", xmodmap_file,
+ NULL);
+ /* Fire and forget - do not care about errors */
+ if (!g_spawn_command_line_async (command, &error)) {
+ xkl_debug (0,
+ "Error loading custom xmodmap file: [%s]\n",
+ error->message);
+ g_error_free (error);
+ }
+ g_free (command);
+ }
+
+ g_free (xmodmap_file);
+ }
+
return rv;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]