This commit is contained in:
Hoang Nguyen 2021-11-17 21:12:05 +07:00
parent f840bd5b2d
commit a0d4b532a5
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
3 changed files with 133 additions and 2 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2021 FollieHiyuki
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,3 +1,7 @@
# tmux-nordone
Nord/OneDark status bar for tmux
A refactor fork of [tmux-power](https://github.com/wfxr/tmux-power), focusing on Nord and OneDark colorschemes.
# License
MIT

127
tmux-nordone.tmux Normal file
View File

@ -0,0 +1,127 @@
#!/usr/bin/env bash
# $1: option
# $2: default value
tmux_get() {
local value="$(tmux show -gqv "$1")"
[ -n "$value" ] && echo "$value" || echo "$2"
}
# $1: option
# $2: value
tmux_set() {
tmux set-option -gq "$1" "$2"
}
# Options
right_arrow_icon=$(tmux_get '@tmux_nordone_right_arrow_icon' '')
left_arrow_icon=$(tmux_get '@tmux_nordone_left_arrow_icon' '')
session_icon="$(tmux_get '@tmux_nordone_session_icon' '')"
user_icon="$(tmux_get '@tmux_nordone_user_icon' '')"
time_icon="$(tmux_get '@tmux_nordone_time_icon' '')"
date_icon="$(tmux_get '@tmux_nordone_date_icon' '')"
prefix_highlight_pos="$(tmux_get @tmux_nordone_prefix_highlight_pos 'R')"
time_format="$(tmux_get @tmux_nordone_time_format '%T')"
date_format="$(tmux_get @tmux_nordone_date_format '%F')"
# Theme option: 'nord' or 'onedark'
TC="$(tmux_get '@tmux_nordone_theme' 'nord')"
case $TC in
'nord')
TC='#81a1c1'
G01='#2e3440'
G02='#3b4252'
G03='#434c5e'
G04='#4c566a'
G05='#d8dee9'
G06='#eceff4'
FG="$G05"
BG="$G02"
;;
'onedark')
TC='#61afef'
G01='#282c34'
G02='#3e4452'
G03='#4b5263'
G04='#5c6470'
G05='#abb2bf'
G06='#dfdfdf'
FG="$G05"
BG="$G02"
;;
esac
# Status options
tmux_set status-interval 1
tmux_set status on
# Basic status bar colors
tmux_set status-fg "$FG"
tmux_set status-bg "$BG"
tmux_set status-attr none
# tmux-prefix-highlight
tmux_set @prefix_highlight_fg "$BG"
tmux_set @prefix_highlight_bg "$FG"
tmux_set @prefix_highlight_show_copy_mode 'on'
tmux_set @prefix_highlight_copy_mode_attr "fg=$TC,bg=$BG,bold"
tmux_set @prefix_highlight_output_prefix "#[fg=$TC]#[bg=$BG]$left_arrow_icon#[bg=$TC]#[fg=$BG]"
tmux_set @prefix_highlight_output_suffix "#[fg=$TC]#[bg=$BG]$right_arrow_icon"
# Left side of status bar
tmux_set status-left-bg "$G02"
tmux_set status-left-fg "$G06"
tmux_set status-left-length 150
user="$(whoami)"
LS="#[fg=$G01,bg=$TC,bold] $user_icon $user@#h #[fg=$TC,bg=$G03,nobold]$right_arrow_icon#[fg=$TC,bg=$G03] $session_icon #S "
if [[ $prefix_highlight_pos == 'L' || $prefix_highlight_pos == 'LR' ]]; then
LS="$LS#{prefix_highlight}"
fi
tmux_set status-left "$LS"
# Right side of status bar
tmux_set status-right-bg "$G02"
tmux_set status-right-fg "$G06"
tmux_set status-right-length 150
RS="#[fg=$TC,bg=$G03] $time_icon $time_format #[fg=$TC,bg=$G03]$left_arrow_icon#[fg=$G01,bg=$TC] $date_icon $date_format "
if [[ $prefix_highlight_pos == 'R' || $prefix_highlight_pos == 'LR' ]]; then
RS="#{prefix_highlight}$RS"
fi
tmux_set status-right "$RS"
# Window status
tmux_set window-status-format " #I:#W#F "
tmux_set window-status-current-format "#[fg=$BG,bg=$TC]$right_arrow_icon#[fg=$G01,bg=$TC,bold] #I:#W#F #[fg=$TC,bg=$BG,nobold]$right_arrow_icon"
# Window separator
tmux_set window-status-separator ""
# Window status alignment
tmux_set status-justify centre
# Current window status
tmux_set window-status-current-statys "fg=$TC,bg=$BG"
# Pane border
tmux_set pane-border-style "fg=$G04,bg=default"
# Active pane border
tmux_set pane-active-border-style "fg=$TC,bg=$BG"
# Pane number indicator
tmux_set display-panes-colour "$G03"
tmux_set display-panes-active-colour "$TC"
# Clock mode
tmux_set clock-mode-colour "$TC"
tmux_set clock-mode-style 24
# Message
tmux_set message-style "fg=$TC,bg=$BG"
# Command message
tmux_set message-command-style "fg=$TC,bg=$BG"
# Copy mode highlight
tmux_set mode-style "bg=$TC,fg=$FG"