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
|
|
@ -23,6 +23,8 @@
|
||||||
gpg.enable = true;
|
gpg.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tmux.enable = true;
|
||||||
|
|
||||||
utils = {
|
utils = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dev.enable = true;
|
dev.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fonts.packages = with pkgs; [
|
#fonts.packages = with pkgs; [
|
||||||
terminus_font
|
# terminus_font
|
||||||
terminus-nerdfont
|
# terminus-nerdfont
|
||||||
];
|
#];
|
||||||
|
|
||||||
security.sudo = {
|
security.sudo = {
|
||||||
wheelNeedsPassword = false;
|
wheelNeedsPassword = false;
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,10 @@ in
|
||||||
eza = {
|
eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = true;
|
||||||
} // optionalAttrs wm.enable {
|
|
||||||
icons = true;
|
|
||||||
};
|
};
|
||||||
|
#// optionalAttrs wm.enable {
|
||||||
|
# icons = true;
|
||||||
|
#};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
./git
|
./git
|
||||||
./gui
|
./gui
|
||||||
./security
|
./security
|
||||||
|
./tmux
|
||||||
./utils
|
./utils
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,22 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
tmux = config.modules.user.tmux;
|
||||||
|
|
||||||
|
in
|
||||||
''
|
''
|
||||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
case $- in
|
||||||
exec sway
|
*i*)
|
||||||
fi
|
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 = {
|
config = {
|
||||||
|
fonts = {
|
||||||
|
names = [ "Terminus" ];
|
||||||
|
};
|
||||||
|
|
||||||
output = {
|
output = {
|
||||||
HDMI-A-1 = {
|
HDMI-A-1 = {
|
||||||
resolution = "1920x1080";
|
resolution = "1920x1080";
|
||||||
|
|
@ -50,7 +54,7 @@ in
|
||||||
position = "top";
|
position = "top";
|
||||||
statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done'';
|
statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done'';
|
||||||
fonts = {
|
fonts = {
|
||||||
names = [ "Noto Sans" ];
|
names = [ "Terminus" ];
|
||||||
size = 10.0;
|
size = 10.0;
|
||||||
};
|
};
|
||||||
colors = {
|
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}+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+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'";
|
||||||
"${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji";
|
"${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 = {
|
programs.bash = {
|
||||||
profileExtra = import ./config/shellHook.nix;
|
profileExtra = import ./config/shellHook.nix { inherit config lib; };
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
open = "xdg-open";
|
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>gc :Git commit<CR>
|
||||||
nnoremap <leader>gd :Git diff<CR>
|
nnoremap <leader>gd :Git diff<CR>
|
||||||
|
|
||||||
nnoremap <leader>e :Explore<CR>
|
nnoremap <leader>e :Ex<CR>
|
||||||
nnoremap <leader>/ :Rg<Space>
|
nnoremap <leader>/ :Rg<Space>
|
||||||
|
|
||||||
nnoremap <leader>bd :bd<CR>
|
nnoremap <leader>bd :bd<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue