Add tmux service
This commit is contained in:
parent
bb9b00bcde
commit
d9e7ff98fc
3 changed files with 73 additions and 0 deletions
|
@ -47,6 +47,7 @@ with lib;
|
||||||
"mullvad"
|
"mullvad"
|
||||||
"pipewire"
|
"pipewire"
|
||||||
"podman"
|
"podman"
|
||||||
|
"tmux"
|
||||||
"udev"
|
"udev"
|
||||||
];
|
];
|
||||||
firewall = {
|
firewall = {
|
||||||
|
|
|
@ -46,6 +46,7 @@ in
|
||||||
"nextcloud"
|
"nextcloud"
|
||||||
"nginx"
|
"nginx"
|
||||||
"openssh"
|
"openssh"
|
||||||
|
"tmux"
|
||||||
"tt-rss"
|
"tt-rss"
|
||||||
];
|
];
|
||||||
vHosts =
|
vHosts =
|
||||||
|
|
71
services/tmux.nix
Normal file
71
services/tmux.nix
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
lib.mkIf (lib.elem "tmux" config.machine.services) {
|
||||||
|
programs.tmux =
|
||||||
|
let
|
||||||
|
kanagawa = pkgs.tmuxPlugins.mkTmuxPlugin {
|
||||||
|
pluginName = "kanagawa";
|
||||||
|
version = "1.0";
|
||||||
|
src = pkgs.fetchFromGitea {
|
||||||
|
domain = "git.ophanim.de";
|
||||||
|
owner = "derped";
|
||||||
|
repo = "tmux-kanagawa";
|
||||||
|
rev = "1b0df5b27057bd6f8d1b8f720764f37c80ac9d16";
|
||||||
|
hash = "sha256-bwOv7/GYP+C3QDCZxiikUaEaaAyX5YdYNkNBqcVs/bU=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
clock24 = true;
|
||||||
|
baseIndex = 1;
|
||||||
|
extraConfigBeforePlugins = # tmux
|
||||||
|
''
|
||||||
|
# kanagawa
|
||||||
|
set -g @kanagawa-show-battery false
|
||||||
|
set -g @kanagawa-show-powerline true
|
||||||
|
set -g @kanagawa-plugins "playerctl cpu-usage ram-usage"
|
||||||
|
set -g @kanagawa-refresh-rate 10
|
||||||
|
|
||||||
|
# vim-tmux-navigator
|
||||||
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||||
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
|
||||||
|
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
|
||||||
|
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
|
||||||
|
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
|
||||||
|
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
|
||||||
|
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||||
|
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||||
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||||
|
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||||
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||||
|
|
||||||
|
bind-key -T copy-mode-vi 'M-h' select-pane -L
|
||||||
|
bind-key -T copy-mode-vi 'M-j' select-pane -D
|
||||||
|
bind-key -T copy-mode-vi 'M-k' select-pane -U
|
||||||
|
bind-key -T copy-mode-vi 'M-l' select-pane -R
|
||||||
|
bind-key -T copy-mode-vi 'M-\' select-pane -l
|
||||||
|
|
||||||
|
|
||||||
|
bind -n 'M-p' previous-window
|
||||||
|
bind -n 'M-n' next-window
|
||||||
|
'';
|
||||||
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
|
sensible
|
||||||
|
kanagawa
|
||||||
|
vim-tmux-navigator
|
||||||
|
];
|
||||||
|
extraConfig = # tmux
|
||||||
|
''
|
||||||
|
# Fix colors
|
||||||
|
set-option -sa terminal-overrides ",xterm*:Tc"
|
||||||
|
# Enable mouse interactions (scroll buffer)
|
||||||
|
set -g mouse on
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue