replace wezterm with ghostty on linux

This commit is contained in:
Noah Masur 2025-05-03 20:34:46 -04:00
parent faac8f3c8b
commit 61c4e68fef
6 changed files with 39 additions and 20 deletions

View File

@ -199,19 +199,25 @@ in
exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} aerc %u"; exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} aerc %u";
}; };
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux { xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
"${config.xsession.windowManager.i3.config.modifier}+Shift+e" = "exec ${ "${config.xsession.windowManager.i3.config.modifier}+Shift+e" =
# Don't name the script `aerc` or it will affect grep let
builtins.toString ( terminal = config.nmasur.presets.services.i3.terminal;
pkgs.writeShellScript "focus-mail.sh" '' startupCommand =
count=$(ps aux | grep -c aerc) if terminal == pkgs.wezterm then "start --class aerc -- aerc" else "--class=aerc --command=aerc";
if [ "$count" -eq 1 ]; then in
i3-msg "exec --no-startup-id ${lib.getExe config.nmasur.presets.services.i3.terminal} start --class aerc -- aerc" "exec ${
sleep 0.25 # Don't name the script `aerc` or it will affect grep
fi builtins.toString (
i3-msg "[class=aerc] focus" pkgs.writeShellScript "focus-mail.sh" ''
'' count=$(ps aux | grep -c aerc)
) if [ "$count" -eq 1 ]; then
}"; i3-msg "exec --no-startup-id ${lib.getExe terminal} ${startupCommand}"
sleep 0.25
fi
i3-msg "[class=aerc] focus"
''
)
}";
}; };
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = {

View File

@ -14,6 +14,10 @@ in
options.nmasur.presets.programs.ghostty.enable = lib.mkEnableOption "Ghostty terminal"; options.nmasur.presets.programs.ghostty.enable = lib.mkEnableOption "Ghostty terminal";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Set the i3 terminal
nmasur.presets.services.i3.terminal = config.programs.ghostty.package;
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
@ -29,7 +33,7 @@ in
macos-titlebar-style = "hidden"; macos-titlebar-style = "hidden";
window-decoration = false; window-decoration = false;
macos-non-native-fullscreen = true; macos-non-native-fullscreen = true;
fullscreen = true; fullscreen = if pkgs.stdenv.isDarwin then true else false;
keybind = [ keybind = [
"super+t=unbind" # Pass super-t to underlying tool (e.g. zellij tabs) "super+t=unbind" # Pass super-t to underlying tool (e.g. zellij tabs)
"super+shift+]=unbind" "super+shift+]=unbind"

View File

@ -94,7 +94,7 @@ in
ws10 = "10:X"; ws10 = "10:X";
in in
{ {
terminal = cfg.terminal.meta.mainProgram; # terminal = cfg.terminal.meta.mainProgram;
modifier = modifier; modifier = modifier;
assigns = { assigns = {
"${ws1}" = [ { class = "Firefox"; } ]; "${ws1}" = [ { class = "Firefox"; } ];
@ -103,6 +103,7 @@ in
{ class = "kitty"; } { class = "kitty"; }
{ class = "obsidian"; } { class = "obsidian"; }
{ class = "wezterm"; } { class = "wezterm"; }
{ class = "ghostty"; }
]; ];
"${ws3}" = [ { class = "discord"; } ]; "${ws3}" = [ { class = "discord"; } ];
"${ws4}" = [ "${ws4}" = [
@ -213,9 +214,9 @@ in
cfg.commands.lockScreen != null cfg.commands.lockScreen != null
) "exec ${cfg.commands.lockScreen}"; ) "exec ${cfg.commands.lockScreen}";
"${modifier}+Mod1+h" = "${modifier}+Mod1+h" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'"; "exec --no-startup-id ${lib.getExe cfg.terminal} --command sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'";
"${modifier}+Mod1+r" = "${modifier}+Mod1+r" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c 'doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'"; "exec --no-startup-id ${lib.getExe cfg.terminal} --command sh -c 'doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path} || read'";
# Window options # Window options
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";

View File

@ -136,7 +136,15 @@ in
fi fi
'' ''
); );
click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'"; click-left =
let
startupCommand =
if config.nmasur.presets.services.i3.terminal == pkgs.wezterm then
"start --class aerc -- aerc"
else
"--class=aerc --command=aerc";
in
"i3-msg 'exec --no-startup-id ${config.nmasur.presets.services.i3.terminal} ${startupCommand}'; sleep 0.15; i3-msg '[class=aerc] focus'";
}; };
"module/network" = { "module/network" = {
type = "internal/network"; type = "internal/network";

View File

@ -24,13 +24,13 @@ in
discord.enable = lib.mkDefault true; discord.enable = lib.mkDefault true;
dotfiles.enable = lib.mkDefault true; dotfiles.enable = lib.mkDefault true;
firefox.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true;
ghostty.enable = lib.mkDefault true;
mpv.enable = lib.mkDefault true; mpv.enable = lib.mkDefault true;
nautilus.enable = lib.mkDefault true; nautilus.enable = lib.mkDefault true;
notmuch.enable = lib.mkDefault true; notmuch.enable = lib.mkDefault true;
nsxiv.enable = lib.mkDefault true; nsxiv.enable = lib.mkDefault true;
obsidian.enable = lib.mkDefault true; obsidian.enable = lib.mkDefault true;
rofi.enable = lib.mkDefault true; rofi.enable = lib.mkDefault true;
wezterm.enable = lib.mkDefault true;
xclip.enable = lib.mkDefault true; xclip.enable = lib.mkDefault true;
zathura.enable = lib.mkDefault true; zathura.enable = lib.mkDefault true;
}; };

View File

@ -55,6 +55,7 @@ in
firefox.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true;
fish.enable = lib.mkDefault true; fish.enable = lib.mkDefault true;
fzf.enable = lib.mkDefault true; fzf.enable = lib.mkDefault true;
ghostty.enable = lib.mkDefault true;
git-work.enable = lib.mkDefault true; git-work.enable = lib.mkDefault true;
git.enable = lib.mkDefault true; git.enable = lib.mkDefault true;
github.enable = lib.mkDefault true; github.enable = lib.mkDefault true;
@ -67,7 +68,6 @@ in
starship.enable = lib.mkDefault true; starship.enable = lib.mkDefault true;
terraform.enable = lib.mkDefault true; terraform.enable = lib.mkDefault true;
weather.enable = lib.mkDefault true; weather.enable = lib.mkDefault true;
wezterm.enable = lib.mkDefault true;
}; };
}; };