summary refs log tree commit diff
path: root/pkgs/desktops/gnome-3/misc/gnome-tweak-tool
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2017-09-24 13:15:50 +0200
committerzimbatm <zimbatm@zimbatm.com>2017-09-24 12:15:50 +0100
commit69698ec11cc0619d84b14764fa9e708fe7e7223c (patch)
tree9d9f602554b497a3265caf5e2ef4821e12736686 /pkgs/desktops/gnome-3/misc/gnome-tweak-tool
parent23b19efdc9c8d64177cefcaa5b919db966bb8f5e (diff)
downloadnixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar.gz
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar.bz2
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar.lz
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar.xz
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.tar.zst
nixlib-69698ec11cc0619d84b14764fa9e708fe7e7223c.zip
gnome3: only maintain single GNOME 3 package set (#29397)
* gnome3: only maintain single GNOME 3 package set

GNOME 3 was split into 3.10 and 3.12 in #2694. Unfortunately, we barely have the resources
to update a single version of GNOME. Maintaining multiple versions just does not make sense.
Additionally, it makes viewing history using most Git tools bothersome.

This commit renames `pkgs/desktops/gnome-3/3.24` to `pkgs/desktops/gnome-3`, removes
the config variable for choosing packageset (`environment.gnome3.packageSet`), updates
the hint in maintainer script, and removes the `gnome3_24` derivation from `all-packages.nix`.

Closes: #29329

* maintainers/scripts/gnome: Use fixed GNOME 3 directory

Since we now allow only a single GNOME 3 package set, specifying
the working directory is not necessary.

This commit sets the directory to `pkgs/desktops/gnome-3`.
Diffstat (limited to 'pkgs/desktops/gnome-3/misc/gnome-tweak-tool')
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0001-Search-for-themes-and-icons-in-system-data-dirs.patch123
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0002-Don-t-show-multiple-entries-for-a-single-theme.patch103
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0003-Create-config-dir-if-it-doesn-t-exist.patch27
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix42
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch22
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-tweak-tool/src.nix10
6 files changed, 327 insertions, 0 deletions
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0001-Search-for-themes-and-icons-in-system-data-dirs.patch b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0001-Search-for-themes-and-icons-in-system-data-dirs.patch
new file mode 100644
index 000000000000..d236730282a9
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0001-Search-for-themes-and-icons-in-system-data-dirs.patch
@@ -0,0 +1,123 @@
+From ac9e8e835888da1faa57f07c54fa4e73783621e2 Mon Sep 17 00:00:00 2001
+From: Jascha Geerds <jascha@jgeerds.name>
+Date: Sun, 25 Jun 2017 11:32:30 +0100
+Subject: [PATCH 1/3] Search for themes and icons in system data dirs
+
+---
+ gtweak/tweaks/tweak_group_interface.py | 17 ++++-------------
+ gtweak/tweaks/tweak_group_keymouse.py  |  7 ++-----
+ gtweak/utils.py                        | 17 +++++++++++++++++
+ 3 files changed, 23 insertions(+), 18 deletions(-)
+
+diff --git a/gtweak/tweaks/tweak_group_interface.py b/gtweak/tweaks/tweak_group_interface.py
+index 97751ed..db89b85 100644
+--- a/gtweak/tweaks/tweak_group_interface.py
++++ b/gtweak/tweaks/tweak_group_interface.py
+@@ -26,7 +26,7 @@ from gi.repository import Gtk
+ from gi.repository import GLib
+ 
+ import gtweak
+-from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file
++from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs
+ from gtweak.tweakmodel import Tweak, TWEAK_GROUP_APPEARANCE
+ from gtweak.gshellwrapper import GnomeShellFactory
+ from gtweak.gsettings import GSettingsSetting
+@@ -50,10 +50,7 @@ class GtkThemeSwitcher(GSettingsComboTweak):
+         if gtk_ver % 2: # Want even number
+             gtk_ver += 1
+ 
+-        dirs = ( os.path.join(gtweak.DATA_DIR, "themes"),
+-                 os.path.join(GLib.get_user_data_dir(), "themes"),
+-                 os.path.join(os.path.expanduser("~"), ".themes"))
+-        valid = walk_directories(dirs, lambda d:
++        valid = walk_directories(get_resource_dirs("themes"), lambda d:
+                     os.path.exists(os.path.join(d, "gtk-2.0")) and \
+                         (os.path.exists(os.path.join(d, "gtk-3.0")) or \
+                          os.path.exists(os.path.join(d, "gtk-3.{}".format(gtk_ver)))))
+@@ -69,10 +66,7 @@ class IconThemeSwitcher(GSettingsComboTweak):
+             **options)
+ 
+     def _get_valid_icon_themes(self):
+-        dirs = ( os.path.join(gtweak.DATA_DIR, "icons"),
+-                 os.path.join(GLib.get_user_data_dir(), "icons"),
+-                 os.path.join(os.path.expanduser("~"), ".icons"))
+-        valid = walk_directories(dirs, lambda d:
++        valid = walk_directories(get_resource_dirs("icons"), lambda d:
+                     os.path.isdir(d) and \
+ 			os.path.exists(os.path.join(d, "index.theme")))
+         return valid
+@@ -87,10 +81,7 @@ class CursorThemeSwitcher(GSettingsComboTweak):
+             **options)
+ 
+     def _get_valid_cursor_themes(self):
+-        dirs = ( os.path.join(gtweak.DATA_DIR, "icons"),
+-                 os.path.join(GLib.get_user_data_dir(), "icons"),
+-                 os.path.join(os.path.expanduser("~"), ".icons"))
+-        valid = walk_directories(dirs, lambda d:
++        valid = walk_directories(get_resource_dirs("icons"), lambda d:
+                     os.path.isdir(d) and \
+                         os.path.exists(os.path.join(d, "cursors")))
+         return valid
+diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
+index 69c4b7e..b06900c 100644
+--- a/gtweak/tweaks/tweak_group_keymouse.py
++++ b/gtweak/tweaks/tweak_group_keymouse.py
+@@ -21,7 +21,7 @@ from gi.repository import GLib
+ 
+ import gtweak
+ from gtweak.gshellwrapper import GnomeShellFactory
+-from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default
++from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs
+ from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title, GSettingsComboEnumTweak
+ 
+ _shell = GnomeShellFactory().get_shell()
+@@ -41,10 +41,7 @@ class KeyThemeSwitcher(GSettingsComboTweak):
+             **options)
+ 
+     def _get_valid_key_themes(self):
+-        dirs = ( os.path.join(gtweak.DATA_DIR, "themes"),
+-                 os.path.join(GLib.get_user_data_dir(), "themes"),
+-                 os.path.join(os.path.expanduser("~"), ".themes"))
+-        valid = walk_directories(dirs, lambda d:
++        valid = walk_directories(get_resource_dirs("themes"), lambda d:
+                     os.path.isfile(os.path.join(d, "gtk-3.0", "gtk-keys.css")) and \
+                     os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc")))
+         return valid
+diff --git a/gtweak/utils.py b/gtweak/utils.py
+index 39f8833..b0993b6 100644
+--- a/gtweak/utils.py
++++ b/gtweak/utils.py
+@@ -21,6 +21,7 @@ import tempfile
+ import shutil
+ import subprocess
+ import glob
++import itertools
+ 
+ import gtweak
+ from gtweak.gsettings import GSettingsSetting
+@@ -116,6 +117,22 @@ def execute_subprocess(cmd_then_args, block=True):
+         stdout, stderr = p.communicate()
+         return stdout, stderr, p.returncode
+ 
++def get_resource_dirs(resource):
++    """Returns a list of all known resource dirs for a given resource.
++
++    :param str resource:
++        Name of the resource (e.g. "themes")
++    :return:
++        A list of resource dirs
++    """
++    dirs = [os.path.join(dir, resource)
++            for dir in itertools.chain(GLib.get_system_data_dirs(),
++                                       (gtweak.DATA_DIR,
++                                        GLib.get_user_data_dir()))]
++    dirs += [os.path.join(os.path.expanduser("~"), ".{}".format(resource))]
++
++    return [dir for dir in dirs if os.path.isdir(dir)]
++
+ @singleton
+ class AutostartManager:
+ 
+-- 
+2.12.2
+
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0002-Don-t-show-multiple-entries-for-a-single-theme.patch b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0002-Don-t-show-multiple-entries-for-a-single-theme.patch
new file mode 100644
index 000000000000..40c0969d5880
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0002-Don-t-show-multiple-entries-for-a-single-theme.patch
@@ -0,0 +1,103 @@
+From 25c047ac6a2ac892e2be3d7e002fbf7a16725a4c Mon Sep 17 00:00:00 2001
+From: Jascha Geerds <jascha@jgeerds.name>
+Date: Sun, 25 Jun 2017 11:35:10 +0100
+Subject: [PATCH 2/3] Don't show multiple entries for a single theme
+
+---
+ gtweak/tweaks/tweak_group_interface.py |  8 ++++----
+ gtweak/tweaks/tweak_group_keymouse.py  |  4 ++--
+ gtweak/utils.py                        | 16 ++++++++++++++++
+ 3 files changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/gtweak/tweaks/tweak_group_interface.py b/gtweak/tweaks/tweak_group_interface.py
+index db89b85..4697fe3 100644
+--- a/gtweak/tweaks/tweak_group_interface.py
++++ b/gtweak/tweaks/tweak_group_interface.py
+@@ -26,7 +26,7 @@ from gi.repository import Gtk
+ from gi.repository import GLib
+ 
+ import gtweak
+-from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs
++from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs, get_unique_resources
+ from gtweak.tweakmodel import Tweak, TWEAK_GROUP_APPEARANCE
+ from gtweak.gshellwrapper import GnomeShellFactory
+ from gtweak.gsettings import GSettingsSetting
+@@ -54,7 +54,7 @@ class GtkThemeSwitcher(GSettingsComboTweak):
+                     os.path.exists(os.path.join(d, "gtk-2.0")) and \
+                         (os.path.exists(os.path.join(d, "gtk-3.0")) or \
+                          os.path.exists(os.path.join(d, "gtk-3.{}".format(gtk_ver)))))
+-        return valid
++        return get_unique_resources(valid)
+ 
+ class IconThemeSwitcher(GSettingsComboTweak):
+     def __init__(self, **options):
+@@ -69,7 +69,7 @@ class IconThemeSwitcher(GSettingsComboTweak):
+         valid = walk_directories(get_resource_dirs("icons"), lambda d:
+                     os.path.isdir(d) and \
+ 			os.path.exists(os.path.join(d, "index.theme")))
+-        return valid
++        return get_unique_resources(valid)
+ 
+ class CursorThemeSwitcher(GSettingsComboTweak):
+     def __init__(self, **options):
+@@ -84,7 +84,7 @@ class CursorThemeSwitcher(GSettingsComboTweak):
+         valid = walk_directories(get_resource_dirs("icons"), lambda d:
+                     os.path.isdir(d) and \
+                         os.path.exists(os.path.join(d, "cursors")))
+-        return valid
++        return get_unique_resources(valid)
+ 
+ class ShellThemeTweak(Gtk.Box, Tweak):
+ 
+diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
+index b06900c..d34793e 100644
+--- a/gtweak/tweaks/tweak_group_keymouse.py
++++ b/gtweak/tweaks/tweak_group_keymouse.py
+@@ -21,7 +21,7 @@ from gi.repository import GLib
+ 
+ import gtweak
+ from gtweak.gshellwrapper import GnomeShellFactory
+-from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs
++from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs, get_unique_resources
+ from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title, GSettingsComboEnumTweak
+ 
+ _shell = GnomeShellFactory().get_shell()
+@@ -44,7 +44,7 @@ class KeyThemeSwitcher(GSettingsComboTweak):
+         valid = walk_directories(get_resource_dirs("themes"), lambda d:
+                     os.path.isfile(os.path.join(d, "gtk-3.0", "gtk-keys.css")) and \
+                     os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc")))
+-        return valid
++        return get_unique_resources(valid)
+ 
+ TWEAK_GROUPS = [
+     ListBoxTweakGroup(_("Keyboard and Mouse"),
+diff --git a/gtweak/utils.py b/gtweak/utils.py
+index b0993b6..0d995bc 100644
+--- a/gtweak/utils.py
++++ b/gtweak/utils.py
+@@ -133,6 +133,22 @@ def get_resource_dirs(resource):
+ 
+     return [dir for dir in dirs if os.path.isdir(dir)]
+ 
++def get_unique_resources(dirs):
++    """Filter out duplicated resources.
++
++    :param list dirs:
++        List of resource dirs (e.g. /usr/share/themes/Adwaita)
++    :return:
++        List of dirs without duplicated resources
++    """
++    unique_dirs = {}
++    for dir in dirs:
++        basename = os.path.basename(dir)
++        if basename not in unique_dirs:
++            unique_dirs[basename] = dir
++
++    return unique_dirs
++
+ @singleton
+ class AutostartManager:
+ 
+-- 
+2.12.2
+
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0003-Create-config-dir-if-it-doesn-t-exist.patch b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0003-Create-config-dir-if-it-doesn-t-exist.patch
new file mode 100644
index 000000000000..5082a55387a8
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0003-Create-config-dir-if-it-doesn-t-exist.patch
@@ -0,0 +1,27 @@
+From ba2eb4be6c69ee8206e0139268c896e6a2b278d8 Mon Sep 17 00:00:00 2001
+From: Jascha Geerds <jascha@jgeerds.name>
+Date: Sun, 25 Jun 2017 11:50:33 +0100
+Subject: [PATCH 3/3] Create config dir if it doesn't exist
+
+---
+ gtweak/gtksettings.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/gtweak/gtksettings.py b/gtweak/gtksettings.py
+index a0c163b..f5883ec 100644
+--- a/gtweak/gtksettings.py
++++ b/gtweak/gtksettings.py
+@@ -36,6 +36,10 @@ class GtkSettingsManager:
+     def _get_keyfile(self):
+         keyfile = None
+         try:
++            config_dir = os.path.dirname(self._path)
++            if not os.path.isdir(config_dir):
++                os.makedirs(config_dir)
++
+             keyfile = GLib.KeyFile()
+             keyfile.load_from_file(self._path, 0)
+         except MemoryError:
+-- 
+2.12.2
+
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix
new file mode 100644
index 000000000000..1df3c1ffdb7c
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, intltool, fetchurl, atk
+, pkgconfig, gtk3, glib, libsoup
+, bash, itstool, libxml2, python2Packages
+, gnome3, librsvg, gdk_pixbuf, file, libnotify, gobjectIntrospection, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  inherit (import ./src.nix fetchurl) name src;
+
+  doCheck = true;
+
+  propagatedUserEnvPkgs = [ gnome3.gnome_themes_standard ];
+
+  makeFlags = [ "DESTDIR=/" ];
+
+  buildInputs = [ pkgconfig gtk3 glib intltool itstool libxml2
+                  gnome3.gsettings_desktop_schemas file
+                  gdk_pixbuf gnome3.defaultIconTheme librsvg
+                  libnotify gnome3.gnome_shell python2Packages.pygobject3
+                  libsoup gnome3.gnome_settings_daemon gnome3.nautilus
+                  gnome3.gnome_desktop wrapGAppsHook gobjectIntrospection
+                ];
+
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --prefix PYTHONPATH : "$out/${python2Packages.python.sitePackages}:$PYTHONPATH")
+  '';
+
+  patches = [
+    ./find_gsettings.patch
+    ./0001-Search-for-themes-and-icons-in-system-data-dirs.patch
+    ./0002-Don-t-show-multiple-entries-for-a-single-theme.patch
+    ./0003-Create-config-dir-if-it-doesn-t-exist.patch
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://wiki.gnome.org/action/show/Apps/GnomeTweakTool;
+    description = "A tool to customize advanced GNOME 3 options";
+    maintainers = gnome3.maintainers;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch
new file mode 100644
index 000000000000..3e68c04cb3ab
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch
@@ -0,0 +1,22 @@
+diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
+index a00fe19..dce74b2 100644
+--- a/gtweak/gsettings.py
++++ b/gtweak/gsettings.py
+@@ -33,10 +33,15 @@ class GSettingsMissingError(Exception):
+ 
+ class _GSettingsSchema:
+     def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options):
+-        if not schema_dir:
+-            schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
+         if not schema_filename:
+             schema_filename = schema_name + ".gschema.xml"
++        if not schema_dir:
++            schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
++            for xdg_dir in GLib.get_system_data_dirs():
++                dir = os.path.join(xdg_dir, "glib-2.0", "schemas")
++                if os.path.exists(os.path.join(dir, schema_filename)):
++                    schema_dir = dir
++                    break
+ 
+         schema_path = os.path.join(schema_dir, schema_filename)
+         if not os.path.exists(schema_path):
diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/src.nix b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/src.nix
new file mode 100644
index 000000000000..0af83053fa89
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/src.nix
@@ -0,0 +1,10 @@
+# Autogenerated by maintainers/scripts/gnome.sh update
+
+fetchurl: {
+  name = "gnome-tweak-tool-3.24.1";
+
+  src = fetchurl {
+    url = mirror://gnome/sources/gnome-tweak-tool/3.24/gnome-tweak-tool-3.24.1.tar.xz;
+    sha256 = "19226b374148d660330af9a8341087c2f869bb24355f4dcc87857169eca9f565";
+  };
+}