From b06cb8ee3a9d03cee5758b80f682f5fd6044339a Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 31 Jul 2023 00:09:57 +0300 Subject: [PATCH] home: change default terminal to wezterm --- .../{terminal.nix => terminal/alacritty.nix} | 0 home/modules/terminal/wezterm.nix | 66 +++++++++++++++++++ home/modules/window_manager/xmonad_config.hs | 17 +++-- home/users/jan/home.nix | 3 +- home/users/nas/home.nix | 2 +- nixos/hosts/default.nix | 6 +- readme.md | 18 ++--- 7 files changed, 93 insertions(+), 19 deletions(-) rename home/modules/{terminal.nix => terminal/alacritty.nix} (100%) create mode 100644 home/modules/terminal/wezterm.nix diff --git a/home/modules/terminal.nix b/home/modules/terminal/alacritty.nix similarity index 100% rename from home/modules/terminal.nix rename to home/modules/terminal/alacritty.nix diff --git a/home/modules/terminal/wezterm.nix b/home/modules/terminal/wezterm.nix new file mode 100644 index 0000000..86fb257 --- /dev/null +++ b/home/modules/terminal/wezterm.nix @@ -0,0 +1,66 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.local.wezterm; + themeCfg = config.local.theme; +in +{ + options.local.wezterm = with lib; { + fontSize = mkOption { + type = types.number; + default = 11.0; + description = "Wezterm font size"; + }; + }; + + config = { + programs.wezterm = { + enable = true; + colorSchemes = { + myCoolTheme = { + ansi = [ + themeCfg.window.regular.color0 + themeCfg.window.regular.color1 + themeCfg.window.regular.color2 + themeCfg.window.regular.color3 + themeCfg.window.regular.color4 + themeCfg.window.regular.color5 + themeCfg.window.regular.color6 + themeCfg.window.regular.color7 + ]; + brights = [ + themeCfg.window.bold.color8 + themeCfg.window.bold.color9 + themeCfg.window.bold.color10 + themeCfg.window.bold.color11 + themeCfg.window.bold.color12 + themeCfg.window.bold.color13 + themeCfg.window.bold.color14 + themeCfg.window.bold.color15 + ]; + indexed = { + "16" = themeCfg.window.extended.color16; + "17" = themeCfg.window.extended.color17; + "18" = themeCfg.window.extended.color18; + "19" = themeCfg.window.extended.color19; + }; + background = themeCfg.window.background; + foreground = themeCfg.window.mainText; + cursor_bg = themeCfg.window.cursor; + cursor_border = themeCfg.window.cursor; + cursor_fg = themeCfg.window.cursorText; + selection_bg = themeCfg.window.selection; + selection_fg = themeCfg.window.selectionText; + }; + }; + extraConfig = '' + return { + font = wezterm.font("monospace"), + font_size = ${toString cfg.fontSize}, + color_scheme = "myCoolTheme", + hide_tab_bar_if_only_one_tab = true, + } + ''; + }; + }; +} diff --git a/home/modules/window_manager/xmonad_config.hs b/home/modules/window_manager/xmonad_config.hs index c2cbba2..57efef4 100644 --- a/home/modules/window_manager/xmonad_config.hs +++ b/home/modules/window_manager/xmonad_config.hs @@ -52,7 +52,7 @@ import XMonad.Util.Run -- The preferred terminal program, which is used in a binding below and by -- certain contrib modules. -- -myTerminal = "alacritty" +myTerminal = "wezterm start" -- Whether focus follows the mouse pointer. myFocusFollowsMouse = False @@ -230,12 +230,17 @@ myEventHook = mempty -- myManageHook = manageApps where + anyOf :: [Query Bool] -> Query Bool + anyOf = foldl (<||>) (pure False) + role = stringProperty "WM_WINDOW_ROLE" isPopup = role =? "pop-up" isPinentry = anyOf [className =? "Gcr-promter", className =? "Pinentry"] + + isWezterm = className =? "org.wezfurlong.wezterm" isAlacritty = className =? "Alacritty" - anyOf :: [Query Bool] -> Query Bool - anyOf = foldl (<||>) (pure False) + isTerminal = anyOf [isWezterm, isAlacritty] + tileBelow = insertPosition Below Newer manageApps = composeOne @@ -253,7 +258,7 @@ myManageHook = manageApps isPinentry ] -?> doCenterFloat, - isAlacritty -?> tileBelow + isTerminal -?> tileBelow ] ------------------------------------------------------------------------ @@ -404,9 +409,9 @@ myProjects = terminal' wd' cmd' = myTerminal ++ workdir ++ command where - workdir = " --working-directory " ++ wd' + workdir = " --cwd " ++ wd' command = case cmd' of - Just c -> " --command " ++ c + Just c -> " -- " ++ c _ -> "" myPromptConfig :: XPConfig diff --git a/home/users/jan/home.nix b/home/users/jan/home.nix index a42fa6e..4225b3c 100644 --- a/home/users/jan/home.nix +++ b/home/users/jan/home.nix @@ -6,7 +6,8 @@ ./git ../../modules/window_manager - ../../modules/terminal.nix + ../../modules/terminal/wezterm.nix + ../../modules/terminal/alacritty.nix ../../modules/shell.nix ../../modules/notifications diff --git a/home/users/nas/home.nix b/home/users/nas/home.nix index c2a3786..129311e 100644 --- a/home/users/nas/home.nix +++ b/home/users/nas/home.nix @@ -3,7 +3,7 @@ { imports = [ ../../modules/window_manager - ../../modules/terminal.nix + ../../modules/terminal/wezterm.nix ../../modules/shell.nix ../../modules/notifications diff --git a/nixos/hosts/default.nix b/nixos/hosts/default.nix index 235d8cd..f396f2d 100644 --- a/nixos/hosts/default.nix +++ b/nixos/hosts/default.nix @@ -19,7 +19,8 @@ in extraHomeModule = { ... }: { local.polybar.wifiDevice = "wlp11s0f3u2"; - local.alacritty.fontSize = 8.0; + # local.alacritty.fontSize = 8.0; + local.wezterm.fontSize = 11.0; }; }; @@ -36,7 +37,8 @@ in extraHomeModule = { ... }: { local.polybar.wifiDevice = "wlp2s0"; - local.alacritty.fontSize = 6.0; + # local.alacritty.fontSize = 6.0; + local.wezterm.fontSize = 9.0; }; }; diff --git a/readme.md b/readme.md index 09e516c..6786f09 100644 --- a/readme.md +++ b/readme.md @@ -30,15 +30,15 @@ User configurations are included. ### Core Programs -| Type | Program | -| :------------- | :-------- | -| Status Bar | Polybar | -| Window Manager | XMonad | -| Launcher | Dmenu | -| Terminal | Alacritty | -| Editor | Neovim | -| File Manager | vifm | -| Shell | Zsh | +| Type | Program | +| :------------- | :------ | +| Status Bar | Polybar | +| Window Manager | XMonad | +| Launcher | Dmenu | +| Terminal | Wezterm | +| Editor | Neovim | +| File Manager | vifm | +| Shell | Zsh | ### Screenshots