diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 090e3830261d..a3ed649fb21e 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -100,6 +100,8 @@ - [Wakapi](https://wakapi.dev/), a time tracking software for programmers. Available as [services.wakapi](#opt-services.wakapi.enable). +- [foot](https://codeberg.org/dnkl/foot), a fast, lightweight and minimalistic Wayland terminal emulator. Available as [programs.foot](#opt-programs.foot.enable). + ## Backward Incompatibilities {#sec-release-24.11-incompatibilities} - `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage: diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1c20a06f7fba..a34a890c14ae 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -193,6 +193,7 @@ ./programs/fish.nix ./programs/flashrom.nix ./programs/flexoptix-app.nix + ./programs/foot ./programs/freetds.nix ./programs/fuse.nix ./programs/fzf.nix diff --git a/nixos/modules/programs/foot/bashrc b/nixos/modules/programs/foot/bashrc new file mode 100644 index 000000000000..126f54721259 --- /dev/null +++ b/nixos/modules/programs/foot/bashrc @@ -0,0 +1,27 @@ +osc7_cwd() { + local strlen=${#PWD} + local encoded="" + local pos c o + for (( pos=0; pos for available themes. + ''; + example = "aeroroot"; + }; + + enableBashIntegration = lib.mkEnableOption "foot bash integration" // { + default = true; + }; + + enableFishIntegration = lib.mkEnableOption "foot fish integration" // { + default = true; + }; + + enableZshIntegration = lib.mkEnableOption "foot zsh integration" // { + default = true; + }; + }; + + config = lib.mkIf cfg.enable { + environment = { + systemPackages = [ cfg.package ]; + etc."xdg/foot/foot.ini".source = settingsFormat.generate "foot.ini" cfg.settings; + }; + programs = { + foot.settings.main.include = lib.optionals (cfg.theme != null) [ + "${pkgs.foot.themes}/share/foot/themes/${cfg.theme}" + ]; + # https://codeberg.org/dnkl/foot/wiki#user-content-shell-integration + bash.interactiveShellInit = lib.mkIf cfg.enableBashIntegration ". ${./bashrc} # enable shell integration for foot terminal"; + fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration "source ${./config.fish} # enable shell integration for foot terminal"; + zsh.interactiveShellInit = lib.mkIf cfg.enableZshIntegration ". ${./zshrc} # enable shell integration for foot terminal"; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ linsui ]; + }; +} diff --git a/nixos/modules/programs/foot/zshrc b/nixos/modules/programs/foot/zshrc new file mode 100644 index 000000000000..a1d652a80ca4 --- /dev/null +++ b/nixos/modules/programs/foot/zshrc @@ -0,0 +1,25 @@ +function osc7-pwd() { + emulate -L zsh # also sets localoptions for us + setopt extendedglob + local LC_ALL=C + printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}} +} + +function chpwd-osc7-pwd() { + (( ZSH_SUBSHELL )) || osc7-pwd +} +add-zsh-hook -Uz chpwd chpwd-osc7-pwd + +precmd() { + print -Pn "\e]133;A\e\\" +} + +function precmd { + if ! builtin zle; then + print -n "\e]133;D\e\\" + fi +} + +function preexec { + print -n "\e]133;C\e\\" +}