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

@ -31,9 +31,6 @@ function M.setup()
-- Set leader
helpers.global("mapleader", "<Space>")
-- Set theme
-- require('github-theme').setup({theme_style = "light", dark_float = true, transparent = true})
end
return M

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"

View file

@ -1,5 +1,5 @@
{ lib, ... }: {
mergeLines = (lines: lib.foldr
mergeLines = (lines: lib.lists.foldr
(a: b: ''
${a}
${b}

View file

@ -11,7 +11,6 @@
, fish-theme-dangerous
, oh-my-fish
, githubNvimTheme
, vim-extra-plugins
, vim-plugin-arpeggio
, telescope-file-browser-nvim
, sddm-theme-chili

View file

@ -1,29 +1,32 @@
variant: { pkgs, ... }: {
{ variant, transparency ? 1 }: { pkgs, ... }:
let
githubTheme = pkgs.myVimPlugins.githubNvimTheme; # github theme for neovim
in
{
name = "github-${variant}";
neovim = {
plugins = [
pkgs.myVimPlugins.github-nvim-theme # github theme for neovim
];
plugins = [ pkgs.vimExtraPlugins.github-nvim-theme ];
theme = ''
require('github-theme').setup({theme_style = "light", dark_float = true, transparent = true})
require('github-theme').setup({theme_style = "${variant}", dark_float = true, transparent = true})
'';
lualineTheme = "github";
};
tmux.path = "${pkgs.githubNvimTheme}/terminal/tmux/github_light.conf";
tmux.path = "${githubTheme}/terminal/tmux/github_${variant}.conf";
alacritty.settings = {
import = [ "${pkgs.githubNvimTheme}/terminal/alacritty/github_light.yml" ];
import = [ "${githubTheme}/terminal/alacritty/github_${variant}.yml" ];
window = {
padding = {
x = 8;
y = 8;
};
# transparent bg:)
background_opacity = 0.8;
gtk_theme_variant = "light";
gtk_theme_variant = if variant == "light" then "light" else "dark";
};
# transparent bg:)
background_opacity = transparency;
};
}

View file

@ -1,9 +1,7 @@
{ pkgs }:
{ pkgs, lib, ... }:
let githubVariant = import ./githubVariant.nix;
in
lib.map (theme: pkgs.callPackage theme { }) [
githubVariant
"light"
githubVariant
"dark"
lib.lists.map (theme: pkgs.callPackage theme { }) [
(githubVariant { variant = "light"; })
(githubVariant { variant = "dark"; transparency = 0.8; })
]