From b8353d4ae8322736aaa3dbbb873fe5143a9d1b14 Mon Sep 17 00:00:00 2001 From: Adam0 Date: Sat, 29 Aug 2026 15:18:39 +0000 Subject: [PATCH] Restore Ghostty tab and split controls --- modules/programs/gui/ghostty/default.nix | 13 +++++++++++-- modules/programs/gui/ghostty/keybinds.nix | 19 ------------------- modules/programs/gui/ghostty/settings.nix | 3 +++ modules/programs/gui/ghostty/theme.css | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ modules/programs/gui/ghostty/patches/libadwaita-compact-tabs.patch | 22 ++++++++++++++++++++++ 5 file(s) changed, 114 insertion(s)(+), 21 deletion(s)(-) diff --git a/modules/programs/gui/ghostty/default.nix b/modules/programs/gui/ghostty/default.nix --- a/modules/programs/gui/ghostty/default.nix +++ b/modules/programs/gui/ghostty/default.nix @@ -1,5 +1,14 @@ { - flake.modules.homeManager.ghostty = {...}: { - programs.ghostty.enable = true; + flake.modules.homeManager.ghostty = {pkgs, ...}: let + compactLibadwaita = pkgs.libadwaita.overrideAttrs (oldAttrs: { + patches = (oldAttrs.patches or []) ++ [./patches/libadwaita-compact-tabs.patch]; + }); + in { + programs.ghostty = { + # keep-sorted start + enable = true; + package = pkgs.ghostty.override {libadwaita = compactLibadwaita;}; + # keep-sorted end + }; }; } diff --git a/modules/programs/gui/ghostty/keybinds.nix b/modules/programs/gui/ghostty/keybinds.nix --- a/modules/programs/gui/ghostty/keybinds.nix +++ b/modules/programs/gui/ghostty/keybinds.nix @@ -6,26 +6,7 @@ "ctrl+down=unbind" "ctrl+enter=unbind" "ctrl+shift+0=unbind" - "ctrl+shift+e=unbind" - "ctrl+shift+enter=unbind" "ctrl+shift+q=unbind" - "super+alt+down=unbind" - "super+alt+left=unbind" - "super+alt+right=unbind" - "super+alt+up=unbind" - "super+ctrl+O=unbind" - "super+ctrl+T=unbind" - "super+ctrl+W=unbind" - "super+ctrl+down=unbind" - "super+ctrl+equal=unbind" - "super+ctrl+left=unbind" - "super+ctrl+right=unbind" - "super+ctrl+up=unbind" - "super+d=unbind" - "super+left_bracket=unbind" - "super+right_bracket=unbind" - "super+shift+d=unbind" - "super+shift+enter=unbind" # keep-sorted end ]; }; diff --git a/modules/programs/gui/ghostty/settings.nix b/modules/programs/gui/ghostty/settings.nix --- a/modules/programs/gui/ghostty/settings.nix +++ b/modules/programs/gui/ghostty/settings.nix @@ -13,7 +13,10 @@ # Appearance settings. # keep-sorted start + gtk-custom-css = "${./theme.css}"; + gtk-tabs-location = "bottom"; gtk-titlebar = false; + gtk-wide-tabs = false; resize-overlay = "never"; window-decoration = "none"; window-padding-x = 2; diff --git a/modules/programs/gui/ghostty/theme.css b/modules/programs/gui/ghostty/theme.css new file mode 100644 --- /dev/null +++ b/modules/programs/gui/ghostty/theme.css @@ -0,0 +1,78 @@ +/* Tabs. */ +revealer.raised.bottom-bar { + background-color: shade(@theme_bg_color, 1.08); + box-shadow: none; +} + +tabbar, +tabbar revealer, +tabbar .box, +tabbar .box:backdrop { + padding: 0; + background-color: shade(@theme_bg_color, 1.08); + box-shadow: none; +} + +tabbar .start-action, +tabbar .end-action { + min-width: 0; + margin: 0; + padding: 0; +} + +tabbar scrolledwindow:not(.pinned) { + margin-left: -14px; +} + +tabbar tabbox { + min-height: 0; + padding: 0; + font-family: monospace; + -gtk-icon-size: 10px; +} + +tabbar tabbox > tabboxchild { + border-radius: 0; +} + +tabbar tab, +tabbar tab:hover, +tabbar tab:active { + min-height: 16px; + padding: 0 4px; + border-radius: 0; + background: transparent; + box-shadow: none; + color: @theme_fg_color; + transition: none; +} + +tabbar tab:selected, +tabbar tab:selected:hover, +tabbar tab:selected:active { + background: @accent_bg_color; + color: @accent_fg_color; +} + +tabbar tab label { + min-height: 0; + margin: 0; + padding: 0; + font-size: 11px; +} + +tabbar tab:selected label { + font-weight: bold; +} + +tabbar tab button.tab-close-button { + min-width: 10px; + min-height: 10px; + margin: 0 0 0 2px; + padding: 0; + opacity: 1; +} + +tabbar tabbox > separator { + opacity: 0; +} diff --git a/modules/programs/gui/ghostty/patches/libadwaita-compact-tabs.patch b/modules/programs/gui/ghostty/patches/libadwaita-compact-tabs.patch new file mode 100644 --- /dev/null +++ b/modules/programs/gui/ghostty/patches/libadwaita-compact-tabs.patch @@ -0,0 +1,22 @@ +diff --git a/src/adw-tab-box.c b/src/adw-tab-box.c +index 5833a944..206034a9 100644 +--- a/src/adw-tab-box.c ++++ b/src/adw-tab-box.c +@@ -14,7 +14,7 @@ + #include "adw-widget-utils-private.h" + #include + +-#define SPACING 5 ++#define SPACING 0 + #define DND_THRESHOLD_MULTIPLIER 4 + #define DROP_SWITCH_TIMEOUT 500 + +@@ -26,7 +26,7 @@ + #define RESIZE_ANIMATION_DURATION 200 + #define REORDER_ANIMATION_DURATION 250 + +-#define MAX_TAB_WIDTH_NON_EXPAND 220 ++#define MAX_TAB_WIDTH_NON_EXPAND 80 + + #define FADE_OFFSET 6.0f + #define FADE_WIDTH 36.0f -- tangled.sh