From 19eb77ae450dffa2db2f4933163a6fc3196493c8 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Mon, 27 Sep 2021 09:35:10 -0400 Subject: [PATCH] Add 'dotfiles-theme' shell command via nix package --- README.org | 29 ++++++++++++++++++++++++++++- bin/dotfiles-theme | 20 -------------------- modules/emacs.nix | 3 +++ 3 files changed, 31 insertions(+), 21 deletions(-) delete mode 100755 bin/dotfiles-theme diff --git a/README.org b/README.org index 70a0c53..4162098 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,4 @@ -:PROPERTIES: +:iROPERTIES: :ID: e4ad3dd5-0996-45bc-92ab-6bdbf16e4310 :ROAM_REFS: https://chrishayward.xyz/dotfiles/ :END: @@ -1642,6 +1642,7 @@ in { <> <> <> + <> ]; programs.emacs = { @@ -3069,6 +3070,32 @@ epkgs.doom-themes "tt" '(counsel-load-theme :which-key "Theme")) #+END_SRC +Create a shell command that returns a JSON string of the current theme in the following format: + +#+BEGIN_SRC json +{ + "bg": "#272C36", + "bg-alt": "#2E3440", + "fg": "#ECEFF4", + "fg-alt": "#6f7787", + "red": "#BF616A", + "orange": "#EBCB8B", + "yellow": "#81A1C1", + "green": "#A3BE8C", + "cyan": "#81A1C1", + "blue": "#81A1C1", + "violet": "#81A1C1", + "magenta": "#81A1C1" +} +#+END_SRC + +#+NAME: emacs-doom-themes-extras +#+BEGIN_SRC nix +(pkgs.writeShellScriptBin "dotfiles-theme" '' + ${myEmacs}/bin/emacsclient --no-wait --eval '(json-encode (dotfiles/theme))' | sed "s/\\\\//g" | sed -e 's/^"//' -e 's/"$//' +'') +#+END_SRC + ** Doom Modeline #+NAME: emacs-doom-modeline-package diff --git a/bin/dotfiles-theme b/bin/dotfiles-theme deleted file mode 100755 index c592231..0000000 --- a/bin/dotfiles-theme +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env sh - -# Returns a JSON string of the current system theme. -# Example: -# { -# "bg": "#272C36", -# "bg-alt": "#2E3440", -# "fg": "#ECEFF4", -# "fg-alt": "#6f7787", -# "red": "#BF616A", -# "orange": "#EBCB8B", -# "yellow": "#81A1C1", -# "green": "#A3BE8C", -# "cyan": "#81A1C1", -# "blue": "#81A1C1", -# "violet": "#81A1C1", -# "magenta": "#81A1C1" -# } - -emacsclient --no-wait --eval '(json-encode (dotfiles/theme))' | sed "s/\\\\//g" | sed -e 's/^"//' -e 's/"$//' diff --git a/modules/emacs.nix b/modules/emacs.nix index 2941332..0b30fc2 100644 --- a/modules/emacs.nix +++ b/modules/emacs.nix @@ -80,6 +80,9 @@ in { pkgs.brightnessctl pkgs.plantuml pkgs.nixfmt + (pkgs.writeShellScriptBin "dotfiles-theme" '' + ${myEmacs}/bin/emacsclient --no-wait --eval '(json-encode (dotfiles/theme))' | sed "s/\\\\//g" | sed -e 's/^"//' -e 's/"$//' + '') ]; programs.emacs = {