Error in symbols font on tmux statusbar [closed] - tmux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Look at my Tmux status bar:
I down't see symbols. How I can fix this?
My config files is these:
.Xresurces
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
URxvt*background: S_base03
URxvt*foreground: S_base0
URxvt*fading: 40
URxvt*fadeColor: S_base03
URxvt*cursorColor: S_base1
URxvt*pointerColorBackground:S_base01
URxvt*pointerColorForeground:S_base1
!! black dark/light
URxvt*color0: S_base02
URxvt*color8: S_base03
!! red dark/light
URxvt*color1: S_red
URxvt*color9: S_orange
!! green dark/light
URxvt*color2: S_green
URxvt*color10: S_base01
!! yellow dark/light
URxvt*color3: S_yellow
URxvt*color11: S_base00
!! blue dark/light
URxvt*color4: S_blue
URxvt*color12: S_base0
!! magenta dark/light
URxvt*color5: S_magenta
URxvt*color13: S_violet
!! cyan dark/light
URxvt*color6: S_cyan
URxvt*color14: S_base1
!! white dark/light
URxvt*color7: S_base2
URxvt*color15: S_base3
URxvt*font: xft:Inconsolata for Powerline:size=12,xft:PowerlineSymbols:pixelsize=12:antialias=true
URxvt*scrollBar: False
URxvt*scrollTtyOutput: False
URxvt*scrollTtyKeypress: True
URxvt*secondaryScroll: True
URxvt*saveLines: 8000
URxvt*letterSpace: 0
URxvt*cursorBlink: True
URxvt*cursorUnderline: True
URxvt*modifier: alt
URxvt.perl-ext-common : default,matcher,keyboard-select,url-select,clipboard
URxvt.tabbed.tabbar-fg: 5
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 14
URxvt.tabbed.tab-bg: 0
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.url-select.autocopy: True
URvxt.url-select.button: 2
URxvt.url-select.launcher: firefox
URxvt.url-select.underline: True
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
URxvt.keysym.M-C-v: perl:clipboard:paste_escaped
And .tmux.conf:
# use UTF8
set -g utf8
set-window-option -g utf8 on
set -g status on
set -g status-utf8 on
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# set scrollback history to 10000 (10k)
set -g history-limit 10000
# set Ctrl-a as the default prefix key combination
# and unbind C-b to free it up
set -g prefix C-a
unbind C-b
# use send-prefix to pass C-a through to application
bind C-a send-prefix
# shorten command delay
set -sg escape-time 1
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
# reload ~/.tmux.conf using PREFIX r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h
bind - split-window -v
# Make the current window the first window
bind T swap-window -t 1
# map Vi movement keys as pane movement keys
bind -n S-down new-window
bind -n C-right select-pane -R
bind -n C-left select-pane -L
bind -n C-up select-pane -U
bind -n C-down select-pane -D
bind -n S-right next
bind -n S-left prev
bind l select-pane -R
# and use C-h and C-l to cycle thru panes
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes using PREFIX H, J, K, L
bind H resize-pane -L 10
bind J resize-pane -D 10
bind K resize-pane -U 10
bind L resize-pane -R 10
# C-i for even-vertical arrangement and C-o to zoom current pane
bind-key C-i select-layout even-vertical
bind-key C-v select-layout even-horizontal
#bind-key C-o resize-pane -y 1000
# Sync panes
bind C-s set-window-option synchronize-panes
# explicitly disable mouse control
setw -g mode-mouse off
set -g mouse-select-pane off
set -g mouse-resize-pane off
set -g mouse-select-window off
# ---------------------
# Copy & Paste
# ---------------------
# provide access to the clipboard for pbpaste, pbcopy
#set-option -g default-command "reattach-to-user-namespace -l zsh"
set-window-option -g automatic-rename on
# use vim keybindings in copy mode
setw -g mode-keys vi
bind y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
bind C-y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
# -----------------------
# Multistart panes
# ----------------------
bind-key P run-shell 'tmux-multistart as'
bind-key A run-shell 'tmux-multistart alpha'
bind-key B run-shell 'tmux-multistart beta'
bind-key W run-shell 'tmux-multistart web'
bind-key D run-shell 'tmux-multistart dev'
bind-key T run-shell 'tmux-multistart txhub'
bind-key C command-prompt -p "machine(s)/group: " "run-shell 'tmux-multistart %1'"
# ----------------------
# set some pretty colors
# ----------------------
# set pane colors - hilight the active pane
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01
# colorize messages in the command line
set-option -g message-bg black #base02
set-option -g message-fg brightred #orange
# ----------------------
# Status Bar
# -----------------------
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# set color for status bar
set-option -g status-bg colour236 #base02
set-option -g status-fg yellow #yellow
set-option -g status-attr dim
# set window list colors - red for active and cyan for inactive
set-window-option -g window-status-fg brightblue #base0
set-window-option -g window-status-bg colour236
set-window-option -g window-status-attr dim
set-window-option -g window-status-current-fg brightred #orange
set-window-option -g window-status-current-bg colour236
set-window-option -g window-status-current-attr bright
# show host name and IP address on left side of status bar
set -g status-left-length 85
set -g status-right-length 60
set -g status-right '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]'
set -g status-left '#(eval tmux-airline `tmux display -p "#{client_width}"`)'
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[default]#W "
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I  #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"

I found it:
I had another error message with sublime about set locate for non-ascii characters in arch.
So arch's wiki help to set locale setting with this command:
$ locale > /etc/locale.conf
After i3 restart everythings is OK

Related

Pane Title in Tmux .conf File

I'm setting up a window template script in the tmux.conf file and want to have a statement that add a pane title.
In a related post 2019 the solution is partially provided by adding a pane title from the command line - link. A solution is quoted below:-
tmux select-pane -t {pane} -T {title}
Examples:
tmux select-pane -T title1 # Change title of current pane
tmux select-pane -t 1 -T title2 # Change title of pane 1 in current window
tmux select-pane -t 2.1 -T title3 # Change title of pane 1 in window 2`
How do I translate this into a line in the .tmux.conf file?
I've tried the following;
send-keys 'tmux select-pane -t 1 -T titles' C-m ;
select-pane -t 1 -T titles C-m ;
select-pane -t 1-T titles
Finally - although changes to the config file seem to be effected by the continuum & reurrect plugins I found that in order for this to work:-
select-pane -T title1 # Change title of current pane
select-pane -t 1 -T title2 # Change title of pane 1 in current window
select-pane -t 2.1 -T title3 # Change title of pane 1 in window 2
You had to first add the following to the conf file:-
set -g pane-border-format "#{pane_index} #{pane_current_command}"

How do I set tmux window name from within a Bash script?

In one of my tmux windows, I run a Weechat IRC client inside a Docker container, which I instantiate using a Bash script, which makes the tmux window name "bash". https://imgur.com/a/Dc20YEB
I would like the tmux window name to be "weechat", as if I had run a locally installed weechat - as is the case with man or nvim.
I understand there is a difference between "window names" and "pane titles", and that I can set the window name using (as detailed in the man page):
tmux set-option allow-rename on
tmux select-pane -T fooname
printf '\033kWINDOW_NAME\033\\'
But this changes my window name to 1:tpreston#hostname:~*. I'm running tmux 2.9a on Fedora 30.
These are my options
activity-action other
assume-paste-time 1
base-index 0
bell-action any
default-command ""
default-shell "/bin/bash"
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 4000
history-limit 50000
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 on
prefix C-Space
prefix2 None
renumber-windows off
repeat-time 500
set-titles off
set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
silence-action other
status on
status-bg green
status-fg black
status-format[0] "#[align=left range=left #{status-left-style}]#{T;=/#{status-left-length}:status-left}#[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},}}]#{T:window-status-format}#[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},}}]#{T:window-status-current-format}#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{status-right-style}]#{T;=/#{status-right-length}:status-right}#[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 emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right "#(/home/tpreston/.tmux/plugins/tmux-battery/scripts/battery_status_bg.sh) b:#(/home/tpreston/.tmux/plugins/tmux-battery/scripts/battery_icon.sh)#(/home/tpreston/.tmux/plugins/tmux-battery/scripts/battery_percentage.sh) | %a %F %H:%M "
status-right-length 40
status-right-style default
status-style fg=black,bg=green
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 " -_#"
# rename window name of current window
tmux rename-window newname
# rename another window
tmux rename-window -t <target> new-name
The parameter <target> could be
window name
window index
window name or index with session prefix: <session>:<window>
tmux select-pane -T fooname
This sets the pane title not the window name. Use "tmux rename-window" to change the window name.
tmux set-option allow-rename on
printf '\033kWINDOW_NAME\033\'
This does change the window name.
But this changes my window name to 1:tpreston#hostname:~*
This is because something else is renaming the window, probably your shell is doing it as part of the prompt.
If you want to have allow-rename on and use the \033k escape sequence yourself, you will need to track this down and disable it.
If your script is running on the same host as tmux, it might be better just to leave allow-rename off and run "tmux renamew weechat" from the script.

Tmux conditional color setting

Is it possible to set window color depends on the other window-option?
When a windows has synchronize-panes enabled, I don't want to accidentally press C-d, or all panes will be closed.
So what I'm trying to do is to change window color on statusline based on synchronize-panes:
(the following config doesn't work, though)
bind-key S setw synchronize-panes \; \ # toggles the option
set -w window-status-bg '#{?pane_synchronized,yellow,default}' \; \ # error: bad color
set -w window-status-current-fg '#{?pane_synchronized,yellow,default}' # error: bad color
The most possible solution I can thought of is to use if-shell, but I prefer not to fork a shell just to read option of itself, if possible.
EDIT: This if-shell solution works for me on tmux 2.7
My statusline cyan colored, if synchronize-panes is enabled, cyan becomes yellow.
bind-key S setw synchronize-panes \; \
if-shell '[ #{pane_synchronized} -eq 1 ]' \
'set -w window-status-style fg=black,bg=yellow ; set -w window-status-current-style fg=yellow,bg=black' \
'set -w window-status-style fg=black,bg=cyan ; set -w window-status-current-style fg=cyan,bg=black'
EDIT: Problem solved, my setting is now changed to this:
bind-key S setw synchronize-panes
sync_ind_colour="#{?pane_synchronized,yellow,cyan}"
set -g window-status-format "#[fg=black,bg=${sync_ind_colour}][#I#{?#{!=:#W,},:,}#W]"
set -g window-status-current-format "#[fg=${sync_ind_colour},bg=black][#I#{?#{!=:#W,},:,}#W]"
Looks a little bit scary but it's still readable.
It shouldn't be necessary to use if-shell for this. You can use conditionals in format options, but not in styles. The following minimal configuration should do what you want.
# toggle pane synchronisation mode
bind-key S setw synchronize-panes
# Variables
sync_ind_colour="#{?pane_synchronized,yellow,cyan}"
# status format
setw -g window-status-format "#[fg=black,bg=${sync_ind_colour}]#I #W"
setw -g window-status-current-format "#[fg=${sync_ind_colour},bg=black][#I #W]"
Note that I set the text of the window status to #I #W (and [#I #W] for active) as an example, but that's irrelevant to the question.
It's also not necessary to use a variable (sync_ind_colour, synchronise indicator colour), but it's simpler than defining the same conditional in both the window-status-format and the window-status-current-format variables.

tmux: how to toggle "on" and "off" options with the same key

This is a bit of my tmux.conf
cat tmux.conf
...
bind a set-window-option synchronize-panes on
bind b set-window-option synchronize-panes off
As you can see, sync and unsync options for panes are bound to two different keys. Is it possible to toggle sync/unsync with the same key?
If you don't explicitly specify "on" or "off", the option will get toggled. The following would suffice:
bind-key a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
don't attach on or off. it's toggle
bind-key a set-window-option synchronize-panes
This should be possible with a combination of run-shell and tmux show-option, something like (tested in tmux 2.3):
bind a run-shell "if [[ `tmux show-options -w | grep 'synchronize-panes.*on'` ]]; then toggle=off; else export toggle=on; fi; tmux display-message \"sync panes tmux: \$toggle\"; tmux set-option -w synchronize-panes \$toggle &> /dev/null"
(this is a variation of a mouse-mode toggle found on the TMux user mailing list)
Here's an example of toggling the mouse on and off with ^M:
bind-key c-M set-option -g mouse \; display-message 'Mouse #{?mouse,on,off}'
A more generic solution based on the answer by Frank Schmitt:
!/usr/bin/bash
USAGE="USAGE: $0 OPTION_NAME ON_STATE OFF_STATE"
OPTION_NAME=$1
ON_STATE=$2
OFF_STATE=$3
if [[ "$#" != 3 ]]; then
echo $USAGE
exit 1
fi
if [[ `tmux show-option -w | grep "$OPTION_NAME $ON_STATE"` ]]; then
OPTION_VALUE=$OFF_STATE
else
OPTION_VALUE=$ON_STATE
fi
tmux display-message "monitor activity: $OPTION_NAME $OPTION_VALUE"
tmux set-option -w $OPTION_NAME $OPTION_VALUE > /dev/null
The script takes the name of the option, the on value and the off value. Not very well tested but works for simple cases like:
PATH_TO_SCRIPT_ABOVE monitor-activity on off
In your .tmux.conf:
bind-key <SOME_KEY> run-shell "tmux_toggle_option monitor-activity on off"

How can you tell which pane in Tmux is focused?

I'm starting to use tmux (I'm thinking of switching from screen), but I'm having a hard time telling which pane is focused when I split a window into multiple panes. Is there a config customization or something that can highlight the focused pane a little more explicitly?
Here are the relevant settings:
pane-active-border-style fg=colour,bg=colour
Set the pane border colour for the currently active pane.
So, try adding something like this to your ~/.tmux.conf:
set-option -g pane-active-border-style fg=blue
That will set a blue border around the active pane. The pane-active-border-style bg=colour option can be used for a more visible solution, as well.
As answered in another post it is now possible in tmux 2.1 to set the colours of individual panes. Ones can use:
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
in the ~/.tmux.conf file to show a difference between the active/inactive panes.
With Vim If you find it does not work with Vim panes, it might be down to the colourscheme you are using. First, try another colourscheme such as pablo. For further details, see the other post.
Customize status-left and use the #P character pair, which is the pane number. You will probably want to include more than just the pane number in the status bar, but here is an example of the line you would add to your ~/.tmux.conf for just the pane number:
set-option -g status-left '#P'
See the tmux man page for more character pairs: http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html
One Solution that works for me is to add a display-pane at the end of the hotkey for a pane switch. This displays all the pane numbers, with the current pane in a different color. You can also use <escape_key> + q to display pane numbers.
I use alt+h/j/k/l to switch between panes, and I use the following binding.
bind -n M-j select-pane -D \; display-pane
bind -n M-k select-pane -U \; display-pane
bind -n M-h select-pane -L \; display-pane
bind -n M-l select-pane -R \; display-pane
I wanted the active pane's borders to be brighter than other panes,
so I went with this (works in tmux 1.8 w/CentOS 7):
~/.tmux.conf fragment
# rgb hex codes from https://www.rapidtables.com/web/color/RGB_Color.html
set-option -g pane-active-border-fg '#33FF33' # brighter green
set-option -g pane-border-fg '#006600' # darker green
The tmux man page says hex-RGB colors will be approximated, and I find the hex codes easier to understand than remembering "colour47" (out of colour0-255) is a kind of light green (as described in How does the tmux color palette work?).
tmux man-page excerpt:
message-bg colour
Set status line message background colour, ...etc...
or a hexadecimal RGB string such as ‘#ffffff’, which chooses the closest
match from the default 256-colour set.
For tmux 3 I was able to set the following in my .tmux.conf for a subtle border indicator:
set-option -g pane-active-border-style bg=yellow

Resources