fix(ghostty): add cairo wrapper and make it the default terminal

This commit is contained in:
randogoth 2026-02-04 21:51:25 +02:00
parent 987aee1c5b
commit 2e58a2d4ad
5 changed files with 17 additions and 8 deletions

View file

@ -29,7 +29,7 @@ let
name = "com.mitchellh.ghostty"; name = "com.mitchellh.ghostty";
desktopName = "Terminal"; desktopName = "Terminal";
genericName = "Terminal Emulator"; genericName = "Terminal Emulator";
exec = "ghostty"; exec = "ghostty-cairo";
icon = "com.mitchellh.ghostty"; icon = "com.mitchellh.ghostty";
categories = [ categories = [
"System" "System"
@ -37,7 +37,7 @@ let
"Utility" "Utility"
]; ];
terminal = false; terminal = false;
comment = "Fast GPU-accelerated terminal"; comment = "Terminal (Cairo renderer fallback)";
}; };
in in
{ {

View file

@ -50,7 +50,7 @@ in
"org/gnome/shell/extensions/logo-menu" = { "org/gnome/shell/extensions/logo-menu" = {
menu-button-icon-image = lib.gvariant.mkInt32 51; menu-button-icon-image = lib.gvariant.mkInt32 51;
menu-button-terminal = "ghostty"; menu-button-terminal = "ghostty-cairo";
menu-button-system-monitor = "missioncenter"; menu-button-system-monitor = "missioncenter";
menu-button-extensions-app = "com.mattjakeman.ExtensionManager.desktop"; menu-button-extensions-app = "com.mattjakeman.ExtensionManager.desktop";
hide-softwarecentre = true; hide-softwarecentre = true;

View file

@ -1,5 +1,11 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let
ghosttyCairo = pkgs.writeShellScriptBin "ghostty-cairo" ''
export GSK_RENDERER=cairo
exec ghostty "$@"
'';
in
{ {
# Baseline system tools available everywhere; users run Home Manager standalone. # Baseline system tools available everywhere; users run Home Manager standalone.
config.environment.systemPackages = lib.mkAfter [ config.environment.systemPackages = lib.mkAfter [
@ -11,6 +17,7 @@
pkgs.fastfetch pkgs.fastfetch
pkgs.flatpak pkgs.flatpak
pkgs.ghostty pkgs.ghostty
ghosttyCairo
pkgs.git pkgs.git
pkgs.home-manager pkgs.home-manager
pkgs.just pkgs.just

View file

@ -24,9 +24,11 @@ in
]; ];
# Use Ghostty as the default terminal emulator. # Use Ghostty as the default terminal emulator.
# On some machines Ghostty may fail to acquire an OpenGL context; `ghostty-cairo`
# forces GTK4's Cairo renderer (CPU) and is more hardware-agnostic.
environment.sessionVariables = { environment.sessionVariables = {
TERMINAL = "${pkgs.ghostty}/bin/ghostty"; TERMINAL = "ghostty-cairo";
DEFAULT_TERMINAL = "${pkgs.ghostty}/bin/ghostty"; DEFAULT_TERMINAL = "ghostty-cairo";
}; };
programs.bash = { programs.bash = {

View file

@ -97,7 +97,7 @@
[no-cd] [no-cd]
switch: switch:
home-manager switch --flake ~/.config/home-manager#$USER home-manager switch --flake ~/.config/home-manager#$USER
[no-cd] [no-cd]
rebuild: rebuild:
@ -111,8 +111,8 @@ home-manager switch --flake ~/.config/home-manager#$USER
home.sessionVariables = { home.sessionVariables = {
# you can change the default terminal and editor here # you can change the default terminal and editor here
TERMINAL = "${pkgs.ghostty}/bin/ghostty"; TERMINAL = "ghostty-cairo";
DEFAULT_TERMINAL = "${pkgs.ghostty}/bin/ghostty"; DEFAULT_TERMINAL = "ghostty-cairo";
EDITOR = "micro"; EDITOR = "micro";
DBX_CONTAINER_HOME_PREFIX = "$HOME/distrobox"; DBX_CONTAINER_HOME_PREFIX = "$HOME/distrobox";
}; };