1
Fork 0

feat: useless feature which makes the theme change based on an env var

This commit is contained in:
Matei Adriel 2022-03-11 00:49:44 +02:00
parent 2757c649b9
commit a27b90af9e
10 changed files with 48 additions and 37 deletions

View file

@ -4,14 +4,16 @@ let
themes = pkgs.myThemes;
createTheme = (theme: {
xdg.configFile."alacritty/themes/${theme.name}.yml".text = builtins.toJSON
(lib.attrs.recursiveUpdate theme.alacritty.settings {
import = [ "~/.config/alacritty/alacritty.yml" ];
});
xdg.configFile."alacritty/themes/${theme.name}.yml".text =
builtins.toJSON
(lib.attrsets.recursiveUpdate theme.alacritty.settings {
import = theme.alacritty.settings.import ++ [ "~/.config/alacritty/alacritty.yml" ];
});
});
createThemeConfigs = lib.lists.foldr
(acc: theme: lib.attrs.recursiveUpdate acc (createTheme theme))
(theme: acc: lib.attrsets.recursiveUpdate acc (createTheme theme)
)
{ }
themes;
in

View file

@ -11,7 +11,7 @@ let
themePlugins = lib.lists.concatMap (theme: theme.neovim.plugins) themes;
loadTheme = (theme: ''
if currentTheme = "${theme.name}" then
if currentTheme == "${theme.name}" then
${theme.neovim.theme}
vim.g.lualineTheme = ${theme.neovim.lualineTheme}
@ -19,12 +19,12 @@ let
'');
loadThemes = ''
lua << EOF
local currentTheme = os.getenv("THEME");
${pkgs.myHelpers.mergeLines (lib.lists.forEach themes loadTheme)};
EOF
'';
in
{
home-manager.users.adrielus.programs.neovim = {
@ -32,6 +32,7 @@ in
package = pkgs.neovim-nightly;
extraConfig = ''
${loadThemes}
luafile ${config-nvim}/init.lua
'';
@ -57,7 +58,7 @@ in
];
plugins = with pkgs.vimPlugins;
with pkgs.vimExtraPlugins; with pkgs.myVimPlugins; themePlugins + [
with pkgs.vimExtraPlugins; with pkgs.myVimPlugins; themePlugins ++ [
config-nvim # my neovim config
nvim-lspconfig # configures lsps for me
nvim-autopairs # close pairs for me

View file

@ -24,5 +24,5 @@
# Render git repo using gource
"git-render" = "gource -f -s 1 -c 4 --key";
alacritty = "alacritty --config-file $XDG_CONFIG_HOME/alacritty/themes/$THEME.yml";
alacritty = "alacritty --config-file ~/.config/alacritty/themes/$THEME.yml";
}

View file

@ -1,6 +1,7 @@
{ ... }:
with import ../../../secrets.nix;
let
theme = "github-dark";
variables = {
# Configure github cli
GITHUB_USERNAME = "Mateiadrielrafael";
@ -10,7 +11,10 @@ let
EDITOR = "nvim";
# Sets the current theme used by all programs
THEME = "github-light";
THEME = theme;
# Common command for launching alacritty with the correct theme
# LAUNCH_ALACRITTY = "alacritty --config-file ~/.config/alacritty/themes/$THEME.yml";
};
in
{

View file

@ -1,7 +1,11 @@
{-# LANGUAGE BlockArguments #-}
import System.Environment
import System.Process
import Control.Monad (join)
import Data.Function ((&))
import XMonad
import XMonad.Actions.SpawnOn
import XMonad.Config (defaultConfig)
@ -71,6 +75,9 @@ main =
manageWorkspaces
]
spawnTerminal = do
spawn "fish -c 'alacritty --config-file ~/.config/alacritty/themes/$THEME.yml'"
myTerminal = "alacritty"
myBrowser = "google-chrome-stable"
@ -78,9 +85,8 @@ main =
keymap =
[ ("M-p", spawn "rofi -show run"),
("M-g", spawn myBrowser),
("M-d", spawn "Discord"),
("M-s", spawn "slack"),
("M-r", spawn "ksysgurad")
("M-s", spawnTerminal),
("M-d", spawn "Discord")
]
uniformBorder = join $ join $ join Border
@ -95,8 +101,9 @@ main =
startup :: X ()
startup = do
spawn "xwallpaper --zoom ./picutres/portal.png"
spawn "xwallpaper --zoom ./background.jpg"
-- spawn "Discord"
-- spawn "google-chrome-stable"
-- spawn "alacritty"