Closed faxotherapy closed 4 years ago
you can use (in .tmux.conf
):
set -g @cpu_percentage_format "%3.0f%%"
set -g @gpu_percentage_format "%3.0f%%"
Note the 3.0
means [space][space]8
, [space]10
and 100
. If you only want to reserve 2 chars (and allow 100
to take an extra char) then use 2.0
Hi, thanks for your reply. Unfortunately, it does not work. Is there any specific order in tmux.conf
where I should put this setting, because as such, it does no work. What I'd like is having the CPU label not moving all the time, because it causes some distraction.
you need to reload https://sanctum.geek.nz/arabesque/reloading-tmux-config/
Thanks for the tip, but it does not work either. I'm running tmux 2.8
@faxotherapy can you share your config files please?
My config:
# Terminfo
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Pass xterm-style keys
# Make many key combinations work as expected.
# Example: enable C-arrow_keys in tmux, bash, emacs and other programs.
setw -g xterm-keys on
# Use of client system's clipboard during SSH connexion
set -g @override_copy_command '/usr/bin/nc localhost 9997'
# Prefix key set to C-q
set -g prefix C-q
unbind C-b
bind C-q send-prefix
# Prefix + r key to reload the configuration in the current session
unbind r
bind r source-file ~/.tmux.conf \; display "Configuration reloaded!"
# Turn mouse on
set -g mouse on
# Vim command-style mode under copy mode
set-window-option -g mode-keys vi
# Increase repeat time for repeatable commands
# (if key has been bound with bind-key -r)
# unix.stackexchange.com/a/372788
set -g repeat-time 1000
# Increase scroll-back history limit (to make panes remember more lines)
set -g history-limit 10000
# Activity monitoring (to highlight window when it has new activity)
setw -g monitor-activity on
# No message number shown in the activity window
set -g visual-activity off
# No bells
set -g bell-action none
#
# Status Bar
#
# Enable UTF-8 support
set -gq status-utf8 on
# Position
set -g status-position top
set -g status-justify left # centre
# Update interval
set -g status-interval 5
# Window separator
set -g window-status-separator ""
# Window format
set -g window-status-format '#I›#W#F '
set -g window-status-current-format '#I»#W#F '
# Window numbering starts at 1 (instead of 0)
set -g base-index 1
# Windows automatically renumbered after one is closed
set -g renumber-windows on
# Windows not renamed automatically
set-option -g allow-rename off
#
# Windows
#
# Create new window with current path
bind c new-window -c "#{pane_current_path}"
# Window navigation
# C-q + p or n keys to switch windows
# (already used by tmux-sensible)
#bind -n C-p previous-window
#bind -n C-n next-window
# Window swap
bind-key S-Left swap-window -t -1
bind-key S-Right swap-window -t +1
#
# Panes
#
# Pane-splitting keys
unbind %
bind - split-window -v -c "#{pane_current_path}"
unbind '”'
bind | split-window -h -c "#{pane_current_path}"
# Pane numbering starts at 1
set -g pane-base-index 1
# Pane resizing
bind -r H resize-pane -L 1 # 1 px bigger to the left
bind -r J resize-pane -D 1 # 1 px bigger down
bind -r K resize-pane -U 1 # 1 px bigger up
bind -r L resize-pane -R 1 # 1 px bigger right
# Vim-style pane navigation keys
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
# Quick pane cycling
unbind ^A
bind -r ^A select-pane -t :.+
# Toggle pane synchronisation
bind-key b set-window-option synchronize-panes
# Pane number display time
set -g display-panes-time 3000
#
# Session Layout
#
new-session -s "Mac mini" "cd ~/Downloads/; mc; bash -i"
rename-window mc
#
# Theme Colours
#
set -g @colors-solarized 'light'
# Left side of status bar
set -g status-left-length 40
set -g status-left '#[fg=colour64]#S #[fg=colour136]#(ifconfig | grep "inet.*broadcast" | egrep -o "[0-9]+\.[0-9]+\s" | head -1)'
# Right side of status bar
set -g status-right-length 150
set -g @cpu_percentage_format "%3.0f%%"
set -g @cpu_low_fg_color "#[fg=#859900]"
set -g @cpu_medium_fg_color "#[fg=#b58900]"
set -g @cpu_high_fg_color "#[fg=#6c71c4]"
set -g status-right "#{cpu_fg_color}CPU #{cpu_icon} #{cpu_percentage} #[fg=colour37]#(curl https://am.i.mullvad.net/country)"
#
# Plug-ins
#
# To install plugins:
# 1) Add plugin down here
# 2) Prefix + I to install plugin
# To update plugins:
# 1) Prefix + U
# To remove plugins:
# 1) Remove line down here
# 2) Prefix + ALT + U
# Required plug-ins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
#
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-cpu'
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# Initialize tmux plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
@faxotherapy I've reduced your config to a minimal subset and it's working for me.
#### Tmux plugin manager ####
#
# Theme Colours
#
set -g @colors-solarized 'light'
# Left side of status bar
set -g status-left-length 40
set -g status-left '#[fg=colour64]#S #[fg=colour136]#(ifconfig | grep "inet.*broadcast" | egrep -o "[0-9]+\.[0-9]+\s" | head -1)'
# Right side of status bar
set -g status-right-length 150
set -g @cpu_percentage_format "%3.0f%%"
set -g @cpu_low_fg_color "#[fg=#859900]"
set -g @cpu_medium_fg_color "#[fg=#b58900]"
set -g @cpu_high_fg_color "#[fg=#6c71c4]"
set -g status-right "#{cpu_fg_color}CPU #{cpu_icon} #{cpu_percentage} #[fg=colour37]#(curl https://am.i.mullvad.net/country)"
# Required plug-ins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
#
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-cpu'
# Initialize tmux plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
Are you sure to have the latest tmux-cpu
?
According to this line in your config
set -g @cpu_percentage_format "%3.0f%%"
you shouldn't see decimals but there is decimal in your gif
So if it still not working after tmux-cpu
upgrade, there's probably something wrong in the rest of your config file.
Hi, I try to use
@cpu_percentage_format
. The little annoying thing is seeing percentage position moving back and forth, for example, from 8% to 10%, then 10 to 8. I'd like to have08%
or[space]8%
instead of8%
so that I no longer see the percentage position moving back and forth on the right side of the status bar.