From 4036a01c12413f43c02b0bffbc3acbcb2b8acdfb Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Sun, 30 May 2021 20:47:58 +0200 Subject: [PATCH] Change gtk theme and icons --- flake.lock | 17 +++ flake.nix | 4 + malte/gtk.nix | 8 +- malte/home.nix | 1 - malte/waybar.nix | 240 +++++++++++++++++++++++++++++++- pkgs/gruvbox-material-gtk.nix | 32 +++++ pkgs/gruvbox-material-icons.nix | 46 ++++++ 7 files changed, 341 insertions(+), 7 deletions(-) create mode 100644 pkgs/gruvbox-material-gtk.nix create mode 100644 pkgs/gruvbox-material-icons.nix diff --git a/flake.lock b/flake.lock index 7afbd48..dd9da25 100644 --- a/flake.lock +++ b/flake.lock @@ -70,6 +70,22 @@ "type": "github" } }, + "gruvbox-material-gtk": { + "flake": false, + "locked": { + "lastModified": 1618346479, + "narHash": "sha256-56Mu8zHcnB4++QXjAq3S7/UPvDB8DlpT14mAW3ketSY=", + "owner": "sainnhe", + "repo": "gruvbox-material-gtk", + "rev": "2418ff7988411c57f8974f14adeb70a64e7f25c1", + "type": "github" + }, + "original": { + "owner": "sainnhe", + "repo": "gruvbox-material-gtk", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": "nixpkgs_3" @@ -166,6 +182,7 @@ "root": { "inputs": { "emulator-2a": "emulator-2a", + "gruvbox-material-gtk": "gruvbox-material-gtk", "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_4" diff --git a/flake.nix b/flake.nix index c1d94c6..be276c9 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,10 @@ inputs.nixos-hardware.url = "github:NixOS/nixos-hardware"; inputs.home-manager.url = "github:nix-community/home-manager"; inputs.emulator-2a.url = "github:MalteT/2a-emulator/develop"; + inputs.gruvbox-material-gtk = { + url = "github:sainnhe/gruvbox-material-gtk"; + flake = false; + }; outputs = { self, nixpkgs, nixos-hardware, home-manager, ... }@inputs: let diff --git a/malte/gtk.nix b/malte/gtk.nix index 1cbeffd..37533b2 100644 --- a/malte/gtk.nix +++ b/malte/gtk.nix @@ -5,12 +5,12 @@ rec { gtk = { enable = true; theme = { - package = pkgs.gruvbox-dark-gtk; - name = "gruvbox-dark"; + package = pkgs.callPackage ../pkgs/gruvbox-material-gtk.nix { }; + name = "gruvbox-material"; }; iconTheme = { - package = pkgs.papirus-icon-theme; - name = "Papirus"; + package = pkgs.callPackage ../pkgs/gruvbox-material-icons.nix { }; + name = "Gruvbox-Material-Dark"; }; gtk2 = { diff --git a/malte/home.nix b/malte/home.nix index 7320f55..702f3d1 100644 --- a/malte/home.nix +++ b/malte/home.nix @@ -31,7 +31,6 @@ in { gimp gnome3.nautilus gnome3.sushi - hicolor-icon-theme hledger htop inkscape diff --git a/malte/waybar.nix b/malte/waybar.nix index 5d6c9f0..af1ef7b 100644 --- a/malte/waybar.nix +++ b/malte/waybar.nix @@ -53,7 +53,243 @@ }; }]; - style = - "\n * {\n border: none;\n border-radius: 0;\n font-family: FiraCode Nerd Font;\n font-size: 11px;\n min-height: 20px;\n }\n\n window#waybar {\n background-color: #282828;\n border-bottom: 1px solid #3c3836;\n color: #ebdbb2;\n }\n\n window#waybar.hidden {\n opacity: 0.2;\n }\n\n /*\n window#waybar.empty {\n background-color: transparent;\n }\n window#waybar.solo {\n background-color: #FFFFFF;\n }\n */\n\n #workspaces button {\n padding: 0 5px;\n background-color: transparent;\n color: #3c3836;\n font-weight: bolder;\n /* Use box-shadow instead of border so the text isn't offset */\n /* box-shadow: inset 0 -1px transparent; */\n }\n\n #workspaces button:hover {\n background-color: #ebdbb2;\n background-image: none;\n color: #282828;\n }\n\n #workspaces button.current_output {\n color: #928374;\n }\n\n #workspaces button.visible {\n color: #282828;\n background-color: #928374;\n }\n\n #workspaces button.current_output.visible {\n background-color: transparent;\n color: #ebdbb2;\n }\n\n #workspaces button.current_output.focused {\n background-color: #ebdbb2;\n color: #282828;\n }\n\n #workspaces button.urgent {\n background-color: #fb4934;\n }\n\n #mode {\n background-color: #fe8019;\n color: #282828;\n box-shadow: inset 0 -1px #d65d0e;\n }\n\n #clock,\n #battery,\n #cpu,\n #memory,\n #temperature,\n #backlight,\n #network,\n #pulseaudio,\n #custom-media,\n #mode,\n #idle_inhibitor,\n #mpd {\n padding: 0 10px;\n color: #ebdbb2;\n }\n\n #clock.time {\n font-weight: bolder;\n padding-right: 2px;\n }\n\n #clock.date {\n padding-left: 2px;\n }\n\n #window,\n #workspaces {\n margin: 0 4px;\n }\n\n /* If workspaces is the leftmost module, omit left margin */\n .modules-left > widget:first-child > #workspaces {\n margin-left: 0;\n }\n\n /* If workspaces is the rightmost module, omit right margin */\n .modules-right > widget:last-child > #workspaces {\n margin-right: 0;\n }\n\n #battery {\n background-color: transparent;\n }\n\n #battery.warning:not(.charging) {\n background-color: #fe8019;\n color: #282828;\n }\n\n #battery.critical:not(.charging) {\n background-color: #fb4934;\n color: #282828;\n }\n\n label:focus {\n background-color: #000000;\n }\n\n #cpu.high {\n background-color: #2ecc71;\n color: #000000;\n }\n\n #memory {\n background-color: #9b59b6;\n }\n\n #backlight {\n background-color: #90b1b1;\n }\n\n #pulseaudio {\n background-color: #f1c40f;\n color: #000000;\n }\n\n #pulseaudio.muted {\n background-color: #90b1b1;\n color: #2a5c45;\n }\n\n #custom-media {\n background-color: #66cc99;\n color: #2a5c45;\n min-width: 100px;\n }\n\n #custom-media.custom-spotify {\n background-color: #66cc99;\n }\n\n #custom-media.custom-vlc {\n background-color: #ffa000;\n }\n\n #temperature {\n background-color: #f0932b;\n }\n\n #temperature.critical {\n background-color: #eb4d4b;\n }\n\n #tray {\n padding: 0 3px;\n background-color: transparent;\n border-left: 1px solid #3c3836;\n }\n\n #tray menu {\n background-color: #282828;\n color: #ebdbb2;\n border: 1px solid #ebdbb2;\n padding: 0;\n margin: 10px;\n font-weight: bold;\n }\n\n #tray menu menuitem {\n border-bottom: 1px solid #3c3836;\n }\n\n #tray menu menuitem:last-child {\n border-bottom: none;\n }\n\n #tray menu menuitem:hover {\n background-color: #ebdbb2;\n color: #282828;\n }\n\n #idle_inhibitor {\n background-color: #2d3436;\n }\n\n #idle_inhibitor.activated {\n background-color: #ecf0f1;\n color: #2d3436;\n }\n\n #mpd {\n background-color: #66cc99;\n color: #2a5c45;\n }\n\n #mpd.disconnected {\n background-color: #f53c3c;\n }\n\n #mpd.stopped {\n background-color: #90b1b1;\n }\n\n #mpd.paused {\n background-color: #51a37a;\n }\n\n #language {\n background: #00b093;\n color: #740864;\n padding: 0 5px;\n margin: 0 5px;\n min-width: 16px;\n }\n "; + style = '' + * { + border: none; + border-radius: 0; + font-family: FiraCode Nerd Font; + font-size: 11px; + min-height: 20px; + } + + window#waybar { + background-color: #282828; + border-bottom: 1px solid #3c3836; + color: #ebdbb2; + } + + window#waybar.hidden { + opacity: 0.2; + } + + /* + window#waybar.empty { + background-color: transparent; + } + window#waybar.solo { + background-color: #FFFFFF; + } + */ + + #workspaces button { + padding: 0 5px; + background-color: transparent; + color: #3c3836; + font-weight: bolder; + min-width: 20px; + /* Use box-shadow instead of border so the text isn't offset */ + /* box-shadow: inset 0 -1px transparent; */ + } + + #workspaces button:hover { + background-color: #ebdbb2; + background-image: none; + color: #282828; + } + + #workspaces button.current_output { + color: #928374; + } + + #workspaces button.visible { + color: #282828; + background-color: #928374; + } + + #workspaces button.current_output.visible { + background-color: transparent; + color: #ebdbb2; + } + + #workspaces button.current_output.focused { + background-color: #ebdbb2; + color: #282828; + } + + #workspaces button.urgent { + background-color: #fb4934; + } + + #mode { + background-color: #fe8019; + color: #282828; + box-shadow: inset 0 -1px #d65d0e; + } + + #clock, + #battery, + #cpu, + #memory, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #mode, + #idle_inhibitor, + #mpd { + padding: 0 10px; + color: #ebdbb2; + } + + #clock.time { + font-weight: bolder; + padding-right: 2px; + } + + #clock.date { + padding-left: 2px; + } + + #window, + #workspaces { + margin: 0 4px; + } + + /* If workspaces is the leftmost module, omit left margin */ + .modules-left > widget:first-child > #workspaces { + margin-left: 0; + } + + /* If workspaces is the rightmost module, omit right margin */ + .modules-right > widget:last-child > #workspaces { + margin-right: 0; + } + + #battery { + background-color: transparent; + } + + #battery.warning:not(.charging) { + background-color: #fe8019; + color: #282828; + } + + #battery.critical:not(.charging) { + background-color: #fb4934; + color: #282828; + } + + label:focus { + background-color: #000000; + } + + #cpu.high { + background-color: #2ecc71; + color: #000000; + } + + #memory { + background-color: #9b59b6; + } + + #backlight { + background-color: #90b1b1; + } + + #pulseaudio { + background-color: #f1c40f; + color: #000000; + } + + #pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; + } + + #custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; + } + + #custom-media.custom-spotify { + background-color: #66cc99; + } + + #custom-media.custom-vlc { + background-color: #ffa000; + } + + #temperature { + background-color: #f0932b; + } + + #temperature.critical { + background-color: #eb4d4b; + } + + #tray { + padding: 0 3px; + background-color: transparent; + border-left: 1px solid #3c3836; + } + + #tray menu { + background-color: #282828; + color: #ebdbb2; + border: 1px solid #ebdbb2; + padding: 0; + margin: 10px; + font-weight: bold; + } + + #tray menu menuitem { + border-bottom: 1px solid #3c3836; + } + + #tray menu menuitem:last-child { + border-bottom: none; + } + + #tray menu menuitem:hover { + background-color: #ebdbb2; + color: #282828; + } + + #idle_inhibitor { + background-color: #2d3436; + } + + #idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; + } + + #mpd { + background-color: #66cc99; + color: #2a5c45; + } + + #mpd.disconnected { + background-color: #f53c3c; + } + + #mpd.stopped { + background-color: #90b1b1; + } + + #mpd.paused { + background-color: #51a37a; + } + + #language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; + } + ''; }; } diff --git a/pkgs/gruvbox-material-gtk.nix b/pkgs/gruvbox-material-gtk.nix new file mode 100644 index 0000000..ff44f85 --- /dev/null +++ b/pkgs/gruvbox-material-gtk.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchFromGitHub, hiDpi ? false }: + +let + lock = builtins.fromJSON (builtins.readFile ../flake.lock); + variant = + if hiDpi then "Gruvbox-Material-Dark-HIDPI" else "Gruvbox-Material-Dark"; +in stdenv.mkDerivation rec { + pname = lock.nodes.gruvbox-material-gtk.locked.repo; + version = lock.nodes.gruvbox-material-gtk.locked.rev; + + src = fetchFromGitHub { + owner = lock.nodes.gruvbox-material-gtk.locked.owner; + repo = lock.nodes.gruvbox-material-gtk.locked.repo; + rev = lock.nodes.gruvbox-material-gtk.locked.rev; + sha256 = lock.nodes.gruvbox-material-gtk.locked.narHash; + }; + + installPhase = '' + mkdir -p $out/share/themes/gruvbox-material + rm -rf README.md LICENSE demo.png icons + cp -r themes/${variant}/* $out/share/themes/gruvbox-material + ''; + + meta = with lib; { + description = "Gruvbox Material for GTK"; + homepage = "https://github.com/sainnhe/gruvbox-material-gtk"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ ]; + }; +} + diff --git a/pkgs/gruvbox-material-icons.nix b/pkgs/gruvbox-material-icons.nix new file mode 100644 index 0000000..cb84130 --- /dev/null +++ b/pkgs/gruvbox-material-icons.nix @@ -0,0 +1,46 @@ +{ lib, stdenv, fetchFromGitHub, gtk3, pantheon, breeze-icons, gnome-icon-theme +, hicolor-icon-theme }: + +let lock = builtins.fromJSON (builtins.readFile ../flake.lock); +in stdenv.mkDerivation rec { + pname = lock.nodes.gruvbox-material-gtk.locked.repo + "-icons"; + version = lock.nodes.gruvbox-material-gtk.locked.rev; + + src = fetchFromGitHub { + owner = lock.nodes.gruvbox-material-gtk.locked.owner; + repo = lock.nodes.gruvbox-material-gtk.locked.repo; + rev = lock.nodes.gruvbox-material-gtk.locked.rev; + sha256 = lock.nodes.gruvbox-material-gtk.locked.narHash; + }; + + nativeBuildInputs = [ gtk3 ]; + + propagatedBuildInputs = [ + pantheon.elementary-icon-theme + breeze-icons + gnome-icon-theme + hicolor-icon-theme + ]; + + dontDropIconThemeCache = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/icons + mv icons/* $out/share/icons + + for theme in $out/share/icons/*; do + gtk-update-icon-cache $theme + done + runHook postInstall + ''; + + meta = with lib; { + description = "Gruvbox Material for GTK - Icons"; + homepage = "https://github.com/sainnhe/gruvbox-material-gtk"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = [ ]; + }; +} +