zsh: Automatically set color scheme at init
This commit is contained in:
parent
aef0baf527
commit
a67ec1b22f
|
@ -1,4 +1,4 @@
|
|||
{ lib, pkgs, ... }:
|
||||
{ lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
dircolors-solarized = pkgs.fetchFromGitHub {
|
||||
owner = "seebi";
|
||||
|
@ -8,6 +8,14 @@ let
|
|||
|
||||
meta.license = lib.licenses.mit;
|
||||
};
|
||||
|
||||
# automatically set color scheme based on sun with dynamic-colors
|
||||
dcauto =
|
||||
let
|
||||
latitude = (toString nixosConfig.location.latitude) + (if nixosConfig.location.latitude > 0 then "N" else "S");
|
||||
longitude = (toString nixosConfig.location.longitude) + (if nixosConfig.location.longitude > 0 then "E" else "W");
|
||||
in
|
||||
"${pkgs.sunwait}/bin/sunwait poll civil ${latitude} ${longitude} | grep -qE '^DAY$' && dynamic-colors switch solarized-light || dynamic-colors switch solarized-dark";
|
||||
in
|
||||
{
|
||||
programs = {
|
||||
|
@ -53,6 +61,7 @@ in
|
|||
];
|
||||
shellAliases = {
|
||||
cp = "cp --reflink=auto"; # TODO: remove with coreutils > 8.32
|
||||
dcauto = dcauto;
|
||||
dcsd = "dynamic-colors switch solarized-dark";
|
||||
dcsl = "dynamic-colors switch solarized-light";
|
||||
exa = "exa --git --binary";
|
||||
|
@ -66,6 +75,10 @@ in
|
|||
vim = "nvim";
|
||||
vimdiff = "nvim -d";
|
||||
};
|
||||
initExtraFirst = ''
|
||||
# automatic color scheme
|
||||
${dcauto}
|
||||
'';
|
||||
initExtra = lib.mkMerge [
|
||||
(lib.mkBefore ''
|
||||
prompt off # collides with starship
|
||||
|
|
Loading…
Reference in a new issue