o0th / tmux-nova

tmux theme
MIT License
173 stars 20 forks source link

Most status bar sections not rendering #28

Closed four43 closed 1 year ago

four43 commented 1 year ago

I'm at a bit of a loss here as I can't find any logs for what I'm doing wrong here, so apologies. Using the example themes from the gallery and after installing the plugins, fiddling around a bit gives me an off by one error for the rows? Somehow? I'm definitely doing something wrong here:

image

### PLUGINS ###
set -g @plugin 'o0th/tmux-nova'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'

### GENERAL ###

set -sg escape-time 0
set -g history-limit 20000

set -g repeat-time 0
setw -g allow-rename off

# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
set -g set-titles-string "#I:#W"

# Enable mouse support
set -g mouse off

# ----------
# Navigation
# ----------

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

bind c new-window -c '#{pane_current_path}'

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"

# switch panes using arrow without prefix
bind Left select-pane -L
bind Right select-pane -R
bind Up select-pane -U
bind Down select-pane -D

# Enable mouse control (clickable windows, panes, resizable panes)
# set -g mouse on

# Order indexes like our keyboard
set -g base-index 1
set -g pane-base-index 1

bind k kill-pane -a

set-option -g renumber-windows on

### THEME ###
set -g @nova-nerdfonts true
set -g @nova-nerdfonts-left 
set -g @nova-nerdfonts-right 

set -g @nova-pane "#I #W"
set -g @nova-rows 1
set -g status 'on'

### COLORS ###
b_bg="#504945"

seg_a="#a89984 #282828"
seg_b="$b_bg #ddc7a1"

inactive_bg="#4c566a"
inactive_fg="#d8dee9"
active_bg="#89c0d0"
active_fg="#2e3540"

client_prefix=""

set -gw window-status-current-style bold
set -g "@nova-status-style-bg" "$inactive_bg"
set -g "@nova-status-style-fg" "$inactive_fg"
set -g "@nova-status-style-active-bg" "$active_bg"
set -g "@nova-status-style-active-fg" "$active_fg"

set -g "@nova-pane-active-border-style" "#44475a"
set -g "@nova-pane-border-style" "#827d51"

### STATUS BAR ###
set -g @nova-segment-prefix "#{?client_prefix,PREFIX,}"
set -g @nova-segment-prefix-colors "$seg_b"

set -g @nova-segment-session "#{session_name}"
set -g @nova-segment-session-colors "$seg_a"

set -g @nova-segment-whoami "#(whoami)@#h"
set -g @nova-segment-whoami-colors "$seg_a"

set -g @nova-segment-cpu "#{cpu_icon} #{cpu_percentage} #{ram_icon} ${ram_percentage}"
set -g @nova-segment-cpu-colors "$seg_b"

set -g @batt_icon_status_charging '↑'
set -g @batt_icon_status_discharging '↓'
set -g @nova-segment-battery "#{battery_icon_status} #{battery_percentage}"
set -g @nova-segment-battery-colors "$seg_b"

set -g @nova-segments-0-left "#{session_name} session"
set -g @nova-segments-0-right "prefix cpu battery whoami"

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

Switching set -g @nova-rows 0 to set -g @nova-rows 1 and back and forth was what I was playing with. I thought my base index might be messing it up too, nope.

Some of the segments are jammed on row 1, not row 0?

System info:

$ uname -a 
Linux [hostname] 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
$ tmux -V
tmux 3.1c

(debian packaged version)

$ ls -1 ~/.tmux/plugins
tmux-battery
tmux-cpu
tmux-keyboard-layout
tmux-nova
tpm

Terminals: Gnome terminal and Alacritty

Can you help me figure out what I'm doing wrong?

Thanks!

o0th commented 1 year ago

Hi @four43! Thank you for using my theme. Using your .tmux.conf, I'm getting something like this:

before

Since you already defined your session segment here

set -g @nova-segment-session "#{session_name}"
set -g @nova-segment-session-colors "$seg_a"

You could change:

set -g @nova-segments-0-left "#{session_name} session"

into:

set -g @nova-segments-0-left "session"

And getting this result:

after

In @nova-segments-0-left, @nova-segments-0-right etc., I would avoid putting anything different than the segments' names.

To reset your tmux without killing the server, I use tmux-reset. This prevents old variables from persisting in the current session.

four43 commented 1 year ago

@o0th Thanks for your response.

I'm still not seeing anything on the left or right side if I keep it to a single row. I wonder if something in my font is throwing things off and making it drop to a newline? Reverting to the default Debian font in alacritty doesn't seem to help.

Which version of tmux are you using? This is so strange!

image

o0th commented 1 year ago

Sorry @four43, I was quite busy these days... Are you using Bash or something different?

four43 commented 1 year ago

Hey no worries at all, you owe me nothing! I was just curious if you had ideas.

I'm using zsh.

$ zsh --version
zsh 5.8 (x86_64-debian-linux-gnu)
o0th commented 1 year ago

I just realized you're using #{cpu_icon}, #{cpu_percentage} etc. I was not able to make external plugin variables works inside my theme. The only way I found was to get the output from the plugin script files:

set -g @cpu_percentage_format "%5.1f%%"
set -g @nova-segment-cpu " #(~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh)"

Try to use my segments from the gallery and see if it shows them properly.

four43 commented 1 year ago

Good thought, good thought, using just the contents of the gallery, my tmux.conf:

### PLUGINS ###
set -g @plugin 'o0th/tmux-nova'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'ofirgall/tmux-keyboard-layout'

### THEME ###
set -g @nova-nerdfonts true
set -g @nova-nerdfonts-left 
set -g @nova-nerdfonts-right 

set -g @nova-pane "#I #W"
set -g @nova-rows 0

### COLORS ###
b_bg="#504945"

seg_a="#a89984 #282828"
seg_b="$b_bg #ddc7a1"

inactive_bg="#32302f"
inactive_fg="#ddc7a1"
active_bg=$b_bg
active_fg="#ddc7a1"

set -gw window-status-current-style bold
set -g "@nova-status-style-bg" "$inactive_bg"
set -g "@nova-status-style-fg" "$inactive_fg"
set -g "@nova-status-style-active-bg" "$active_bg"
set -g "@nova-status-style-active-fg" "$active_fg"

set -g "@nova-pane-active-border-style" "#44475a"
set -g "@nova-pane-border-style" "#827d51"

### STATUS BAR ###
set -g @nova-segment-prefix "#{?client_prefix,PREFIX,}"
set -g @nova-segment-prefix-colors "$seg_b"

set -g @nova-segment-session "#{session_name}"
set -g @nova-segment-session-colors "$seg_a"

set -g @nova-segment-whoami "#(whoami)@#h"
set -g @nova-segment-whoami-colors "$seg_a"

set -g @nova-segment-cpu " #(~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh) #(~/.tmux/plugins/tmux-cpu/scripts/ram_percentage.sh)"
set -g @nova-segment-cpu-colors "$seg_b"

set -g @nova-segment-layout "#(~/.tmux/plugins/tmux-keyboard-layout/scripts/get_keyboard_layout.sh)"
set -g @nova-segment-layout-colors "$seg_a"

set -g @nova-segments-0-left "session"
set -g @nova-segments-0-right "prefix cpu layout whoami"

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

Only changes:

image

This is so strange! And I'm at a loss of how to debug this. Sorry I'm not more help. I appreciate the attempts.

o0th commented 1 year ago

Could you try putting o0th/tmux-nova after the other scripts?

set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'ofirgall/tmux-keyboard-layout'
set -g @plugin 'o0th/tmux-nova'
four43 commented 1 year ago

Yeah tried that one too. I wonder if this is a powerline issue? Is it rendering the line too wide and it's getting pushed down or something. This is an odd one for sure.

four43 commented 1 year ago

So I just ran your script in my shell, not sure if it needs more defined, but it was unhappy!

$ ~/.tmux/plugins/tmux-nova/scripts/nova.sh
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: #I: binary operator expected
invalid option: interval
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: #a89984: binary operator expected
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: too many arguments
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: #504945: binary operator expected
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: : binary operator expected
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: #504945: binary operator expected
/home/smiller/.tmux/plugins/tmux-nova/scripts/utils.sh: line 6: [: #a89984: binary operator expected
o0th commented 1 year ago

Because putting the theme first, I'm getting the same problem.

prob

Putting it last (exit tmux) and reopen it

after2

Running the script is normal I'm getting the same.

four43 commented 1 year ago

I might just be a lost cause lol. I'm doing that too, and I played with moving it all around in the config

tmux show-options -A (expand)
activity-action* other
assume-paste-time* 1
base-index* 1
bell-action* any
default-command* 
default-shell* /usr/bin/zsh
default-size* 80x24
destroy-unattached* off
detach-on-destroy* on
display-panes-active-colour* red
display-panes-colour* blue
display-panes-time* 1000
display-time* 750
history-limit* 20000
key-table* root
lock-after-time* 0
lock-command* "lock -np"
message-command-style* fg=yellow,bg=black
message-style* fg=black,bg=yellow
mouse* off
prefix* C-a
prefix2* Invalid#1fff00000000
renumber-windows* on
repeat-time* 0
set-titles* on
set-titles-string* "#I:#W"
silence-action* other
status* on
status-bg* #4c566a
status-fg* #d8dee9
status-format[0]* "#[align=left range=left #{status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-format}#[pop-default]#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{window-status-current-style},default},#{window-status-current-style},#{window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{status-right-style}]#[push-default]#{T;=/#{status-right-length}:status-right}#[pop-default]#[norange default]"
status-format[1]* "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
status-interval* 5
status-justify* left
status-keys* vi
status-left* "#{?#{w:#{E:@nova-segment-session}},#[fg=#282828#,bg=#a89984] #{session_name} #[fg=#a89984],}#[bg=#4c566a]"
status-left-length* 10
status-left-style* default
status-position* bottom
status-right* "#[bg=##4c566a]#{?#{w:#{E:@nova-segment-prefix}},#[fg=#504945]#[fg=#ddc7a1#,bg=#504945] #{?client_prefix,,} #[bg=#504945],}#{?#{w:#{E:@nova-segment-cpu}},#[fg=#504945]#[fg=#ddc7a1#,bg=#504945]  #(~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh) #[bg=#504945],}#{?#{w:#{E:@nova-segment-whoami}},#[fg=#a89984]#[fg=#282828#,bg=#a89984] #(whoami)@#h #[bg=#a89984],}"
status-right-length* 40
status-right-style* default
status-style* fg=#d8dee9,bg=#4c566a
update-environment[0]* DISPLAY
update-environment[1]* KRB5CCNAME
update-environment[2]* SSH_ASKPASS
update-environment[3]* SSH_AUTH_SOCK
update-environment[4]* SSH_AGENT_PID
update-environment[5]* SSH_CONNECTION
update-environment[6]* WINDOWID
update-environment[7]* XAUTHORITY
visual-activity* off
visual-bell* off
visual-silence* off
word-separators* " "

status-format[0] seems super long, but I don't know if that's expected

o0th commented 1 year ago

status-format[0] is normal to be that long. I tried to run everything in Debian (docker), but nothing worked. I'm afraid it is because version 3.1c is quite old (Oct 30, 2020). Could you try to install the latest tmux version?

four43 commented 1 year ago

OH MY GOD IT WORKED! I'm running 3.3a now and it's way better. I'll see if I can test a few version and find where it breaks. But yes, out of the box Debian repo of tmux is too old.

Thanks for all your help and patience, @o0th