wezterm: leverage programs.wezterm.settings attribute set (#2274)
Closes: https://github.com/nix-community/stylix/issues/2272 Link: https://github.com/nix-community/stylix/pull/2274 Reviewed-by: 0xda157 <da157@voidq.com> Reviewed-by: Noah Biewesch <dev@noahbiewesch.com>
This commit is contained in:
parent
2d8e4ce4b1
commit
1cec7e0c18
1 changed files with 46 additions and 104 deletions
|
|
@ -1,15 +1,5 @@
|
|||
{
|
||||
mkTarget,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{ mkTarget, lib, ... }:
|
||||
mkTarget {
|
||||
options.luaBody = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
internal = true;
|
||||
};
|
||||
config = [
|
||||
(
|
||||
{ colors }:
|
||||
|
|
@ -71,117 +61,69 @@ mkTarget {
|
|||
};
|
||||
};
|
||||
};
|
||||
stylix.targets.wezterm.luaBody = ''
|
||||
color_scheme = "stylix",
|
||||
programs.wezterm.settings = {
|
||||
color_scheme = "stylix";
|
||||
window_frame = {
|
||||
active_titlebar_bg = "${base03}",
|
||||
active_titlebar_fg = "${base05}",
|
||||
active_titlebar_border_bottom = "${base03}",
|
||||
border_left_color = "${base01}",
|
||||
border_right_color = "${base01}",
|
||||
border_bottom_color = "${base01}",
|
||||
border_top_color = "${base01}",
|
||||
button_bg = "${base01}",
|
||||
button_fg = "${base05}",
|
||||
button_hover_bg = "${base05}",
|
||||
button_hover_fg = "${base03}",
|
||||
inactive_titlebar_bg = "${base01}",
|
||||
inactive_titlebar_fg = "${base05}",
|
||||
inactive_titlebar_border_bottom = "${base03}",
|
||||
},
|
||||
active_titlebar_bg = base03;
|
||||
active_titlebar_fg = base05;
|
||||
active_titlebar_border_bottom = base03;
|
||||
border_left_color = base01;
|
||||
border_right_color = base01;
|
||||
border_bottom_color = base01;
|
||||
border_top_color = base01;
|
||||
button_bg = base01;
|
||||
button_fg = base05;
|
||||
button_hover_bg = base05;
|
||||
button_hover_fg = base03;
|
||||
inactive_titlebar_bg = base01;
|
||||
inactive_titlebar_fg = base05;
|
||||
inactive_titlebar_border_bottom = base03;
|
||||
};
|
||||
colors = {
|
||||
tab_bar = {
|
||||
background = "${base01}",
|
||||
inactive_tab_edge = "${base01}",
|
||||
background = base01;
|
||||
inactive_tab_edge = base01;
|
||||
active_tab = {
|
||||
bg_color = "${base00}",
|
||||
fg_color = "${base05}",
|
||||
},
|
||||
bg_color = base00;
|
||||
fg_color = base05;
|
||||
};
|
||||
inactive_tab = {
|
||||
bg_color = "${base03}",
|
||||
fg_color = "${base05}",
|
||||
},
|
||||
bg_color = base03;
|
||||
fg_color = base05;
|
||||
};
|
||||
inactive_tab_hover = {
|
||||
bg_color = "${base05}",
|
||||
fg_color = "${base00}",
|
||||
},
|
||||
bg_color = base05;
|
||||
fg_color = base00;
|
||||
};
|
||||
new_tab = {
|
||||
bg_color = "${base03}",
|
||||
fg_color = "${base05}",
|
||||
},
|
||||
bg_color = base03;
|
||||
fg_color = base05;
|
||||
};
|
||||
new_tab_hover = {
|
||||
bg_color = "${base05}",
|
||||
fg_color = "${base00}",
|
||||
},
|
||||
},
|
||||
},
|
||||
command_palette_bg_color = "${base01}",
|
||||
command_palette_fg_color = "${base05}",
|
||||
'';
|
||||
bg_color = base05;
|
||||
fg_color = base00;
|
||||
};
|
||||
};
|
||||
};
|
||||
command_palette_bg_color = base01;
|
||||
command_palette_fg_color = base05;
|
||||
};
|
||||
}
|
||||
)
|
||||
(
|
||||
{ fonts }:
|
||||
{
|
||||
stylix.targets.wezterm.luaBody = ''
|
||||
font = wezterm.font_with_fallback {
|
||||
"${fonts.monospace.name}",
|
||||
"${fonts.emoji.name}",
|
||||
},
|
||||
font_size = ${toString fonts.sizes.terminal},
|
||||
command_palette_font_size = ${toString fonts.sizes.popups},
|
||||
'';
|
||||
programs.wezterm.settings = {
|
||||
font = lib.generators.mkLuaInline ''wezterm.font_with_fallback { "${fonts.monospace.name}", "${fonts.emoji.name}" }'';
|
||||
font_size = fonts.sizes.terminal;
|
||||
command_palette_font_size = fonts.sizes.popups;
|
||||
};
|
||||
}
|
||||
)
|
||||
(
|
||||
{ opacity }:
|
||||
{
|
||||
stylix.targets.wezterm.luaBody = "window_background_opacity = ${toString opacity.terminal},";
|
||||
}
|
||||
)
|
||||
(
|
||||
{ cfg }:
|
||||
let
|
||||
indent =
|
||||
string: " " + lib.concatStringsSep "\n " (lib.splitString "\n" string);
|
||||
in
|
||||
{
|
||||
xdg.configFile."wezterm/wezterm.lua" =
|
||||
lib.mkIf (config.programs.wezterm.enable && cfg.luaBody != "")
|
||||
{
|
||||
text = lib.mkForce (
|
||||
lib.concatLines [
|
||||
''
|
||||
-- Generated by Stylix
|
||||
local wezterm = require("wezterm")
|
||||
wezterm.add_to_config_reload_watch_list(wezterm.config_dir)
|
||||
-- Allow working with both the current release and the nightly
|
||||
local config = {}
|
||||
if wezterm.config_builder then
|
||||
config = wezterm.config_builder()
|
||||
end
|
||||
local stylix_base_config = {
|
||||
''
|
||||
(indent cfg.luaBody)
|
||||
''
|
||||
}
|
||||
for key, value in pairs(stylix_base_config) do
|
||||
config[key] = value
|
||||
end
|
||||
local function stylix_wrapped_config()
|
||||
${config.programs.wezterm.extraConfig}
|
||||
end
|
||||
local stylix_user_config = stylix_wrapped_config()
|
||||
if stylix_user_config then
|
||||
for key, value in pairs(stylix_user_config) do
|
||||
config[key] = value
|
||||
end
|
||||
end
|
||||
return config
|
||||
''
|
||||
]
|
||||
);
|
||||
};
|
||||
programs.wezterm.settings.window_background_opacity = opacity.terminal;
|
||||
}
|
||||
)
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue