diff options
author | Profpatsch <mail@profpatsch.de> | 2024-12-05T18·11+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2024-12-10T15·34+0000 |
commit | 6477428c36aa7fdb23cca2c2668659e1678f3b73 (patch) | |
tree | 02dde96216bd0218706a17285adf5e7a921afba7 /users/Profpatsch/alacritty.nix | |
parent | 22c46c80093948aa2490220608f188d1691c8ad0 (diff) |
feat(pkgs/Profpatsch/alacritty): init dark mode dbus daemon r/8996
A simple dbus daemon that writes the alacritty config to `~/.config/alacritty/alacritty-colors-autogen.toml` on startup and whenever a change between dark/light mode is requested. Alacritty only implements an config file isync watcher, no SIGHUP handler or similar, so we have to actually write the config file lol. This is all a little glue-y, but idk, whatever. Further reading & inspo: https://github.com/alacritty/alacritty/issues/5999 https://www.christianfosli.com/posts/2024-on-colorscheme-changed/ https://github.com/christianfosli/on-colorscheme-changed Change-Id: Iac4eb9d85679dc87e28e57d68384645b3b91d08a Reviewed-on: https://cl.tvl.fyi/c/depot/+/12870 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/alacritty.nix')
-rw-r--r-- | users/Profpatsch/alacritty.nix | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/users/Profpatsch/alacritty.nix b/users/Profpatsch/alacritty.nix index d3461c4aadfb..05300580e34c 100644 --- a/users/Profpatsch/alacritty.nix +++ b/users/Profpatsch/alacritty.nix @@ -3,25 +3,53 @@ let bins = depot.nix.getBins pkgs.alacritty [ "alacritty" ]; + # https://github.com/alacritty/alacritty-theme + themes = { + # dark = "alacritty_0_12"; + dark = "google"; + light = "dayfox"; + }; + config = { - alacritty-config = { font.size = 18; scrolling.history = 100000; }; + config = { + # sets the theme for this config (autogenerated file) + general.import = [ "~/.config/alacritty/alacritty-colors-autogen.toml" ]; + font.size = 18; + scrolling.history = 100000; + }; # This disables the dpi-sensitive scaling (cause otherwise the font will be humongous on my laptop screen) alacritty-env.WINIT_X11_SCALE_FACTOR = 1; }; - - config-file = (pkgs.formats.toml { }).generate "alacritty.conf" config.alacritty-config; - alacritty = depot.nix.writeExecline "alacritty" { } ( (lib.concatLists (lib.mapAttrsToList (k: v: [ "export" k (toString v) ]) config.alacritty-env)) ++ [ + "backtick" + "-E" + "config" + [ depot.users.Profpatsch.xdg-config-home ] + bins.alacritty "--config-file" - config-file + ((pkgs.formats.toml { }).generate "alacritty.conf" config.config) "$@" ] ); + alacritty-themes = pkgs.fetchFromGitHub { + owner = "alacritty"; + repo = "alacritty-theme"; + rev = "95a7d695605863ede5b7430eb80d9e80f5f504bc"; + sha256 = "sha256-D37MQtNS20ESny5UhW1u6ELo9czP4l+q0S8neH7Wdbc="; + }; + + in -alacritty +{ + inherit + alacritty + alacritty-themes + themes; + +} |