tmux-plugins / tmux-cpu

Plug and play cpu percentage and icon indicator for Tmux.
MIT License
426 stars 65 forks source link

ubuntu 20 not working cpu_percentage #79

Closed kaykhancheckpoint closed 2 years ago

kaykhancheckpoint commented 2 years ago

Hi friends,

I just came across this plugin and I installed it, however it does not appear to show anything. Any ideas what im doing wrong/missing?

image

Cloned the project and ran ./cpu_percentage.sh 1.0%%

I also did prefix+U - all - enter

tmux.conf

#Reload conf by Ctrl + B, then write :source-file ~/.tmux.conf
#set-option -g default-shell "/bin/bash"

# Status
set -g message-style bg='#181819',fg='#181819'
set -g status-style bg='#181819',fg='#181819'
set -g status-interval 1

#removes number and time
set -g status-left ''
set -g status-right ''

set-window-option -g window-status-style fg='#ffdd33',bg=default
set-window-option -g window-status-current-style fg='#ffdd33',bg='#181819',bold

set -g pane-active-border-style bg=default,fg='#ffdd33'
set -g pane-border-style fg='#ffdd33'

set -g status-justify centre

# Status end

set -g prefix C-b

set -g base-index 1
set-option -g mouse on
set -g set-clipboard on
set -g history-limit 10000

set -g default-terminal "xterm-256color"
set -g terminal-overrides "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"

set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0

# Keybinds

# Movement and resize vim controls
bind -r C-k resize-pane -U
bind -r C-j resize-pane -D
bind -r C-h resize-pane -L
bind -r C-l resize-pane -R

bind  k select-pane -U 
bind  j select-pane -D 
bind  h select-pane -L 
bind  l select-pane -R 

# Rebind splits
bind v split-window -h -c '#{pane_current_path}'
bind b split-window -v -c '#{pane_current_path}'

unbind Up     
unbind Down   
unbind Left   
unbind Right  

unbind C-Up   
unbind C-Down 
unbind C-Left 
unbind C-Right

# Rebind rename to R
bind-key r command-prompt -I "#W" "rename-window '%%'"

# Plugins
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'sainnhe/tmux-net-speed'
set -g @plugin 'sainnhe/tmux-plugin-sysstat'
set -g @plugin 'tmux-plugins/tmux-cpu'

set -g @continuum-restore 'on'

# Tmux package manager
run '~/.tmux/plugins/tpm/tpm'
# {{{tmux-plugin-sysstat
set -g @sysstat_cpu_view_tmpl '#[fg=magenta]C:#[default] #[fg=#{cpu.color}]#{cpu.pused}#[default]'
set -g @sysstat_mem_view_tmpl '#[fg=magenta]M:#[default] #[fg=#{mem.color}]#{mem.pused}#[default]'
set -g status-interval 3
# }}}
# {{{tmux-prefix-highlight
set -g @prefix_highlight_fg 'colour00'
set -g @prefix_highlight_bg 'red'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=colour00,bg=colour05,bold'
set -g @prefix_highlight_prefix_prompt 'PREFIX'
set -g @prefix_highlight_copy_prompt 'COPY'
# }}}

#set -g mouse on

# vim like copy and pate
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind P paste-buffer
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel xclip

# This tmux statusbar config was created by tmuxline.vim
# on Wed, 05 May 2021

set -g status-justify "centre"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=#ffdd33,bg=#181819"
set -g status-right-style "none"
set -g pane-active-border-style bg=default,fg='#ffdd33'
set -g status-style "none,bg=#262626"
set -g message-style "fg=#ffdd33,bg=#181819"
set -g pane-border-style fg='#ffdd33'
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-style "none,fg=#ffdd33,bg=#262626"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=#ffdd33,bg=#262626"
set -g status-left "#[fg=#2c2e34,bg=#ffdd33] #S #[fg=#ffdd33,bg=#181819,nobold,nounderscore,noitalics]#[fg=#ffdd33,bg=#181819] %R #[fg=#181819,bg=#262626,nobold,nounderscore,noitalics]#[fg=#ffdd33,bg=#262626] #{sysstat_mem} #[fg=#ffffff]#{sysstat_ntemp} #[fg=#ffffff]?#{upload_speed} #[fg=#262626,bg=#262626,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#262626,bg=#262626,nobold,nounderscore,noitalics]#[fg=#ffdd33,bg=#262626]#[fg=#ffffff]#{download_speed}  #[fg=#ffffff]#{sysstat_itemp} #{sysstat_cpu} #[fg=#181819,bg=#262626,nobold,nounderscore,noitalics]#[fg=#ffdd33,bg=#181819] %a #[fg=#ffdd33,bg=#181819,nobold,nounderscore,noitalics]#[fg=#2c2e34,bg=#ffdd33] Kay #{prefix_highlight} "
setw -g window-status-format "#[fg=#262626,bg=#262626,nobold,nounderscore,noitalics]#[fg=#ffdd33] #I #W #[fg=#262626,bg=#262626,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#262626,bg=#181819,bold,nounderscore,noitalics]#[fg=#ffdd33,bg=#181819] #I #W #[fg=#181819,bg=#262626,nobold,nounderscore,noitalics]"

set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
ctjhoa commented 2 years ago

Ok I've not tested your config yet but few things here. As tpm documentation says

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

In your case you provide status-right option after that.

You use both https://github.com/samoshkin/tmux-plugin-sysstat and https://github.com/tmux-plugins/tmux-cpu so you might have issue with that.

Finally when you create an issue like that, please provide a minimal reproduction case. Do not copy paste us your entire config, it will allow you to verify your assumption and tmux-cpu responsibility.

kaykhancheckpoint commented 2 years ago

@ctjhoa thank you putting that line of code to the bottom of my tmux.conf fixed it