mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
added tmux module
This commit is contained in:
parent
3e3d67e6bd
commit
37f704cc19
11 changed files with 101 additions and 13 deletions
|
|
@ -26,9 +26,10 @@ in
|
|||
eza = {
|
||||
enable = true;
|
||||
enableAliases = true;
|
||||
} // optionalAttrs wm.enable {
|
||||
icons = true;
|
||||
};
|
||||
#// optionalAttrs wm.enable {
|
||||
# icons = true;
|
||||
#};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
./git
|
||||
./gui
|
||||
./security
|
||||
./tmux
|
||||
./utils
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,22 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
tmux = config.modules.user.tmux;
|
||||
|
||||
in
|
||||
''
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec sway
|
||||
fi
|
||||
case $- in
|
||||
*i*)
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec sway
|
||||
fi
|
||||
|
||||
${optionalString tmux.enable ''
|
||||
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
|
||||
exec tmux
|
||||
fi
|
||||
''}
|
||||
;;
|
||||
esac
|
||||
''
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ in
|
|||
'';
|
||||
|
||||
config = {
|
||||
fonts = {
|
||||
names = [ "Terminus" ];
|
||||
};
|
||||
|
||||
output = {
|
||||
HDMI-A-1 = {
|
||||
resolution = "1920x1080";
|
||||
|
|
@ -49,8 +53,8 @@ in
|
|||
{
|
||||
position = "top";
|
||||
statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done'';
|
||||
fonts = {
|
||||
names = [ "Noto Sans" ];
|
||||
fonts = {
|
||||
names = [ "Terminus" ];
|
||||
size = 10.0;
|
||||
};
|
||||
colors = {
|
||||
|
|
@ -82,6 +86,9 @@ in
|
|||
"${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' '';
|
||||
"${modifier}+Shift+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'";
|
||||
"${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji";
|
||||
"${modifier}+Shift+Return" = ''
|
||||
exec alacritty --working-directory -e $(pwd)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ in
|
|||
};
|
||||
|
||||
programs.bash = {
|
||||
profileExtra = import ./config/shellHook.nix;
|
||||
profileExtra = import ./config/shellHook.nix { inherit config lib; };
|
||||
shellAliases = {
|
||||
open = "xdg-open";
|
||||
};
|
||||
|
|
|
|||
9
src/user/modules/tmux/config/shellHook.nix
Normal file
9
src/user/modules/tmux/config/shellHook.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
''
|
||||
case $- in
|
||||
*i*)
|
||||
if [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
|
||||
exec tmux
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
''
|
||||
10
src/user/modules/tmux/config/tmux.nix
Normal file
10
src/user/modules/tmux/config/tmux.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
''
|
||||
bind -n M-C source-file ~/.config/tmux/tmux.conf
|
||||
|
||||
bind-key -n M-h select-pane -L
|
||||
bind-key -n M-j select-pane -D
|
||||
bind-key -n M-k select-pane -U
|
||||
bind-key -n M-l select-pane -R
|
||||
|
||||
bind-key -n M-q kill-pane
|
||||
''
|
||||
41
src/user/modules/tmux/default.nix
Normal file
41
src/user/modules/tmux/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.tmux;
|
||||
gui = config.modules.user.gui.wm;
|
||||
|
||||
wm = {
|
||||
enable = builtins.any (mod: mod.enable or false) (builtins.attrValues gui);
|
||||
};
|
||||
|
||||
in
|
||||
{ options.modules.user.tmux = { enable = mkEnableOption "Enable tmux module"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.bash = mkIf (!wm.enable) {
|
||||
profileExtra = import ./config/shellHook.nix;
|
||||
};
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
newSession = true;
|
||||
disableConfirmationPrompt = true;
|
||||
keyMode = "vi";
|
||||
mouse = if wm.enable then true else false;
|
||||
|
||||
prefix = "M";
|
||||
shell = "\${pkgs.bash}/bin/bash";
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
{
|
||||
plugin = tilish;
|
||||
extraConfig = ''
|
||||
set -g @tilish-default 'tiled'
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = import ./config/tmux.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ nnoremap <leader>ga :Git add<CR>
|
|||
nnoremap <leader>gc :Git commit<CR>
|
||||
nnoremap <leader>gd :Git diff<CR>
|
||||
|
||||
nnoremap <leader>e :Explore<CR>
|
||||
nnoremap <leader>e :Ex<CR>
|
||||
nnoremap <leader>/ :Rg<Space>
|
||||
|
||||
nnoremap <leader>bd :bd<CR>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue