From 66add9f141a6612cf9b361fb2c4ce3c54049d61f Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Sat, 11 May 2019 20:19:30 -0400 Subject: [PATCH] slack: Generalize theming Split out dark theme Fixes #61155 --- .../instant-messengers/slack/dark-theme.nix | 22 +++++++++++++++++++ .../instant-messengers/slack/default.nix | 10 ++++----- pkgs/top-level/all-packages.nix | 3 ++- 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 pkgs/applications/networking/instant-messengers/slack/dark-theme.nix diff --git a/pkgs/applications/networking/instant-messengers/slack/dark-theme.nix b/pkgs/applications/networking/instant-messengers/slack/dark-theme.nix new file mode 100644 index 00000000000..11e2e5baed8 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/slack/dark-theme.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl }: + +let + rev = "56d2007b5ba9f1628a44af6edf5dbdf74cf92278"; + sha256 = "1v264mpf9ddiz8zb7fcyjwy1a2yr5f4xs520gf63kl9378v721da"; + version = "2019-03-15"; +in stdenv.mkDerivation { + inherit version; + + name = "slack-theme-black"; + src = fetchurl { + url = "https://raw.githubusercontent.com/laCour/slack-night-mode/${rev}/css/raw/black.css"; + inherit sha256; + }; + + unpackPhase = "true"; + + buildCommand = '' + mkdir $out + cp $src $out/theme.css + ''; +} diff --git a/pkgs/applications/networking/instant-messengers/slack/default.nix b/pkgs/applications/networking/instant-messengers/slack/default.nix index a48cd2cad0f..bd1a3956559 100644 --- a/pkgs/applications/networking/instant-messengers/slack/default.nix +++ b/pkgs/applications/networking/instant-messengers/slack/default.nix @@ -1,9 +1,7 @@ -{ stdenv, fetchurl, dpkg, makeWrapper , alsaLib, atk, cairo, +{ theme ? null, stdenv, fetchurl, dpkg, makeWrapper , alsaLib, atk, cairo, cups, curl, dbus, expat, fontconfig, freetype, glib , gnome2, gtk3, gdk_pixbuf, libappindicator-gtk3, libnotify, libxcb, nspr, nss, pango , systemd, xorg, -at-spi2-atk, libuuid, -darkMode ? false, -darkModeCssUrl ? "https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css" +at-spi2-atk, libuuid }: let @@ -94,12 +92,12 @@ in stdenv.mkDerivation { substituteInPlace $out/share/applications/slack.desktop \ --replace /usr/bin/ $out/bin/ \ --replace /usr/share/ $out/share/ - '' + stdenv.lib.optionalString darkMode '' + '' + stdenv.lib.optionalString (theme != null) '' cat <> $out/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js document.addEventListener('DOMContentLoaded', function() { let tt__customCss = ".menu ul li a:not(.inline_menu_link) {color: #fff !important;}" $.ajax({ - url: '${darkModeCssUrl}', + url: '${theme}/theme.css', success: function(css) { \$("").appendTo('head').html(css + tt__customCss); \$("").appendTo('head').html('#reply_container.upload_in_threads .inline_message_input_container {background: padding-box #545454}'); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9ab395f091b..dddd9041f27 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18371,7 +18371,8 @@ in leftwm = callPackage ../applications/window-managers/leftwm { }; slack = callPackage ../applications/networking/instant-messengers/slack { }; - slack-dark = pkgs.slack.override { darkMode = true; }; + slack-theme-black = callPackage ../applications/networking/instant-messengers/slack/dark-theme.nix { }; + slack-dark = pkgs.slack.override { theme = slack-theme-black; }; slack-cli = callPackage ../tools/networking/slack-cli { };