summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home/common/home.nix1
-rw-r--r--home/common/modules/tmux.nix47
-rw-r--r--os/common/configuration.nix1
-rw-r--r--os/common/modules/tmux.nix42
4 files changed, 48 insertions, 43 deletions
diff --git a/home/common/home.nix b/home/common/home.nix
index 2202ee2..276ffcf 100644
--- a/home/common/home.nix
+++ b/home/common/home.nix
@@ -3,6 +3,7 @@
in {
imports = [
./modules/git.nix
+ ./modules/tmux.nix
./modules/shell.nix
./modules/xdgdirs.nix
./modules/mimeapps.nix
diff --git a/home/common/modules/tmux.nix b/home/common/modules/tmux.nix
new file mode 100644
index 0000000..20fecd5
--- /dev/null
+++ b/home/common/modules/tmux.nix
@@ -0,0 +1,47 @@
+{ pkgs, lib, ... }: {
+ home.packages = with pkgs; [ tmux ];
+
+ home.sessionVariables.TMUX_TMPDIR =
+ ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';
+ programs.bash.initExtra = lib.mkOrder 2000 ''
+ if [ -z "$TMUX" ] &&
+ { [ -n "$WAYLAND_DISPLAY" ] || [ -n "$SSH_TTY" ]; }; then
+ exec tmux new-session -A > /dev/null 2>&1
+ fi
+ '';
+
+ xdg.configFile."tmux/tmux.conf".text = ''
+ # base
+ set-option -g prefix C-a
+ unbind-key C-b
+ bind-key C-a send-prefix
+ set -g base-index 1
+ setw -g pane-base-index 1
+ set -g history-limit 10000
+
+ # vim
+ set -g mode-keys vi
+ bind -T copy-mode-vi v send -X begin-selection
+ bind -T copy-mode-vi y send -X copy-selection
+ bind -r C-w last-window
+
+ bind -r h select-pane -L
+ bind -r j select-pane -D
+ bind -r k select-pane -U
+ bind -r l select-pane -R
+
+ bind -r H resize-pane -L 5
+ bind -r J resize-pane -D 5
+ bind -r K resize-pane -U 5
+ bind -r L resize-pane -R 5
+
+ bind -r C-h select-window -t :-
+ bind -r C-l select-window -t :+
+
+ # not eye candy
+ set -g status-style "bg=default fg=7"
+ set -g status-left ""
+ set -g status-right ""
+ set -g status-justify right
+ '';
+}
diff --git a/os/common/configuration.nix b/os/common/configuration.nix
index 615dbed..16f6c4d 100644
--- a/os/common/configuration.nix
+++ b/os/common/configuration.nix
@@ -6,7 +6,6 @@ in {
"services/mail/stalwart-mail.nix"
];
imports = [
- ./modules/tmux.nix
./modules/nix.nix
./modules/user.nix
./modules/environment.nix
diff --git a/os/common/modules/tmux.nix b/os/common/modules/tmux.nix
deleted file mode 100644
index eeaafbb..0000000
--- a/os/common/modules/tmux.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ pkgs, ... }:
-
-{
- environment = {
- systemPackages = with pkgs; [ tmux ];
-
- etc."tmux.conf".text = ''
- # base
- set-option -g prefix C-a
- unbind-key C-b
- bind-key C-a send-prefix
- set -g base-index 1
- setw -g pane-base-index 1
- set -g history-limit 10000
-
- # vim
- set -g mode-keys vi
- bind -T copy-mode-vi v send -X begin-selection
- bind -T copy-mode-vi y send -X copy-selection
- bind -r C-w last-window
-
- bind -r h select-pane -L
- bind -r j select-pane -D
- bind -r k select-pane -U
- bind -r l select-pane -R
-
- bind -r H resize-pane -L 5
- bind -r J resize-pane -D 5
- bind -r K resize-pane -U 5
- bind -r L resize-pane -R 5
-
- bind -r C-h select-window -t :-
- bind -r C-l select-window -t :+
-
- # not eye candy
- set -g status-style "bg=default fg=7"
- set -g status-left ""
- set -g status-right ""
- set -g status-justify right
- '';
- };
-}