diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index b65da1b1..a4892c9b 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -65,6 +65,11 @@ let bind C-${cfg.shortcut} last-window ''} + ${optionalString cfg.disableConfirmationPrompt '' + bind-key & kill-window + bind-key x kill-pane + ''} + setw -g aggressive-resize ${boolToStr cfg.aggressiveResize} setw -g clock-mode-style ${if cfg.clock24 then "24" else "12"} set -s escape-time ${toString cfg.escapeTime} @@ -109,6 +114,14 @@ in ''; }; + disableConfirmationPrompt = mkOption { + default = false; + type = types.bool; + description = '' + Disable confirmation prompt before killing a pane or window + ''; + }; + enable = mkEnableOption "tmux"; escapeTime = mkOption { diff --git a/tests/modules/programs/tmux/default.nix b/tests/modules/programs/tmux/default.nix index 16d6d63e..d4501c60 100644 --- a/tests/modules/programs/tmux/default.nix +++ b/tests/modules/programs/tmux/default.nix @@ -3,4 +3,5 @@ tmux-not-enabled = ./not-enabled.nix; tmux-vi-all-true = ./vi-all-true.nix; tmux-secure-socket-enabled = ./secure-socket-enabled.nix; + tmux-disable-confirmation-prompt = ./disable-confirmation-prompt.nix; } diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.conf b/tests/modules/programs/tmux/disable-confirmation-prompt.conf new file mode 100644 index 00000000..b599e603 --- /dev/null +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.conf @@ -0,0 +1,31 @@ +# ============================================= # +# Start with defaults from the Sensible plugin # +# --------------------------------------------- # +run-shell @sensible_rtp@ +# ============================================= # + +set -g default-terminal "screen" +set -g base-index 0 +setw -g pane-base-index 0 + + + + + +set -g status-keys emacs +set -g mode-keys emacs + + + + + +bind-key & kill-window +bind-key x kill-pane + + +setw -g aggressive-resize off +setw -g clock-mode-style 12 +set -s escape-time 500 +set -g history-limit 2000 + + diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix new file mode 100644 index 00000000..82c53438 --- /dev/null +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + substituteExpected = path: pkgs.substituteAll { + src = path; + + sensible_rtp = pkgs.tmuxPlugins.sensible.rtp; + }; + +in + +{ + config = { + programs.tmux = { + enable = true; + disableConfirmationPrompt = true; + }; + + nmt.script = '' + assertFileExists home-files/.tmux.conf + assertFileContent home-files/.tmux.conf \ + ${substituteExpected ./disable-confirmation-prompt.conf} + ''; + }; +} diff --git a/tests/modules/programs/tmux/emacs-with-plugins.conf b/tests/modules/programs/tmux/emacs-with-plugins.conf index 039ae740..b047c97a 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.conf +++ b/tests/modules/programs/tmux/emacs-with-plugins.conf @@ -21,6 +21,8 @@ set -g mode-keys emacs + + setw -g aggressive-resize on setw -g clock-mode-style 24 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/vi-all-true.conf b/tests/modules/programs/tmux/vi-all-true.conf index 15bbc910..08e37e19 100644 --- a/tests/modules/programs/tmux/vi-all-true.conf +++ b/tests/modules/programs/tmux/vi-all-true.conf @@ -21,6 +21,8 @@ set -g mode-keys vi + + setw -g aggressive-resize on setw -g clock-mode-style 24 set -s escape-time 500