summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorBobby Rong <rjl931189261@126.com>2021-08-13 21:46:21 +0800
committerBobby Rong <rjl931189261@126.com>2021-09-18 19:33:40 +0800
commitfee747f5c5dc1db64c7a2805507387a85bd1c842 (patch)
tree66773a4cea9b2c3ec5cc9e572c845a8be9846bbd /pkgs
parentdc5ea0908da8359383c96bfa5f8c23fd5b8308d1 (diff)
downloadnixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar.gz
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar.bz2
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar.lz
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar.xz
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.tar.zst
nixpkgs-fee747f5c5dc1db64c7a2805507387a85bd1c842.zip
pantheon.epiphany: init
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/desktops/gnome/core/epiphany/dark-style.patch76
-rw-r--r--pkgs/desktops/gnome/core/epiphany/default.nix13
-rw-r--r--pkgs/desktops/gnome/core/epiphany/navigation-buttons.patch12
-rw-r--r--pkgs/desktops/pantheon/default.nix2
4 files changed, 101 insertions, 2 deletions
diff --git a/pkgs/desktops/gnome/core/epiphany/dark-style.patch b/pkgs/desktops/gnome/core/epiphany/dark-style.patch
new file mode 100644
index 00000000000..56ac5c1e5b2
--- /dev/null
+++ b/pkgs/desktops/gnome/core/epiphany/dark-style.patch
@@ -0,0 +1,76 @@
+diff --git a/meson.build b/meson.build
+index de9cbfa850..647f617605 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,6 +92,7 @@ iso_codes_dep = dependency('iso-codes', version: '>= 0.35')
+ json_glib_dep = dependency('json-glib-1.0', version: '>= 1.6')
+ libarchive_dep = dependency('libarchive')
+ libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.37.1')
++libgranite_dep = dependency('granite', version: '>= 6.0.0')
+ libhandy_dep = dependency('libhandy-1', version: '>= 1.1.0')
+ libsecret_dep = dependency('libsecret-1', version: '>= 0.19.0')
+ libsoup_dep = dependency('libsoup-2.4', version: '>= 2.48.0')
+diff --git a/src/ephy-shell.c b/src/ephy-shell.c
+index 650531da86..b9d1355e86 100644
+--- a/src/ephy-shell.c
++++ b/src/ephy-shell.c
+@@ -50,6 +50,7 @@
+ 
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
++#include <granite.h>
+ #include <handy.h>
+ 
+ struct _EphyShell {
+@@ -483,6 +484,20 @@ run_in_background_set_mapping (const GValue       *value,
+   return g_variant_new_boolean (g_variant_get_boolean (var));
+ }
+ 
++static void
++ephy_shell_set_prefers_color_scheme (EphyShell *shell)
++{
++    GtkSettings* gtk_settings = gtk_settings_get_default ();
++    GraniteSettings* granite_settings = granite_settings_get_default ();
++
++    g_object_set (
++        gtk_settings,
++        "gtk-application-prefer-dark-theme",
++        granite_settings_get_prefers_color_scheme (granite_settings) == GRANITE_SETTINGS_COLOR_SCHEME_DARK,
++        NULL
++    );
++}
++
+ static void
+ ephy_shell_startup (GApplication *application)
+ {
+@@ -490,11 +505,18 @@ ephy_shell_startup (GApplication *application)
+   EphyShell *shell = EPHY_SHELL (application);
+   EphyEmbedShellMode mode;
+   GAction *action;
++  GraniteSettings* granite_settings = granite_settings_get_default ();
+ 
+   G_APPLICATION_CLASS (ephy_shell_parent_class)->startup (application);
+ 
+   hdy_init ();
+ 
++  ephy_shell_set_prefers_color_scheme (shell);
++
++  g_signal_connect (granite_settings, "notify::prefers-color-scheme",
++    G_CALLBACK (ephy_shell_set_prefers_color_scheme), shell
++  );
++
+   /* If we are under Pantheon set the icon-theme and cursor-theme accordingly. */
+   if (is_desktop_pantheon ()) {
+     GtkSettings *settings = gtk_settings_get_default ();
+diff --git a/src/meson.build b/src/meson.build
+index 5bf3eb92ec..d17b1b6d93 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -74,6 +74,7 @@ libephymain_deps = [
+   gdk_dep,
+   gvdb_dep,
+   libarchive_dep,
++  libgranite_dep,
+   libhandy_dep
+ ]
+ 
diff --git a/pkgs/desktops/gnome/core/epiphany/default.nix b/pkgs/desktops/gnome/core/epiphany/default.nix
index 73c7a7aa113..3f25e303dc1 100644
--- a/pkgs/desktops/gnome/core/epiphany/default.nix
+++ b/pkgs/desktops/gnome/core/epiphany/default.nix
@@ -9,6 +9,7 @@
 , icu
 , wrapGAppsHook
 , gnome
+, pantheon
 , libportal
 , libxml2
 , libxslt
@@ -33,6 +34,7 @@
 , libdazzle
 , libhandy
 , buildPackages
+, withPantheon ? false
 }:
 
 stdenv.mkDerivation rec {
@@ -44,6 +46,13 @@ stdenv.mkDerivation rec {
     sha256 = "2tE4ufLVXeJxEo/KOLYfU/2YDFh9KeG6a1CP/zsZ9WQ=";
   };
 
+  patches = lib.optionals withPantheon [
+    # https://github.com/elementary/browser
+    # FIXME: Update the patches when https://github.com/elementary/browser/pull/41 merged
+    ./dark-style.patch
+    ./navigation-buttons.patch
+  ];
+
   nativeBuildInputs = [
     desktop-file-utils
     gettext
@@ -87,7 +96,7 @@ stdenv.mkDerivation rec {
     p11-kit
     sqlite
     webkitgtk
-  ];
+  ] ++ lib.optional withPantheon pantheon.granite;
 
   # Tests need an X display
   mesonFlags = [
@@ -108,7 +117,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://wiki.gnome.org/Apps/Epiphany";
     description = "WebKit based web browser for GNOME";
-    maintainers = teams.gnome.members;
+    maintainers = teams.gnome.members ++ teams.pantheon.members;
     license = licenses.gpl3Plus;
     platforms = platforms.linux;
   };
diff --git a/pkgs/desktops/gnome/core/epiphany/navigation-buttons.patch b/pkgs/desktops/gnome/core/epiphany/navigation-buttons.patch
new file mode 100644
index 00000000000..b7b3b620535
--- /dev/null
+++ b/pkgs/desktops/gnome/core/epiphany/navigation-buttons.patch
@@ -0,0 +1,12 @@
+diff --git a/src/resources/gtk/action-bar-start.ui b/src/resources/gtk/action-bar-start.ui
+index e604b9601f..2bfe244d53 100644
+--- a/src/resources/gtk/action-bar-start.ui
++++ b/src/resources/gtk/action-bar-start.ui
+@@ -7,7 +7,6 @@
+         <property name="visible">True</property>
+         <property name="orientation">horizontal</property>
+         <style>
+-          <class name="linked"/>
+           <class name="navigation-box"/>
+         </style>
+         <child>
diff --git a/pkgs/desktops/pantheon/default.nix b/pkgs/desktops/pantheon/default.nix
index 8da33984489..b3b5409f6a0 100644
--- a/pkgs/desktops/pantheon/default.nix
+++ b/pkgs/desktops/pantheon/default.nix
@@ -69,6 +69,8 @@ lib.makeScope pkgs.newScope (self: with self; {
 
   elementary-videos = callPackage ./apps/elementary-videos { };
 
+  epiphany = pkgs.epiphany.override { withPantheon = true; };
+
   sideload = callPackage ./apps/sideload { };
 
   #### DESKTOP