From 0c1181e51a9d3fcb4b9ab3c5d18829ac29c41e29 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 25 May 2024 03:27:23 +0200 Subject: [PATCH] alacritty -> foot --- modules/base/fish.nix | 21 +++++++++++-- modules/desktop/alacritty.nix | 22 ------------- modules/desktop/default.nix | 4 +-- modules/desktop/foot.nix | 59 +++++++++++++++++++++++++++++++++++ modules/desktop/sway.nix | 2 +- 5 files changed, 80 insertions(+), 28 deletions(-) delete mode 100644 modules/desktop/alacritty.nix create mode 100644 modules/desktop/foot.nix diff --git a/modules/base/fish.nix b/modules/base/fish.nix index a7c8e98..bb23d21 100644 --- a/modules/base/fish.nix +++ b/modules/base/fish.nix @@ -8,13 +8,28 @@ programs.fish = { enable = true; interactiveShellInit = '' - # fzf: use ctrl+f to list files and ctrl+g to show the git log - fzf_configure_bindings --directory=\cf --git_log=\cg + # Allow jumping between prompts (ctrl+shift+z/x) in foot. + # https://codeberg.org/dnkl/foot/wiki#jumping-between-prompts + function mark_prompt_start --on-event fish_prompt + echo -en "\e]133;A\e\\" + end - # allows 's foo bar' for 'nix shell nixpkgs#foo nixpkgs#bar' + # Allow piping last command's output (ctrl+shift+g) in foot. + # https://codeberg.org/dnkl/foot/wiki#piping-last-command-s-output + function foot_cmd_start --on-event fish_preexec + echo -en "\e]133;C\e\\" + end + function foot_cmd_end --on-event fish_postexec + echo -en "\e]133;D\e\\" + end + + # Allows 's foo bar' for 'nix shell nixpkgs#foo nixpkgs#bar' function s --wraps 'nix shell' nix shell nixpkgs#$argv end + + # fzf: use ctrl+f to list files and ctrl+g to show the git log + fzf_configure_bindings --directory=\cf --git_log=\cg ''; }; diff --git a/modules/desktop/alacritty.nix b/modules/desktop/alacritty.nix deleted file mode 100644 index e075411..0000000 --- a/modules/desktop/alacritty.nix +++ /dev/null @@ -1,22 +0,0 @@ -{home-manager, ...}: { - # Terminal emulator - # https://wiki.archlinux.org/title/Alacritty - - home-manager.users.caspervk = { - programs.alacritty = { - enable = true; - settings = { - key_bindings = [ - # It's easy to open a new terminal using Mod+Enter in sway, but it - # always opens in the home directly. This binds Control+Shift+Enter - # to open a new terminal in the current directory. - { - key = "Return"; - mods = "Control|Shift"; - action = "SpawnNewInstance"; - } - ]; - }; - }; - }; -} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 12dfe51..5388e5d 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,15 +1,15 @@ {...}: { imports = [ - ./alacritty.nix ./clipman.nix ./flatpak.nix + ./foot.nix ./gammastep.nix ./network.nix ./pipewire.nix ./programs.nix + ./rofi.nix ./ssh.nix ./sway.nix ./virtd.nix - ./rofi.nix ]; } diff --git a/modules/desktop/foot.nix b/modules/desktop/foot.nix new file mode 100644 index 0000000..a1ed101 --- /dev/null +++ b/modules/desktop/foot.nix @@ -0,0 +1,59 @@ +{ + home-manager, + nixpkgs-unstable, + ... +}: { + # Terminal emulator + # https://codeberg.org/dnkl/foot + home-manager.users.caspervk = { + programs.foot = { + enable = true; + # TODO: remove version override in NixOS v24.04 + package = nixpkgs-unstable.legacyPackages.x86_64-linux.foot; + # https://man.archlinux.org/man/foot.ini.5.en + settings = { + main = { + font = "monospace:size=10.25"; + letter-spacing = "1"; + }; + colors = { + # https://alacritty.org/config-alacritty.html + foreground = "d8d8d8"; + background = "181818"; + regular0 = "181818"; # black + regular1 = "ac4242"; # red + regular2 = "90a959"; # green + regular3 = "f4bf75"; # yellow + regular4 = "6a9fb5"; # blue + regular5 = "aa759f"; # magenta + regular6 = "75b5aa"; # cyan + regular7 = "d8d8d8"; # white + bright0 = "6b6b6b"; # black + bright1 = "c55555"; # red + bright2 = "aac474"; # green + bright3 = "feca88"; # yellow + bright4 = "82b8c8"; # blue + bright5 = "c28cb8"; # magenta + bright6 = "93d3c3"; # cyan + bright7 = "f8f8f8"; # white + dim0 = "0f0f0f"; # black + dim1 = "712b2b"; # red + dim2 = "5f6f3a"; # green + dim3 = "a17e4d"; # yellow + dim4 = "456877"; # blue + dim5 = "704d68"; # magenta + dim6 = "4d7770"; # cyan + dim7 = "8e8e8e"; # white + }; + key-bindings = { + # HOW is this not the default? + scrollback-home = "Shift+Home"; + scrollback-end = "Shift+End"; + # Pipe last command's output to the clipboard. Requires fish + # integration, configured in modules/base/fish.nix. + pipe-command-output = "[wl-copy] Control+Shift+g"; + }; + }; + }; + }; +} diff --git a/modules/desktop/sway.nix b/modules/desktop/sway.nix index a8df370..715decd 100644 --- a/modules/desktop/sway.nix +++ b/modules/desktop/sway.nix @@ -117,7 +117,7 @@ text = "#ffffff"; }; }; - terminal = "alacritty"; + terminal = "foot"; bars = [{command = "${pkgs.waybar}/bin/waybar";}]; };