Skip to content

Commit

Permalink
[alacritty] Symlink theme based on system appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed May 30, 2024
1 parent 3e8e0f7 commit 5a723ca
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions home.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:

{
# This value determines the Home Manager release that your configuration is
Expand Down Expand Up @@ -48,7 +48,7 @@
programs.alacritty = {
enable = true;
settings = {
import = [ "${pkgs.alacritty-theme}/solarized_light.yaml" ];
import = [ "~/.config/alacritty/theme.yml" ];
font.normal = {
family = "FiraCode Nerd Font Mono";
style = "Medium";
Expand Down Expand Up @@ -89,4 +89,17 @@
programs.starship.enable = true;

programs.zoxide.enable = true;

home.activation.alacrittyTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
theme() {
local style=$(/usr/bin/defaults read -g AppleInterfaceStyle 2> /dev/null || echo "Light")
if [ "$style" == "Dark" ]; then
echo "${pkgs.alacritty-theme}/solarized_dark.yaml"
else
echo "${pkgs.alacritty-theme}/solarized_light.yaml"
fi
}
ln -sf "$(theme)" ~/.config/alacritty/theme.yml
'';
}

0 comments on commit 5a723ca

Please sign in to comment.