slack: Generalize theming

Split out dark theme
Fixes #61155
This commit is contained in:
Tim Steinbach 2019-05-11 20:19:30 -04:00 committed by Tim Steinbach
parent c7239f3aae
commit 66add9f141
3 changed files with 28 additions and 7 deletions

View File

@ -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
'';
}

View File

@ -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 <<EOF >> $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) {
\$("<style></style>").appendTo('head').html(css + tt__customCss);
\$("<style></style>").appendTo('head').html('#reply_container.upload_in_threads .inline_message_input_container {background: padding-box #545454}');

View File

@ -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 { };