Skip to content

Commit

Permalink
tmux: mouse support (nix-community#3642)
Browse files Browse the repository at this point in the history
Co-authored-by: Sleroq <sleroq@sleroq.link>
  • Loading branch information
2 people authored and spacekookie committed Feb 10, 2023
1 parent 5a71dca commit 795c557
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/programs/tmux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ let
bind-key -N "Kill the current pane" x kill-pane
''}
set -g mouse ${boolToStr cfg.mouse}
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}
Expand Down Expand Up @@ -204,6 +205,8 @@ in {
description = "VI or Emacs style shortcuts.";
};

mouse = mkEnableOption "mouse support";

newSession = mkOption {
default = false;
type = types.bool;
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/default-shell.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -g mode-keys emacs



set -g mouse off
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
tmux-default-shell = ./default-shell.nix;
tmux-shortcut-without-prefix = ./shortcut-without-prefix.nix;
tmux-prefix = ./prefix.nix;
tmux-mouse-enabled = ./mouse-enabled.nix;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bind-key -N "Kill the current window" & kill-window
bind-key -N "Kill the current pane" x kill-pane


set -g mouse off
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/emacs-with-plugins.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -g mode-keys emacs



set -g mouse off
setw -g aggressive-resize on
setw -g clock-mode-style 24
set -s escape-time 500
Expand Down
29 changes: 29 additions & 0 deletions tests/modules/programs/tmux/mouse-enabled.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ============================================= #
# 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







set -g mouse on
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
set -g history-limit 2000

26 changes: 26 additions & 0 deletions tests/modules/programs/tmux/mouse-enabled.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }:

with lib;

{
config = {
programs.tmux = {
enable = true;
mouse = true;
};

nixpkgs.overlays = [
(self: super: {
tmuxPlugins = super.tmuxPlugins // {
sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; };
};
})
];

nmt.script = ''
assertFileExists home-files/.config/tmux/tmux.conf
assertFileContent home-files/.config/tmux/tmux.conf \
${./mouse-enabled.conf}
'';
};
}
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/prefix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bind -N "Send the prefix key through to the application" \



set -g mouse off
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/shortcut-without-prefix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bind C-a last-window



set -g mouse off
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/tmux/vi-all-true.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -g mode-keys vi



set -g mouse off
setw -g aggressive-resize on
setw -g clock-mode-style 24
set -s escape-time 500
Expand Down

0 comments on commit 795c557

Please sign in to comment.