replace kitty with wezterm on linux (tempest)

This commit is contained in:
Noah Masur 2024-06-23 08:54:30 -04:00
parent cf19085158
commit 2f39eb2ceb
No known key found for this signature in database
5 changed files with 206 additions and 196 deletions

View File

@ -112,6 +112,7 @@ inputs.nixpkgs.lib.nixosSystem {
mullvad.enable = false; mullvad.enable = false;
rust.enable = true; rust.enable = true;
terraform.enable = true; terraform.enable = true;
wezterm.enable = true;
yt-dlp.enable = true; yt-dlp.enable = true;
gaming = { gaming = {
dwarf-fortress.enable = true; dwarf-fortress.enable = true;

View File

@ -22,7 +22,7 @@
environment = environment =
{ } { }
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) { // lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty"; sessionVariables.ROFI_SYSTEMD_TERM = lib.mkDefault "${pkgs.kitty}/bin/kitty";
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
@ -31,7 +31,7 @@
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty"; xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
# Set the Rofi terminal for running programs # Set the Rofi terminal for running programs
programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty"; programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
# Display images in the terminal # Display images in the terminal
programs.fish.shellAliases = { programs.fish.shellAliases = {

View File

@ -15,216 +15,220 @@
}; };
}; };
config = lib.mkIf (config.gui.enable && config.wezterm.enable) { config =
let
font = config.home-manager.users.${config.user}.programs.kitty.font.name;
in
lib.mkIf (config.gui.enable && config.wezterm.enable) {
# Set the Rofi-Systemd terminal for viewing logs # Set the Rofi-Systemd terminal for viewing logs
# Using optionalAttrs because only available in NixOS # Using optionalAttrs because only available in NixOS
environment = environment =
{ } { }
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) { // lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm"; sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm";
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Set the i3 terminal # Set the i3 terminal
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm"; xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm";
# Set the Rofi terminal for running programs # Set the Rofi terminal for running programs
programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.wezterm}/bin/wezterm"; programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.wezterm}/bin/wezterm";
# Display images in the terminal # Display images in the terminal
programs.fish.shellAliases = { programs.fish.shellAliases = {
icat = lib.mkForce "wezterm imgcat"; icat = lib.mkForce "wezterm imgcat";
}; };
programs.wezterm = { programs.wezterm = {
enable = true; enable = true;
colorSchemes = { colorSchemes = {
myTheme = { myTheme = {
background = config.theme.colors.base00; background = config.theme.colors.base00;
foreground = config.theme.colors.base05; foreground = config.theme.colors.base05;
cursor_bg = config.theme.colors.base05; cursor_bg = config.theme.colors.base05;
cursor_fg = config.theme.colors.base00; cursor_fg = config.theme.colors.base00;
cursor_border = config.theme.colors.base05; cursor_border = config.theme.colors.base05;
selection_bg = config.theme.colors.base05; selection_bg = config.theme.colors.base05;
selection_fg = config.theme.colors.base00; selection_fg = config.theme.colors.base00;
scrollbar_thumb = config.theme.colors.base03; scrollbar_thumb = config.theme.colors.base03;
ansi = [ ansi = [
config.theme.colors.base01 # black config.theme.colors.base01 # black
config.theme.colors.base0F # maroon config.theme.colors.base0F # maroon
config.theme.colors.base0B # green config.theme.colors.base0B # green
config.theme.colors.base0A # olive config.theme.colors.base0A # olive
config.theme.colors.base0D # navy config.theme.colors.base0D # navy
config.theme.colors.base0E # purple config.theme.colors.base0E # purple
config.theme.colors.base0C # teal config.theme.colors.base0C # teal
config.theme.colors.base06 # silver config.theme.colors.base06 # silver
]; ];
brights = [ brights = [
config.theme.colors.base03 # grey config.theme.colors.base03 # grey
config.theme.colors.base08 # red config.theme.colors.base08 # red
config.theme.colors.base0B # lime config.theme.colors.base0B # lime
config.theme.colors.base0A # yellow config.theme.colors.base0A # yellow
config.theme.colors.base0D # blue config.theme.colors.base0D # blue
config.theme.colors.base0E # fuchsia config.theme.colors.base0E # fuchsia
config.theme.colors.base0C # aqua config.theme.colors.base0C # aqua
config.theme.colors.base07 # white config.theme.colors.base07 # white
]; ];
compose_cursor = config.theme.colors.base09; # orange compose_cursor = config.theme.colors.base09; # orange
copy_mode_active_highlight_bg = { copy_mode_active_highlight_bg = {
Color = config.theme.colors.base03; Color = config.theme.colors.base03;
}; };
copy_mode_active_highlight_fg = { copy_mode_active_highlight_fg = {
Color = config.theme.colors.base07; Color = config.theme.colors.base07;
}; };
copy_mode_inactive_highlight_bg = { copy_mode_inactive_highlight_bg = {
Color = config.theme.colors.base02; Color = config.theme.colors.base02;
}; };
copy_mode_inactive_highlight_fg = { copy_mode_inactive_highlight_fg = {
Color = config.theme.colors.base06; Color = config.theme.colors.base06;
}; };
quick_select_label_bg = { quick_select_label_bg = {
Color = config.theme.colors.base02; Color = config.theme.colors.base02;
}; };
quick_select_label_fg = { quick_select_label_fg = {
Color = config.theme.colors.base06; Color = config.theme.colors.base06;
}; };
quick_select_match_bg = { quick_select_match_bg = {
Color = config.theme.colors.base03; Color = config.theme.colors.base03;
}; };
quick_select_match_fg = { quick_select_match_fg = {
Color = config.theme.colors.base07; Color = config.theme.colors.base07;
};
}; };
}; };
}; extraConfig = ''
extraConfig = '' return {
return { color_scheme = "myTheme",
color_scheme = "myTheme",
-- Scrollback -- Scrollback
scrollback_lines = 10000, scrollback_lines = 10000,
-- Window -- Window
window_padding = { window_padding = {
left = 6, left = 6,
right = 6, right = 6,
top = 0, top = 0,
bottom = 0, bottom = 0,
}, },
font = wezterm.font 'VictorMono Nerd Font', font = wezterm.font '${font}',
font_size = 18.0, font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"},
-- Tab Bar -- Tab Bar
window_frame = { window_frame = {
font = wezterm.font 'VictorMono Nerd Font', font = wezterm.font 'VictorMono Nerd Font',
font_size = 16.0, font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
}, },
colors = { colors = {
tab_bar = { tab_bar = {
active_tab = { active_tab = {
bg_color = '${config.theme.colors.base00}', bg_color = '${config.theme.colors.base00}',
fg_color = '${config.theme.colors.base04}', fg_color = '${config.theme.colors.base04}',
},
}, },
}, },
},
-- Disable audio -- Disable audio
audible_bell = "Disabled", audible_bell = "Disabled",
initial_rows = 80, initial_rows = 80,
initial_cols = 200, initial_cols = 200,
keys = { keys = {
-- sends completion string for fish autosuggestions -- sends completion string for fish autosuggestions
{ {
key = 'Enter', key = 'Enter',
mods = 'SHIFT', mods = 'SHIFT',
action = wezterm.action.SendString '\x1F' action = wezterm.action.SendString '\x1F'
},
-- ctrl-shift-h was "hide"
{
key = 'H',
mods = 'SHIFT|CTRL',
action = wezterm.action.DisableDefaultAssignment
},
-- alt-enter was "fullscreen"
{
key = 'Enter',
mods = 'ALT',
action = wezterm.action.DisableDefaultAssignment
},
-- make super-f "fullscreen"
{
key = 'f',
mods = 'SUPER',
action = wezterm.action.ToggleFullScreen
},
-- super-t open new tab in new dir
{
key = 't',
mods = 'SUPER',
action = wezterm.action.SpawnCommandInNewTab {
cwd = wezterm.home_dir,
}, },
}, -- ctrl-shift-h was "hide"
-- shift-super-t open new tab in same dir {
{ key = 'H',
key = 't', mods = 'SHIFT|CTRL',
mods = 'SUPER|SHIFT', action = wezterm.action.DisableDefaultAssignment
action = wezterm.action.SpawnTab 'CurrentPaneDomain' },
}, -- alt-enter was "fullscreen"
-- project switcher {
{ key = 'Enter',
key = 'P', mods = 'ALT',
mods = 'SUPER', action = wezterm.action.DisableDefaultAssignment
action = wezterm.action_callback(function(window, pane) },
local choices = {} -- make super-f "fullscreen"
{
key = 'f',
mods = 'SUPER',
action = wezterm.action.ToggleFullScreen
},
-- super-t open new tab in new dir
{
key = 't',
mods = 'SUPER',
action = wezterm.action.SpawnCommandInNewTab {
cwd = wezterm.home_dir,
},
},
-- shift-super-t open new tab in same dir
{
key = 't',
mods = 'SUPER|SHIFT',
action = wezterm.action.SpawnTab 'CurrentPaneDomain'
},
-- project switcher
{
key = 'P',
mods = 'SUPER',
action = wezterm.action_callback(function(window, pane)
local choices = {}
wezterm.log_info "working?" wezterm.log_info "working?"
function scandir(directory) function scandir(directory)
local i, t, popen = 0, {}, io.popen local i, t, popen = 0, {}, io.popen
local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"') local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"')
for filename in pfile:lines() do for filename in pfile:lines() do
i = i + 1 i = i + 1
t[i] = filename t[i] = filename
end
pfile:close()
return t
end
for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
table.insert(choices, { label = v })
end
window:perform_action(
wezterm.action.InputSelector {
action = wezterm.action_callback(function(window, pane, id, label)
if not id and not label then
wezterm.log_info "cancelled"
else
window:perform_action(
wezterm.action.SpawnCommandInNewTab {
cwd = label,
},
pane
)
end end
end), pfile:close()
fuzzy = true, return t
title = "Select Project", end
choices = choices,
}, for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
pane table.insert(choices, { label = v })
) end
end),
window:perform_action(
wezterm.action.InputSelector {
action = wezterm.action_callback(function(window, pane, id, label)
if not id and not label then
wezterm.log_info "cancelled"
else
window:perform_action(
wezterm.action.SpawnCommandInNewTab {
cwd = label,
},
pane
)
end
end),
fuzzy = true,
title = "Select Project",
choices = choices,
},
pane
)
end),
},
}, },
}, }
} '';
''; };
}; };
}; };
};
} }

View File

@ -9,6 +9,7 @@ let
lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span"; lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span"; lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
terminal = "wezterm";
in in
{ {
@ -47,9 +48,10 @@ in
assigns = { assigns = {
"${ws1}" = [ { class = "Firefox"; } ]; "${ws1}" = [ { class = "Firefox"; } ];
"${ws2}" = [ "${ws2}" = [
{ class = "kitty"; }
{ class = "aerc"; } { class = "aerc"; }
{ class = "kitty"; }
{ class = "obsidian"; } { class = "obsidian"; }
{ class = "wezterm"; }
]; ];
"${ws3}" = [ { class = "discord"; } ]; "${ws3}" = [ { class = "discord"; } ];
"${ws4}" = [ "${ws4}" = [
@ -126,7 +128,9 @@ in
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
# Launchers # Launchers
"${modifier}+Return" = "exec --no-startup-id kitty; workspace ${ws2}; layout tabbed"; "${modifier}+Return" = "exec --no-startup-id ${
config.home-manager.users.${config.user}.programs.rofi.terminal
}; workspace ${ws2}; layout tabbed";
"${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}"; "${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}";
"${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}"; "${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}"; "${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}";
@ -138,8 +142,12 @@ in
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = ''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"''; "${modifier}+Shift+q" = ''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = "exec ${lockCmd}"; "${modifier}+Shift+x" = "exec ${lockCmd}";
"${modifier}+Mod1+h" = "exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'"; "${modifier}+Mod1+h" = "exec --no-startup-id ${
"${modifier}+Mod1+r" = "exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'"; config.home-manager.users.${config.user}.programs.rofi.terminal
} -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"${modifier}+Mod1+r" = "exec --no-startup-id ${
config.home-manager.users.${config.user}.programs.rofi.terminal
} -e sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
# Window options # Window options
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";

View File

@ -18,9 +18,6 @@ in
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
# Set the Rofi-Systemd terminal for viewing logs
environment.sessionVariables.ROFI_SYSTEMD_TERM = lib.mkIf config.kitty.enable "${pkgs.kitty}/bin/kitty";
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ home.packages = with pkgs; [