Tmux : Use nix color.

This commit is contained in:
Dmitry Voronin 2024-04-02 20:34:27 +03:00
parent 87d4ff0ab6
commit b5ac32db10
5 changed files with 30 additions and 20 deletions

View file

@ -112,6 +112,7 @@
aqua = "689d68";
bg = "1d2021";
bg_1 = "504945";
bg_2 = "3c3836";
blue = "458588";
blue_faded = "076678";
darkgray = "282828";
@ -133,6 +134,7 @@
./module/common/Bootloader.nix
./module/common/Distrobox.nix
./module/common/Dotfiles.nix
./module/common/Environment.nix
./module/common/Filesystem.nix
./module/common/Firefox.nix
./module/common/Firewall.nix

View file

@ -1,5 +1,6 @@
{ pkgs, inputs, const, ... }: let
{ pkgs, inputs, const, color, ... }: let
homePath = "/data/data/com.termux.nix/files/home";
tmuxScript = pkgs.writeShellScriptBin "tmux_script" (builtins.readFile ./common/tmux/Script.sh);
in {
# NOTE: Split into modules?
environment.packages = with pkgs; [
@ -33,7 +34,7 @@ in {
ripgrep
rsync
sqlite
tmux
tmux tmuxScript
tree
utillinux
wget
@ -67,9 +68,9 @@ in {
NIXPKGS_ALLOW_UNFREE = "1";
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
TERM = "xterm-256color";
};
} // const // color;
programs.bash = {
enable = true;
enable = true;
bashrcExtra = ''
source $BASH_PATH/Bashrc.sh
[[ -f ~/.termux/font.ttf ]] || {
@ -80,8 +81,16 @@ in {
'';
};
programs.tmux = {
enable = true;
extraConfig = builtins.readFile ./common/tmux/tmux.conf;
enable = true;
extraConfig = ''
set -g @COLOR_BG "#${color.bg}"
set -g @COLOR_BG_1 "#${color.bg_1}"
set -g @COLOR_BG_2 "#${color.bg_2}"
set -g @COLOR_DARKGRAY "#${color.darkgray}"
set -g @COLOR_FG "#${color.fg}"
set -g @COLOR_GRAY "#${color.gray}"
set -g @COLOR_YELLOW "#${color.yellow}"
'' + (builtins.readFile ./common/tmux/tmux.conf);
};
programs.git = {
enable = true;

View file

@ -0,0 +1,3 @@
{ const, color, ... }: {
environment.variables = const // color;
}

View file

@ -1,13 +1,9 @@
{ pkgs, color, ... }: let
{ pkgs, ... }: let
script = pkgs.writeShellScriptBin "tmux_script" (builtins.readFile ./tmux/Script.sh);
in {
programs.tmux = {
enable = true;
extraConfig = ''
set -g @COLOR_BG #${color.bg}
set -g @COLOR_DARKGRAY #${color.darkgray}
set -g @COLOR_YELLOW #${color.yellow}
'' + (builtins.readFile ./tmux/tmux.conf);
extraConfig = builtins.readFile ./tmux/tmux.conf;
};
environment.systemPackages = [ script ];
}

View file

@ -16,16 +16,16 @@ bind -n M-n send-keys Pagedown
# Copy mode.
setw -g mode-keys vi
bind -n M-v copy-mode
bind -n M-P choose-buffer
bind -n M-P choose-buffer;
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
# Selection style.
set -g mode-style "fg=#{@COLOR_DARKGRAY} bg=#{@COLOR_YELLOW} bold"
set -g mode-style "fg=#$darkgray bg=#$yellow bold"
# Pane style.
set -g pane-border-style "fg=#504945"
set -g pane-active-border-style "fg=#504945"
set -g pane-border-style "fg=#$bg_1"
set -g pane-active-border-style "fg=#$bg_1"
# Remap split keys.
bind -n M-\\ split-window -h -c "#{pane_current_path}"
@ -68,16 +68,16 @@ bind-key -n M-f run-shell 'tmux_script togglestatusbar'
set -g status-interval 2
set -g status-position bottom
set -g status-justify left
set -g status-style "bg=#3c3836 fg=#a89984"
set -g status-style "bg=#$bg_2 fg=#$gray"
set -g status-left "#[bold,bg=#a89984,fg=#282828] #H-#S #(tmux_script client_count #S)#[bg=#3c3836,fg=#a89984]"
set -g status-left "#[bold,bg=#$gray,fg=#$darkgray] #H-#S #(tmux_script client_count #S)#[bg=#$bg_2,fg=#$gray]"
set -g status-left-length 50
set -g status-right-length 50
set -g status-right "#(tmux_script statusbar) %d %a #[fg=#a89984]#[bold,bg=#a89984,fg=#282828] %H:%M "
set -g status-right "#(tmux_script statusbar) %d %a #[fg=#$gray]#[bold,bg=#$gray,fg=#$darkgray] %H:%M "
set-window-option -g window-status-separator ""
setw -g window-status-current-style "fg=#ebdbb2 bold"
setw -g window-status-current-style "fg=#$fg bold"
setw -g window-status-current-format " #W "
setw -g window-status-style ""