Browse Source

Add 'dotfiles-theme' shell command via nix package

main
parent
commit
19eb77ae45
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 29
      README.org
  2. 20
      bin/dotfiles-theme
  3. 3
      modules/emacs.nix

29
README.org

@ -1,4 +1,4 @@
:PROPERTIES:
:iROPERTIES:
:ID: e4ad3dd5-0996-45bc-92ab-6bdbf16e4310 :ID: e4ad3dd5-0996-45bc-92ab-6bdbf16e4310
:ROAM_REFS: https://chrishayward.xyz/dotfiles/ :ROAM_REFS: https://chrishayward.xyz/dotfiles/
:END: :END:
@ -1642,6 +1642,7 @@ in {
<<emacs-desktop-extras>> <<emacs-desktop-extras>>
<<emacs-plantuml-extras>> <<emacs-plantuml-extras>>
<<emacs-nix-mode-extras>> <<emacs-nix-mode-extras>>
<<emacs-doom-themes-extras>>
]; ];
programs.emacs = { programs.emacs = {
@ -3069,6 +3070,32 @@ epkgs.doom-themes
"tt" '(counsel-load-theme :which-key "Theme")) "tt" '(counsel-load-theme :which-key "Theme"))
#+END_SRC #+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 ** Doom Modeline
#+NAME: emacs-doom-modeline-package #+NAME: emacs-doom-modeline-package

20
bin/dotfiles-theme

@ -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/"$//'

3
modules/emacs.nix

@ -80,6 +80,9 @@ in {
pkgs.brightnessctl pkgs.brightnessctl
pkgs.plantuml pkgs.plantuml
pkgs.nixfmt 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 = { programs.emacs = {

Loading…
Cancel
Save