2025-06-12 20:09:05 +02:00
{
config ,
lib ,
pkgs ,
. . .
2025-07-20 01:23:48 +02:00
} :
let
2025-06-12 20:09:05 +02:00
inherit ( lib . lists ) elem ;
inherit ( lib . meta ) getExe ;
2025-07-03 23:34:56 +02:00
inherit ( lib . attrsets ) mapAttrsToList ;
inherit ( lib . strings ) concatStringsSep ;
2025-06-12 20:09:05 +02:00
inherit ( config . meta . mainUser . defaultShell ) name package ;
inherit ( config . modules . style . colorScheme ) slug ;
# Shell integration for ghostty only supports
# bash, fish and zsh for now.
shell-integration =
2025-07-20 01:23:48 +02:00
if
elem name [
" b a s h "
" f i s h "
" z s h "
]
then
name
else
" n o n e " ;
2025-06-12 20:09:05 +02:00
2025-07-03 23:34:56 +02:00
ghostty-settings = {
font-size = 14 ;
2025-07-13 22:51:22 +02:00
font-family = " J e t B r a i n s M o n o N e r d F o n t " ;
# font-style-bold = JetBrainsMono NF Regular;
# font-style-bold-italic = JetBrainsMono NF Italic;
2025-06-12 20:09:05 +02:00
2025-07-13 22:51:22 +02:00
app-notifications = " n o - c l i p b o a r d - c o p y " ;
2025-07-18 23:15:01 +02:00
background-opacity = 0 .9 ;
2025-07-13 22:51:22 +02:00
bold-is-bright = " t r u e " ;
confirm-close-surface = " f a l s e " ;
cursor-style-blink = " f a l s e " ;
2025-07-03 23:34:56 +02:00
gtk-single-instance = " t r u e " ;
gtk-tabs-location = " b o t t o m " ;
gtk-wide-tabs = false ;
mouse-hide-while-typing = " t r u e " ;
2025-07-13 22:51:22 +02:00
resize-overlay-duration = " 0 s " ;
2025-07-03 23:34:56 +02:00
shell-integration-features = " c u r s o r , s u d o , n o - t i t l e " ;
2025-07-13 22:51:22 +02:00
term = " x t e r m - 2 5 6 c o l o r " ;
theme = slug ;
window-decoration = " n o n e " ;
window-padding-balance = true ;
window-padding-x = 8 ;
window-padding-y = 8 ;
window-theme = " g h o s t t y " ;
2025-07-03 23:34:56 +02:00
cursor-style = " b l o c k " ;
# Whether to automatically copy selected text to the clipboard. true will prefer to copy to the selection clipboard, otherwise it will copy to the system clipboard.
# The value clipboard will always copy text to the selection clipboard as well as the system clipboard.
copy-on-select = " c l i p b o a r d " ;
2025-07-08 13:57:04 +02:00
inherit shell-integration ;
2025-07-13 22:51:22 +02:00
2025-07-03 23:34:56 +02:00
command = getExe package ;
} ;
2025-07-20 01:23:48 +02:00
settingsFile =
pkgs . writeText " c o n f i g "
< | concatStringsSep " \n "
< | mapAttrsToList ( name : value : " ${ name } = ${ toString value } " ) ghostty-settings ;
2025-07-03 23:34:56 +02:00
2025-06-12 20:09:05 +02:00
ghostty-wrapped = pkgs . symlinkJoin {
name = " g h o s t t y - w r a p p e d " ;
2025-07-20 01:23:48 +02:00
paths = [ pkgs . ghostty ] ;
nativeBuildInputs = [ pkgs . makeWrapper ] ;
2025-06-12 20:09:05 +02:00
postBuild = ''
2025-07-03 23:34:56 +02:00
wrapProgram $ out/bin/ghostty - - add-flags " - - c o n f i g - f i l e = ${ settingsFile } "
2025-06-12 20:09:05 +02:00
'' ;
} ;
2025-07-20 01:23:48 +02:00
in
{
2025-06-12 20:09:05 +02:00
environment . systemPackages = builtins . attrValues {
inherit ghostty-wrapped ;
} ;
}