about summary refs log tree commit diff
path: root/pkgs/desktops/mate
diff options
context:
space:
mode:
authorJosé Romildo Malaquias <malaquias@gmail.com>2019-04-28 22:23:27 -0300
committerJosé Romildo Malaquias <malaquias@gmail.com>2019-05-01 12:58:09 -0300
commitd40cef13a9cdbacbaf11cb70aeb255bfadb84636 (patch)
treeced4c0db68c97afb8665901c3fd36bd845a710e3 /pkgs/desktops/mate
parentef5a977a53453dceebc3879f481ea79cd1014a04 (diff)
downloadnixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar.gz
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar.bz2
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar.lz
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar.xz
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.tar.zst
nixlib-d40cef13a9cdbacbaf11cb70aeb255bfadb84636.zip
mate.mate-control-center: look up keyboard shortcuts in system data dirs
Diffstat (limited to 'pkgs/desktops/mate')
-rw-r--r--pkgs/desktops/mate/mate-control-center/default.nix14
-rw-r--r--pkgs/desktops/mate/mate-control-center/mate-control-center.keybindings-dir.patch106
2 files changed, 120 insertions, 0 deletions
diff --git a/pkgs/desktops/mate/mate-control-center/default.nix b/pkgs/desktops/mate/mate-control-center/default.nix
index c1bedc972df3..6e54b137ba1d 100644
--- a/pkgs/desktops/mate/mate-control-center/default.nix
+++ b/pkgs/desktops/mate/mate-control-center/default.nix
@@ -37,8 +37,22 @@ stdenv.mkDerivation rec {
     mate.mate-settings-daemon
   ];
 
+  patches = [
+    # look up keyboard shortcuts in system data dirs
+    ./mate-control-center.keybindings-dir.patch
+  ];
+
   configureFlags = [ "--disable-update-mimedb" ];
 
+  preFixup = ''
+    gappsWrapperArgs+=(
+      # WM keyboard shortcuts
+      --prefix XDG_DATA_DIRS : "${mate.marco}/share"
+    )
+  '';
+
+  enableParallelBuilding = true;
+
   meta = with stdenv.lib; {
     description = "Utilities to configure the MATE desktop";
     homepage = https://github.com/mate-desktop/mate-control-center;
diff --git a/pkgs/desktops/mate/mate-control-center/mate-control-center.keybindings-dir.patch b/pkgs/desktops/mate/mate-control-center/mate-control-center.keybindings-dir.patch
new file mode 100644
index 000000000000..4a3036ae16e2
--- /dev/null
+++ b/pkgs/desktops/mate/mate-control-center/mate-control-center.keybindings-dir.patch
@@ -0,0 +1,106 @@
+From faeb322b01d3856f3cf163470cc38f4e88a8527c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= <malaquias@gmail.com>
+Date: Sun, 28 Apr 2019 21:45:39 -0300
+Subject: [PATCH] Use system data dirs to locate key bindings
+
+---
+ capplets/keybindings/Makefile.am              |  3 +-
+ .../keybindings/mate-keybinding-properties.c  | 58 ++++++++++++-------
+ 2 files changed, 39 insertions(+), 22 deletions(-)
+
+diff --git a/capplets/keybindings/Makefile.am b/capplets/keybindings/Makefile.am
+index e5efb109..9501dd8f 100644
+--- a/capplets/keybindings/Makefile.am
++++ b/capplets/keybindings/Makefile.am
+@@ -33,8 +33,7 @@ AM_CPPFLAGS = \
+ 	$(MATECC_CAPPLETS_CFLAGS) \
+ 	-DMATELOCALEDIR="\"$(datadir)/locale\"" \
+ 	-DMATECC_DATA_DIR="\"$(pkgdatadir)\"" \
+-	-DMATECC_UI_DIR="\"$(uidir)\"" \
+-	-DMATECC_KEYBINDINGS_DIR="\"$(pkgdatadir)/keybindings\""
++	-DMATECC_UI_DIR="\"$(uidir)\""
+ CLEANFILES = \
+ 	$(MATECC_CAPPLETS_CLEANFILES) \
+ 	$(desktop_DATA) \
+diff --git a/capplets/keybindings/mate-keybinding-properties.c b/capplets/keybindings/mate-keybinding-properties.c
+index 4f257333..cf1891d2 100644
+--- a/capplets/keybindings/mate-keybinding-properties.c
++++ b/capplets/keybindings/mate-keybinding-properties.c
+@@ -1033,39 +1033,57 @@ static void
+ reload_key_entries (GtkBuilder *builder)
+ {
+   gchar **wm_keybindings;
+-  GDir *dir;
+-  const char *name;
+   GList *list, *l;
++  const gchar * const * data_dirs;
++  GHashTable *loaded_files;
++  guint i;
+ 
+   wm_keybindings = wm_common_get_current_keybindings();
+ 
+   clear_old_model (builder);
+ 
+-  dir = g_dir_open (MATECC_KEYBINDINGS_DIR, 0, NULL);
+-  if (!dir)
+-      return;
+-
+-  list = NULL;
+-  for (name = g_dir_read_name (dir) ; name ; name = g_dir_read_name (dir))
++  loaded_files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
++  data_dirs = g_get_system_data_dirs ();
++  for (i = 0; data_dirs[i] != NULL; i++)
+     {
+-      if (g_str_has_suffix (name, ".xml"))
++      g_autofree gchar *dir_path = NULL;
++      GDir *dir;
++      const gchar *name;
++
++      dir_path = g_build_filename (data_dirs[i], "mate-control-center", "keybindings", NULL);
++      g_debug ("Keybinding dir: %s", dir_path);
++
++      dir = g_dir_open (dir_path, 0, NULL);
++      if (!dir)
++        continue;
++
++      for (name = g_dir_read_name (dir) ; name ; name = g_dir_read_name (dir))
+         {
+-      list = g_list_insert_sorted (list, g_strdup (name),
+-                       (GCompareFunc) g_ascii_strcasecmp);
+-    }
+-    }
+-  g_dir_close (dir);
++          if (g_str_has_suffix (name, ".xml") == FALSE)
++            continue;
++
++          if (g_hash_table_lookup (loaded_files, name) != NULL)
++            {
++              g_debug ("Not loading %s, it was already loaded from another directory", name);
++              continue;
++            }
+ 
++          g_hash_table_insert (loaded_files, g_strdup (name), g_strdup (dir_path));
++        }
++
++      g_dir_close (dir);
++    }
++  list = g_hash_table_get_keys (loaded_files);
++  list = g_list_sort(list, (GCompareFunc) g_str_equal);
+   for (l = list; l != NULL; l = l->next)
+     {
+-        gchar *path;
+-
+-    path = g_build_filename (MATECC_KEYBINDINGS_DIR, l->data, NULL);
+-        append_keys_to_tree_from_file (builder, path, wm_keybindings);
+-    g_free (l->data);
+-    g_free (path);
++      g_autofree gchar *path = NULL;
++      path = g_build_filename (g_hash_table_lookup (loaded_files, l->data), l->data, NULL);
++      g_debug ("Keybinding file: %s", path);
++      append_keys_to_tree_from_file (builder, path, wm_keybindings);
+     }
+   g_list_free (list);
++  g_hash_table_destroy (loaded_files);
+ 
+   /* Load custom shortcuts _after_ system-provided ones,
+    * since some of the custom shortcuts may also be listed