[user/malte] Improve kakoune theme

This commit is contained in:
Malte Tammena 2022-05-14 15:15:32 +02:00
parent 4147672f16
commit 11f606f0dd

View file

@ -166,27 +166,41 @@
lightModeConfig = let
bg62 = col.bg.rgbWithAlpha 0.62;
fg1 = col.light1.rgb;
in ''
in pkgs.writeText "lightmoderc" ''
colorscheme gruvbox-light
face global PrimarySelection rgba:${bg62},rgba:8ec07c40
face global SecondarySelection rgba:${bg62},rgba:83a59840
face global MatchingChar rgb:${col.bg.rgb},rgb:${fg1}+bf
face global Reference rgb:${fg1}
face global Information Default
remove-hooks global theme
# FZF
hook global -group theme ModuleLoaded fzf %{
set-option global fzf_default_opts '--color=light,gutter:-1'
}
try %{ set-option global fzf_default_opts '--color=light,gutter:-1' }
'';
darkModeConfig = let
fg62 = col.fg.rgbWithAlpha 0.62;
bg1 = col.dark1.rgb;
in ''
in pkgs.writeText "darkmoderc" ''
colorscheme gruvbox-dark
face global PrimarySelection rgba:${fg62},rgba:8ec07c40
face global SecondarySelection rgba:${fg62},rgba:83a59840
face global MatchingChar rgb:${col.fg.rgb},rgb:${bg1}+bf
face global Reference rgb:${bg1}
'';
linkTheme = theme: ''
ln -sf ~/${config.xdg.configFile."kak/${theme}".target} ${currentThemeFile}
face global Information Default
remove-hooks global theme
# FZF
hook global -group theme ModuleLoaded fzf %{
set-option global fzf_default_opts '--color=dark,gutter:-1'
}
try %{ set-option global fzf_default_opts '--color=dark,gutter:-1' }
'';
currentThemeFile = "${configDir}/theme";
linkTheme = theme: ''
ln -sf ${theme} ${currentThemeFile}
'';
# Configuration for kakoune LSP
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -336,29 +350,27 @@ in {
};
xdg.configFile."kak-lsp/kak-lsp.toml".source = kakLspConfigGen.generate "kak-lsp.toml" kakLspConfig;
xdg.configFile."kak/light-moderc".text = lightModeConfig;
xdg.configFile."kak/dark-moderc".text = darkModeConfig;
services.darkman.scripts."kakoune.sh" = {
onLight = pkgs.writeScript "kakoune-light" ''
#!${pkgs.runtimeShell}
for id in $(${kakBin} -l); do
echo 'source ~/${config.xdg.configFile."kak/light-moderc".target}' | ${kakBin} -p $id
echo 'source ${lightModeConfig}' | ${kakBin} -p $id
done
${linkTheme "light-moderc"}
${linkTheme lightModeConfig}
'';
onDark = pkgs.writeScript "kakoune-dark" ''
#!${pkgs.runtimeShell}
for id in $(${kakBin} -l); do
echo 'source ~/${config.xdg.configFile."kak/dark-moderc".target}' | ${kakBin} -p $id
echo 'source ${darkModeConfig}' | ${kakBin} -p $id
done
${linkTheme "dark-moderc"}
${linkTheme darkModeConfig}
'';
initialize = pkgs.writeScript "kakoune-initialize" ''
# Create the folder
mkdir -p ${configDir}
if [[ ! -e ${configDir}/${currentThemeFile} ]]; then
${linkTheme "light-moderc"}
if [[ ! -e ${currentThemeFile} ]]; then
${linkTheme lightModeConfig}
fi
'';
};