mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 09:28:27 +02:00
fix: wezterm on darwin
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
{
|
{pkgs, ...}:
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
###########################################################
|
###########################################################
|
||||||
#
|
#
|
||||||
# Wezterm Configuration
|
# Wezterm Configuration
|
||||||
@@ -13,72 +10,86 @@
|
|||||||
# wezterm has catppuccin theme built-in,
|
# wezterm has catppuccin theme built-in,
|
||||||
# it's not necessary to install it separately.
|
# it's not necessary to install it separately.
|
||||||
|
|
||||||
programs.wezterm = {
|
programs.wezterm =
|
||||||
enable = true;
|
{
|
||||||
package = if pkgs.stdenv.isDarwin
|
enable = true;
|
||||||
then
|
|
||||||
pkgs.hello # install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
|
||||||
else
|
|
||||||
pkgs.wezterm;
|
|
||||||
|
|
||||||
extraConfig =
|
extraConfig = let
|
||||||
let
|
fontsize =
|
||||||
fontsize = if pkgs.stdenv.isDarwin then "14.0" else "13.0";
|
if pkgs.stdenv.isDarwin
|
||||||
|
then "14.0"
|
||||||
|
else "13.0";
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
-- Pull in the wezterm API
|
-- Pull in the wezterm API
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
|
|
||||||
-- This table will hold the configuration.
|
-- This table will hold the configuration.
|
||||||
local config = {}
|
local config = {}
|
||||||
|
|
||||||
-- In newer versions of wezterm, use the config_builder which will
|
-- In newer versions of wezterm, use the config_builder which will
|
||||||
-- help provide clearer error messages
|
-- help provide clearer error messages
|
||||||
if wezterm.config_builder then
|
if wezterm.config_builder then
|
||||||
config = wezterm.config_builder()
|
config = wezterm.config_builder()
|
||||||
end
|
|
||||||
|
|
||||||
wezterm.on('toggle-opacity', function(window, pane)
|
|
||||||
local overrides = window:get_config_overrides() or {}
|
|
||||||
if not overrides.window_background_opacity then
|
|
||||||
overrides.window_background_opacity = 0.93
|
|
||||||
else
|
|
||||||
overrides.window_background_opacity = nil
|
|
||||||
end
|
end
|
||||||
window:set_config_overrides(overrides)
|
|
||||||
end)
|
|
||||||
|
|
||||||
wezterm.on('toggle-maximize', function(window, pane)
|
wezterm.on('toggle-opacity', function(window, pane)
|
||||||
window:maximize()
|
local overrides = window:get_config_overrides() or {}
|
||||||
end)
|
if not overrides.window_background_opacity then
|
||||||
|
overrides.window_background_opacity = 0.93
|
||||||
|
else
|
||||||
|
overrides.window_background_opacity = nil
|
||||||
|
end
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end)
|
||||||
|
|
||||||
-- This is where you actually apply your config choices
|
wezterm.on('toggle-maximize', function(window, pane)
|
||||||
config.color_scheme = "Catppuccin Mocha"
|
window:maximize()
|
||||||
config.font = wezterm.font("JetBrainsMono Nerd Font")
|
end)
|
||||||
config.hide_tab_bar_if_only_one_tab = true
|
|
||||||
config.scrollback_lines = 10000
|
|
||||||
config.enable_scroll_bar = true
|
|
||||||
|
|
||||||
config.keys = {
|
|
||||||
-- toggle opacity(CTRL + SHIFT + B)
|
|
||||||
{
|
|
||||||
key = 'B',
|
|
||||||
mods = 'CTRL',
|
|
||||||
action = wezterm.action.EmitEvent 'toggle-opacity',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key = 'M',
|
|
||||||
mods = 'CTRL',
|
|
||||||
action = wezterm.action.EmitEvent 'toggle-maximize',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
config.font_size = ${fontsize}
|
-- This is where you actually apply your config choices
|
||||||
'' + (if pkgs.stdenv.isDarwin then ''
|
config.color_scheme = "Catppuccin Mocha"
|
||||||
-- Spawn a fish shell in login mod
|
config.font = wezterm.font("JetBrainsMono Nerd Font")
|
||||||
config.default_prog = { '/run/current-system/sw/bin/nu', '-l' }
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
'' else "") + ''
|
config.scrollback_lines = 10000
|
||||||
return config
|
config.enable_scroll_bar = true
|
||||||
'';
|
|
||||||
};
|
config.keys = {
|
||||||
|
-- toggle opacity(CTRL + SHIFT + B)
|
||||||
|
{
|
||||||
|
key = 'B',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-opacity',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = 'M',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-maximize',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
config.font_size = ${fontsize}
|
||||||
|
''
|
||||||
|
+ (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then ''
|
||||||
|
-- Spawn a fish shell in login mod
|
||||||
|
config.default_prog = { '/run/current-system/sw/bin/nu', '-l' }
|
||||||
|
''
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
+ ''
|
||||||
|
return config
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
// (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then {
|
||||||
|
# install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
||||||
|
package = pkgs.hello;
|
||||||
|
enableBashIntegration = false;
|
||||||
|
enableZshIntegration = false;
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user