Files
jsl-home/homeManagerModules/ghostty.nix
2025-07-06 15:37:04 -05:00

110 lines
3.5 KiB
Nix

{ config, pkgs, lib, nixgl-pkgs, ... }:
{
home.sessionVariables = lib.mkIf (config.enableShell && config.graphical) {
TERMINAL = "ghostty";
};
programs.ghostty = lib.mkIf (config.enableShell && config.graphical) {
enable = true;
enableZshIntegration = true;
package = nixgl-pkgs.nixGLMesa pkgs.ghostty;
settings = {
# command = "TERM=xterm-256color /usr/bin/bash";
font-size = 12;
font-family = "Source Code Pro";
# theme = "idleToes";
# theme = "CGA";
theme = "catppuccin-mocha";
# theme = "CobaltNext";
# clipboard-read = "allow";
copy-on-select = true;
shell-integration = "zsh";
shell-integration-features = [ "no-title" "sudo" ];
gtk-single-instance = true;
window-padding-balance = true ;
window-padding-x = 5;
window-padding-y = 5;
initial-window = true;
resize-overlay = "never";
# Example: https://gist.github.com/adibhanna/c552c452fb244b3b721e3c2432e85cde
keybind = [
"ctrl+s>n=new_split:down"
"ctrl+t>n=new_tab"
"ctrl+t>1=goto_tab:1"
"ctrl+t>2=goto_tab:2"
"ctrl+t>3=goto_tab:3"
"ctrl+s>i=goto_split:up"
"ctrl+s>k=goto_split:down"
];
# window-position-x = 500;
# window-position-y = 500;
window-height = 40;
window-width = 200;
};
};
# https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970
xdg.desktopEntries."com.mitchellh.ghostty" = lib.mkIf (config.enableShell && config.graphical) {
name = "Ghostty";
type = "Application";
comment = "A terminal emulator";
exec = "ghostty";
icon = "com.mitchellh.ghostty";
terminal = false;
startupNotify = true;
categories = [ "System" "TerminalEmulator" ];
settings = {
Keywords = "terminal;tty;pty;";
X-GNOME-UsesNotifications = "true";
X-TerminalArgExec = "-e";
X-TerminalArgTitle = "--title=";
X-TerminalArgAppId = "--class=";
X-TerminalArgDir = "--working-directory=";
X-TerminalArgHold = "--wait-after-command";
};
actions = {
new-window = {
name = "New Window";
exec = "ghostty";
};
};
};
# https://discourse.nixos.org/t/apps-installed-via-home-manager-are-not-visible-within-gnome/48252/2
# home.activation.copyDesktopFiles = lib.hm.dag.entryAfter ["installPackages"] ''
# if [ "$XDG_CURRENT_DESKTOP" = "GNOME" ]; then
# mkdir -p "${config.home.homeDirectory}/.local/share/applications"
# if [ -d "${config.home.homeDirectory}/.local/share/applications/nix" ]; then
# rm -rf "${config.home.homeDirectory}/.local/share/applications/nix"
# fi
# ln -sf "${config.home.homeDirectory}/.nix-profile/share/applications" \
# ${config.home.homeDirectory}/.local/share/applications/nix
# mkdir -p "${config.home.homeDirectory}/.local/share/icons"
# if [ -d "${config.home.homeDirectory}/.local/share/icons/nix" ]; then
# rm -rf "${config.home.homeDirectory}/.local/share/icons/nix"
# fi
# ln -sf "${config.home.homeDirectory}/.nix-profile/share/icons" \
# ${config.home.homeDirectory}/.local/share/icons/nix
# fi
# '';
# https://wiki.nixos.org/wiki/GNOME
# https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/#setting-gnome-options
# dconf.settings = {
# "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
# "binding" = "<Super>Return";
# "command" = "ghostty";
# "name" = "Terminal";
# };
# };
}