From 4ffecbac0ccc8ce463ab0f2c18336915fa3f23df Mon Sep 17 00:00:00 2001 From: ooks-io Date: Tue, 21 Jan 2025 15:35:02 +1100 Subject: [PATCH] terminal: foot --> ghostty --- hosts/ooksdesk/default.nix | 2 +- modules/home/workstation/binds.nix | 2 + .../workstation/hyprland/settings/binds.nix | 4 +- .../workstation/hyprland/settings/rules.nix | 2 +- modules/home/workstation/terminal/default.nix | 2 +- modules/home/workstation/terminal/ghostty.nix | 89 ++++++++++++++++--- modules/nixos/workstation/options.nix | 5 +- 7 files changed, 89 insertions(+), 17 deletions(-) diff --git a/hosts/ooksdesk/default.nix b/hosts/ooksdesk/default.nix index ccb862e..8516049 100644 --- a/hosts/ooksdesk/default.nix +++ b/hosts/ooksdesk/default.nix @@ -22,7 +22,7 @@ profiles = ["creative" "virtualization" "gaming" "media" "communication" "productivity"]; default = { browser = "firefox"; - terminal = "foot"; + terminal = "ghostty"; }; }; console = { diff --git a/modules/home/workstation/binds.nix b/modules/home/workstation/binds.nix index 5e906a7..3c2e9ee 100644 --- a/modules/home/workstation/binds.nix +++ b/modules/home/workstation/binds.nix @@ -13,6 +13,8 @@ in { browser = mkBind "No browser is enabled"; terminal = mkBind "No terminal is enabled"; terminalLaunch = mkBind "Failed to launch tui"; + terminalDropdown = mkBind "Terminal Dropdown not enabled"; + btop = mkBind "Btop binding not set"; fileManager = mkBind "No file manager is enabled."; notes = mkBind "No Notes app is enabled"; discord = mkBind "No Discord app is enabled"; diff --git a/modules/home/workstation/hyprland/settings/binds.nix b/modules/home/workstation/hyprland/settings/binds.nix index 07c9f22..971147b 100644 --- a/modules/home/workstation/hyprland/settings/binds.nix +++ b/modules/home/workstation/hyprland/settings/binds.nix @@ -7,7 +7,7 @@ in { # Program Launch "SUPER, b, exec, ${binds.browser}" "SUPER, return, exec, ${binds.terminal}" - "SUPERSHIFT, return, exec, ${binds.terminal} --title foot-dropdown" + "SUPERSHIFT, return, exec, ${binds.terminal} --title=dropdown" "SUPER, e, exec, ${binds.terminalLaunch} $EDITOR" "SUPERSHIFT, P, exec, ${binds.password}" "SUPERCTRL, P, exec, ${binds.quickpass}" @@ -15,7 +15,7 @@ in { "SUPERSHIFT, e, exec, ${binds.fileManager}" "SUPERSHIFT, S, exec, ${binds.steam}" "SUPERSHIFT, n, exec, ${binds.notes}" - "SUPER, escape, exec, ${binds.terminalLaunch} --title=BTOP btop" + "SUPER, escape, exec, ${binds.btop}" "SUPER CTRL, return, exec, ${binds.zellijMenu}" "SUPER, delete, exec, ${binds.powerMenu}" "SUPERSHIFT, F, exec, ${binds.factorio}" diff --git a/modules/home/workstation/hyprland/settings/rules.nix b/modules/home/workstation/hyprland/settings/rules.nix index 5296acd..c1141f5 100644 --- a/modules/home/workstation/hyprland/settings/rules.nix +++ b/modules/home/workstation/hyprland/settings/rules.nix @@ -58,7 +58,7 @@ in { rules = ["center 1" "float" "size 50%"]; } { - matches = {initialTitle = "foot-dropdown";}; + matches = {initialTitle = "dropdown";}; rules = [ "monitor 0" "animation slide down" diff --git a/modules/home/workstation/terminal/default.nix b/modules/home/workstation/terminal/default.nix index 8ba2eb3..f13829f 100644 --- a/modules/home/workstation/terminal/default.nix +++ b/modules/home/workstation/terminal/default.nix @@ -1,6 +1,6 @@ { imports = [ ./foot.nix - # ./ghostty.nix + ./ghostty.nix ]; } diff --git a/modules/home/workstation/terminal/ghostty.nix b/modules/home/workstation/terminal/ghostty.nix index 934e1a8..9c965fc 100644 --- a/modules/home/workstation/terminal/ghostty.nix +++ b/modules/home/workstation/terminal/ghostty.nix @@ -1,14 +1,83 @@ { - inputs, - inputs', + lib, + hozen, + osConfig, + config, ... -}: { - imports = [ - inputs.ghostty-hm.homeModules.default - ]; +}: let + inherit (lib) mkIf mkMerge; + inherit (hozen) color; + inherit (osConfig.ooknet.host) admin; + inherit (osConfig.ooknet.appearance.fonts) monospace; + inherit (osConfig.ooknet.workstation) default; - programs.ghostty = { - enable = true; - package = inputs'.ghostty.packages.default; - }; + cfg = osConfig.ooknet.workstation.programs.ghostty; +in { + config = mkMerge [ + (mkIf (cfg.enable || default.terminal == "ghostty") { + programs.ghostty = { + enable = true; + enableFishIntegration = admin.shell == "fish"; + settings = { + # defined below + theme = "hozen"; + + # font config + font-size = monospace.size; + font-family = monospace.family; + font-family-bold = "${monospace.family} Bold"; + font-family-italic = "${monospace.family} Italic"; + font-family-bold-italic = "${monospace.family} Bold Italic"; + + # padding + window-padding-x = 9; + window-padding-y = 9; + + # box drawing glyph thickness + adjust-box-thickness = -10; # why where they so thick? + + # disable the window decorations + gtk-titlebar = false; + window-decoration = false; + + # disable close terminal prompt + confirm-close-surface = false; + }; + themes.hozen = { + background = "${color.base00}"; + foreground = "${color.base05}"; + palette = [ + "0=#${color.base00}" # black + "1=#${color.base08}" # red + "2=#${color.base0B}" # green + "3=#${color.base0A}" # yellow + "4=#${color.base0D}" # blue + "5=#${color.base0E}" # magenta + "6=#${color.base0C}" # cyan + "7=#${color.base05}" # white + "8=#${color.base03}" # bright black + "9=#${color.base08}" # bright red + "10=#${color.base0B}" # bright green + "11=#${color.base0A}" # bright yellow + "12=#${color.base0D}" # bright blue + "13=#${color.base0E}" # bright magenta + "14=#${color.base0C}" # bright cyan + "15=#${color.base07}" # bright white + ]; + }; + }; + }) + (mkIf (default.terminal == "ghostty") { + home.sessionVariables = { + TERMINAL = "ghostty"; + TERM = "ghostty"; + }; + ooknet.binds = { + terminal = "ghostty"; + terminalLaunch = "ghostty -e"; + terminalDropdown = "ghostty --title=dropdown"; + btop = mkIf config.programs.btop.enable "ghostty --title=BTOP -e btop"; + }; + }) + ]; } diff --git a/modules/nixos/workstation/options.nix b/modules/nixos/workstation/options.nix index 7f1ff9b..6c385a4 100644 --- a/modules/nixos/workstation/options.nix +++ b/modules/nixos/workstation/options.nix @@ -21,13 +21,14 @@ in { default = "firefox"; }; terminal = mkOption { - type = enum ["foot"]; - default = "foot"; + type = enum ["foot" "ghostty"]; + default = "ghostty"; }; }; programs = { firefox.enable = mkEnableOption ""; foot.enable = mkEnableOption ""; + ghostty.enable = mkEnableOption ""; }; }; }