git.iko.soy/typeable/nixpkgs
on master help sign in
pantheon.evince: init
commitac6f34a6698d6079a46dd1dc88e8b52d40134b8f authorBobby Rong <rjl931189261@126.com> dateThu 7 Oct 2021, 11:44 (5 years ago) parent7034cd4
3 files changed+111−5
pkgs/desktops/gnome/core/evince/default.nix+23−5 pkgs/desktops/gnome/core/evince/pantheon-dark-style.patch+86 pkgs/desktops/pantheon/default.nix+2
pkgs/desktops/gnome/core/evince/default.nix+23−5
@@ -30,6 +30,7 @@
3030, gsettings-desktop-schemas
3131, gnome-desktop
3232, dbus
33+, pantheon
3334, python3
3435, texlive
3536, t1lib
@@ -40,6 +41,7 @@
4041, supportMultimedia ? true # PDF multimedia
4142, libgxps
4243, supportXPS ? true # Open XML Paper Specification via libgxps
44+, withPantheon ? false
4345}:
4446
4547stdenv.mkDerivation rec {
@@ -53,6 +55,13 @@ stdenv.mkDerivation rec {
5355 sha256 = "lautDW/urJVg2zq4C6fF6rsf3xyg47PJMzmvBUU6JNg=";
5456 };
5557
58+ patches = lib.optionals withPantheon [
59+ # Make this respect dark mode settings from Pantheon
60+ # https://github.com/elementary/evince
61+ # The patch currently differs from upstream (updated for evince 41).
62+ ./pantheon-dark-style.patch
63+ ];
64+
5665 postPatch = ''
5766 chmod +x meson_post_install.py
5867 patchShebangs meson_post_install.py
@@ -96,9 +105,18 @@ stdenv.mkDerivation rec {
96105 poppler
97106 t1lib
98107 texlive.bin.core # kpathsea for DVI support
99− ] ++ lib.optional supportXPS libgxps
100− ++ lib.optionals supportMultimedia (with gst_all_1; [
101− gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav ]);
108+ ] ++ lib.optionals supportXPS [
109+ libgxps
110+ ] ++ lib.optionals supportMultimedia (with gst_all_1; [
111+ gstreamer
112+ gst-plugins-base
113+ gst-plugins-good
114+ gst-plugins-bad
115+ gst-plugins-ugly
116+ gst-libav
117+ ]) ++ lib.optionals withPantheon [
118+ pantheon.granite
119+ ];
102120
103121 mesonFlags = [
104122 "-Dnautilus=false"
@@ -128,8 +146,8 @@ stdenv.mkDerivation rec {
128146 on the GNOME Desktop with a single simple application.
129147 '';
130148
131− license = lib.licenses.gpl2Plus;
149+ license = licenses.gpl2Plus;
132150 platforms = platforms.linux;
133− maintainers = teams.gnome.members;
151+ maintainers = teams.gnome.members ++ teams.pantheon.members;
134152 };
135153}
pkgs/desktops/gnome/core/evince/pantheon-dark-style.patchnew file+86
@@ -0,0 +1,86 @@
1+diff --git a/meson.build b/meson.build
2+index bcb69cf7..4a18c08c 100644
3+--- a/meson.build
4++++ b/meson.build
5+@@ -162,6 +162,7 @@ gmodule_dep = dependency('gmodule-2.0')
6+ gmodule_no_export_dep = dependency('gmodule-no-export-2.0', version: glib_req_version)
7+ gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
8+ gthread_dep = dependency('gthread-2.0', version: glib_req_version)
9++granite_dep = dependency('granite')
10+ # Keep the version here synchronised with subprojects/libhandy.wrap
11+ hdy_dep = dependency('libhandy-1', version: hdy_req_version, fallback: ['libhandy', 'libhandy_dep'])
12+
13+diff --git a/shell/ev-application.c b/shell/ev-application.c
14+index e704bda2..d705328c 100644
15+--- a/shell/ev-application.c
16++++ b/shell/ev-application.c
17+@@ -30,6 +30,7 @@
18+ #include <glib/gi18n.h>
19+ #include <glib/gstdio.h>
20+ #include <gtk/gtk.h>
21++#include <granite.h>
22+ #include <handy.h>
23+ #ifdef GDK_WINDOWING_X11
24+ #include <gdk/gdkx.h>
25+@@ -176,7 +177,7 @@ ev_spawn (const char *uri,
26+
27+ g_string_append_printf (cmd, " %s", path);
28+ g_free (path);
29+-
30++
31+ /* Page label */
32+ if (dest) {
33+ switch (ev_link_dest_get_dest_type (dest)) {
34+@@ -940,6 +941,20 @@ ev_application_migrate_config_dir (EvApplication *application)
35+ g_free (old_accels);
36+ }
37+
38++static void
39++ev_application_set_prefers_color_scheme ()
40++{
41++ GtkSettings* gtk_settings = gtk_settings_get_default ();
42++ GraniteSettings* granite_settings = granite_settings_get_default ();
43++
44++ g_object_set (
45++ gtk_settings,
46++ "gtk-application-prefer-dark-theme",
47++ granite_settings_get_prefers_color_scheme (granite_settings) == GRANITE_SETTINGS_COLOR_SCHEME_DARK,
48++ NULL
49++ );
50++}
51++
52+ static void
53+ ev_application_startup (GApplication *gapplication)
54+ {
55+@@ -992,6 +1007,7 @@ ev_application_startup (GApplication *gapplication)
56+
57+ EvApplication *application = EV_APPLICATION (gapplication);
58+ const gchar **it;
59++ GraniteSettings* granite_settings = granite_settings_get_default ();
60+
61+ g_application_set_resource_base_path (gapplication, "/org/gnome/evince");
62+
63+@@ -999,6 +1015,11 @@ ev_application_startup (GApplication *gapplication)
64+
65+ hdy_init ();
66+
67++ ev_application_set_prefers_color_scheme ();
68++
69++ g_signal_connect (granite_settings, "notify::prefers-color-scheme",
70++ G_CALLBACK(ev_application_set_prefers_color_scheme), NULL);
71++
72+ for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
73+ gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
74+ }
75+diff --git a/shell/meson.build b/shell/meson.build
76+index 7cbc48f2..a3089b13 100644
77+--- a/shell/meson.build
78++++ b/shell/meson.build
79+@@ -52,6 +52,7 @@ sources += gnome.compile_resources(
80+ deps = [
81+ gdk_pixbuf_dep,
82+ gnome_desktop_dep,
83++ granite_dep,
84+ hdy_dep,
85+ libevmisc_dep,
86+ libevproperties_dep,
pkgs/desktops/pantheon/default.nix+2
@@ -71,6 +71,8 @@ lib.makeScope pkgs.newScope (self: with self; {
7171
7272 epiphany = pkgs.epiphany.override { withPantheon = true; };
7373
74+ evince = pkgs.evince.override { withPantheon = true; };
75+
7476 sideload = callPackage ./apps/sideload { };
7577
7678 #### DESKTOP