From e6836e161ed8f29e4ad60c38a664cfc78398e1ca Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 18:25:55 +0900 Subject: [PATCH 01/10] Install ghostty which is useable since GH-1008 --- nixos/desktop/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 4e8bcf0e..962f81b8 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -143,7 +143,7 @@ gdm-settings - # unstable.ghostty # TODO: Enable after introducing https://github.com/NixOS/nixpkgs/pull/368404 + unstable.ghostty alacritty From 688570df3f0d6f023c127c4d6f90b3232e00cb91 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 18:31:52 +0900 Subject: [PATCH 02/10] Uninstall foot since using ghostty --- home-manager/darwin.nix | 1 - nixos/desktop/default.nix | 1 - 2 files changed, 2 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 6d63834f..f4606cfa 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -34,7 +34,6 @@ # alacritty # Don't install macOS alacritty with nixpkgs. Alacritty often changes schema and I'm negative to use latest until https://github.com/NixOS/nixpkgs/issues/107466 kitty - # foot is only provided for Linux wayland # Don't install firefox via nixpkgs for darwin, it is broken https://github.com/NixOS/nixpkgs/blob/bac526a0fe6da6b10cfe2454f62a0defdbf1d898/pkgs/applications/networking/browsers/firefox/packages.nix#L23 diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 962f81b8..603bf71e 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -132,7 +132,6 @@ # https://github.com/NixOS/nixpkgs/issues/33282 xdg-user-dirs - foot kitty cyme From 7391530698cb240a03aa0289c5cdb4ff2f8d082a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 18:39:31 +0900 Subject: [PATCH 03/10] Add ghostty for GNOME dock However no icons displayed --- home-manager/gnome.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 2360eede..77f49b60 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -42,6 +42,7 @@ in favorite-apps = [ "kitty.desktop" + "com.mitchellh.ghostty.desktop" "dev.zed.Zed.desktop" "google-chrome.desktop" "podman-desktop.desktop" From 08558322099fbc0c32e975a3be66f9dafdb2059a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 18:42:27 +0900 Subject: [PATCH 04/10] Fix and add comments for ghostty cursor --- config/ghostty/config.common | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/ghostty/config.common b/config/ghostty/config.common index 7820944b..8c5b3b2d 100644 --- a/config/ghostty/config.common +++ b/config/ghostty/config.common @@ -3,9 +3,11 @@ # macOS: cmd+shift+, # See also 899be8e51cb288fe0ae91267f495ade7bfb80bc9 -# FIXME: ghostty 1.0.1 Looks not to disable the blinking even if setting both. +# This disbling does not work on `nix run`. Installed in nixos and ran from launcher worked (from shell or gnome difference?. cursor-style-blink = false +# See https://github.com/ghostty-org/ghostty/discussions/2812 shell-integration-features = no-cursor +cursor-style = bar # Looks not appeared in Linux. Why? However I can omit this trivial thing. background-opacity = 0.85 From 187725569805c5457607f76543516549156aa9b1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 18:47:24 +0900 Subject: [PATCH 05/10] Add ghostty terminfo in containers and lima --- home-manager/genericLinux.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/genericLinux.nix b/home-manager/genericLinux.nix index e3b6f490..92e11252 100644 --- a/home-manager/genericLinux.nix +++ b/home-manager/genericLinux.nix @@ -9,7 +9,7 @@ # Make it possible to handle "xterm-kitty" in SSH remotes or lima guest VM with tiny filesize and setups. See GH-932 # # Don't set this in NixOS desktop. It has own value. - TERMINFO_DIRS = "${pkgs.kitty.terminfo}/share/terminfo"; + TERMINFO_DIRS = "${pkgs.kitty.terminfo}/share/terminfo:${pkgs.unstable.ghostty.terminfo}/share/terminfo"; }; }; } From 70fe2407473d68362bb19678f545ee5caecb48c3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 19:00:24 +0900 Subject: [PATCH 06/10] Avoid ghostty default font with the enabled ligatures --- config/ghostty/config.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/ghostty/config.common b/config/ghostty/config.common index 8c5b3b2d..50b3b261 100644 --- a/config/ghostty/config.common +++ b/config/ghostty/config.common @@ -18,3 +18,5 @@ background-opacity = 0.85 # ghostty can set both dark and light. However always use dark for terminals # theme = dark:ForestBlue,light:iTerm2 Tango Light theme = ForestBlue +# Avoid the ligatures in "JetBrains Mono" by default +font-family = "PlemolJP Console NF" From cbd88e65133ece2b8d200400db92a0c2a69f88f5 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 19:11:59 +0900 Subject: [PATCH 07/10] Enable copy-on-select in ghostty --- config/ghostty/config.common | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/ghostty/config.common b/config/ghostty/config.common index 50b3b261..60949ef7 100644 --- a/config/ghostty/config.common +++ b/config/ghostty/config.common @@ -20,3 +20,7 @@ background-opacity = 0.85 theme = ForestBlue # Avoid the ligatures in "JetBrains Mono" by default font-family = "PlemolJP Console NF" + +# ghostty documents said setting true by default in Linux but macOS disabled. +# However it looks not enabled in Linux behaviors. And keeping same behaviors should be useful if I use same tool in multuple environments. +copy-on-select = true From f0e29afae8ba56236b858ba153c988e1abf69051 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 19:16:29 +0900 Subject: [PATCH 08/10] Fix ghostty copy-on-select on NixOS --- config/ghostty/config.common | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/ghostty/config.common b/config/ghostty/config.common index 60949ef7..fabc18fc 100644 --- a/config/ghostty/config.common +++ b/config/ghostty/config.common @@ -22,5 +22,6 @@ theme = ForestBlue font-family = "PlemolJP Console NF" # ghostty documents said setting true by default in Linux but macOS disabled. -# However it looks not enabled in Linux behaviors. And keeping same behaviors should be useful if I use same tool in multuple environments. -copy-on-select = true +# However keeping same behaviors should be useful if I use same tool in multuple environments. +# And just setting `true` did not work on my GNOME +copy-on-select = clipboard From b1167b260ae10fd019a7f68dd6538d871f331c68 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 19:27:48 +0900 Subject: [PATCH 09/10] Uninstall kitty except the terminfo --- home-manager/darwin.nix | 1 - home-manager/genericLinux.nix | 6 ++++-- home-manager/gnome.nix | 7 +++---- home-manager/terminals.nix | 25 +------------------------ nixos/desktop/default.nix | 2 -- 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index f4606cfa..18cac147 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -33,7 +33,6 @@ pinentry_mac # alacritty # Don't install macOS alacritty with nixpkgs. Alacritty often changes schema and I'm negative to use latest until https://github.com/NixOS/nixpkgs/issues/107466 - kitty # Don't install firefox via nixpkgs for darwin, it is broken https://github.com/NixOS/nixpkgs/blob/bac526a0fe6da6b10cfe2454f62a0defdbf1d898/pkgs/applications/networking/browsers/firefox/packages.nix#L23 diff --git a/home-manager/genericLinux.nix b/home-manager/genericLinux.nix index 92e11252..f2d8feca 100644 --- a/home-manager/genericLinux.nix +++ b/home-manager/genericLinux.nix @@ -6,9 +6,11 @@ home = { sessionVariables = { - # Make it possible to handle "xterm-kitty" in SSH remotes or lima guest VM with tiny filesize and setups. See GH-932 + # Make it possible to handle special terminfo such as "xterm-kitty" in SSH remotes or lima guest VM with tiny filesize and setups. See GH-932 # - # Don't set this in NixOS desktop. It has own value. + # - Don't set this in NixOS desktop. It has own value + # - Don't include `pkgs.ANYTTY` to avoid the build and or download large package. Use `pkgs.ANYTTY.terminfo` + # - Don't remove termnfo even if it is outdated TERMINFO_DIRS = "${pkgs.kitty.terminfo}/share/terminfo:${pkgs.unstable.ghostty.terminfo}/share/terminfo"; }; }; diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 77f49b60..2a4d4e26 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -41,8 +41,7 @@ in ); favorite-apps = [ - "kitty.desktop" - "com.mitchellh.ghostty.desktop" + "com.mitchellh.ghostty.desktop" # FIXME: No icon "dev.zed.Zed.desktop" "google-chrome.desktop" "podman-desktop.desktop" @@ -55,7 +54,7 @@ in # https://unix.stackexchange.com/questions/481142/launch-default-terminal-emulator-by-command "org/gnome/desktop/default-applications/terminal" = { - exec = lib.getExe pkgs.kitty; + exec = lib.getExe pkgs.unstable.ghostty; # exec-arg=""; }; @@ -154,7 +153,7 @@ in "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { name = "Terminal"; binding = "t"; - command = lib.getExe pkgs.kitty; + command = lib.getExe pkgs.unstable.ghostty; }; "org/gnome/shell/extensions/clipboard-history" = { diff --git a/home-manager/terminals.nix b/home-manager/terminals.nix index c92b2f1d..ee9c9de3 100644 --- a/home-manager/terminals.nix +++ b/home-manager/terminals.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: { xdg = { @@ -19,27 +19,4 @@ }; }; }; - - # https://github.com/nix-community/home-manager/blob/release-24.11/modules/programs/kitty.nix - programs.kitty = { - enable = true; - package = pkgs.emptyDirectory; - themeFile = "zenwritten_dark"; # basename in a file of https://github.com/kovidgoyal/kitty-themes/tree/master/themes - settings = { - shell = lib.getExe pkgs.zsh; - cursor_shape = "beam"; - cursor_blink_interval = 0; - copy_on_select = "clipboard"; - tab_bar_edge = "top"; - # tab_bar_style = "separator"; - # tab_separator = " | "; - tab_bar_style = "slant"; - }; - - # Avoiding a home-manager definition bug for rejecting all float. - # https://github.com/nix-community/home-manager/issues/4850 - extraConfig = '' - background_opacity 0.85 - ''; - }; } diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 603bf71e..2c87de15 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -132,8 +132,6 @@ # https://github.com/NixOS/nixpkgs/issues/33282 xdg-user-dirs - kitty - cyme lshw From 499957f24ff9b1e65db57422ff4aab4ffcd3edad Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Dec 2024 19:36:46 +0900 Subject: [PATCH 10/10] Update comment for gnome dock icons --- home-manager/gnome.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 2a4d4e26..53451f38 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -40,8 +40,9 @@ in ] ); + # Might be needed to reboot to enable icons favorite-apps = [ - "com.mitchellh.ghostty.desktop" # FIXME: No icon + "com.mitchellh.ghostty.desktop" "dev.zed.Zed.desktop" "google-chrome.desktop" "podman-desktop.desktop"