Hi Nicholas, Could you take a look at this issue? It would be nice to do it
without digging into the code.
For the format.c, is this what I need? Sorry, I didn't really read the code. so
could be wrong. format_cb_window_active_idx(struct format_tree *ft)
{
if (ft->wl != NULL) {
return ( xstrdup( ft->wl->session->curw->idx)) }
return (NULL);
}
Best regards, Haodong Du
On Sat, Feb 20, 2021 at 3:26 PM, Nicholas Marriott
<[email protected]> wrote:
#() will not work with display -p because it stops before the command finishes
(it does not wait). In the status line it should work, I don't know why It
doesn't. It would be easy to add an additional format variable though and it
would be generally useful.
On Sat, 20 Feb 2021, 20:20 Haodong Du, < [email protected]
[[email protected]] > wrote:
Thank you Nocholas! I haven't digged into customizing tmux code myself, but
would try later. Regarding the #(). I find it's not executing, and found this
post that might be related:
https://stackoverflow.com/questions/30264679/tmux-titles-string-not-executing-shell-command
[https://stackoverflow.com/questions/30264679/tmux-titles-string-not-executing-shell-command]
I'm running HEAD-742e670 (built yesterday) on macos 11.2.1
```bash $ tmux display -pv -F "#{==:#(tmux lsw -f '#{?window_active,1,}' -F
'#I'),#I}" # expanding format: #{==:#(tmux lsw -f '#{?window_active,1,}' -F
'#I'),#I} # found #{}: ==:#(tmux lsw -f '#{?window_active,1,}' -F '#I'),#I #
modifier 0 is == # expanding format: #(tmux lsw -f '#{?window_active,1,}' -F
'#I') # found #(): tmux lsw -f '#{?window_active,1,}' -F '#I' # expanding
format: tmux lsw -f '#{?window_active,1,}' -F '#I' # found #{}:
?window_active,1, # condition is: window_active # condition 'window_active'
found # condition 'window_active' is true # expanding format: 1 # result is: 1
# replaced '?window_active,1,' with '1' # found #I: window_index # format
'window_index' found: 4 # replaced 'window_index' with '4' # result is: tmux
lsw -f '1' -F '4' # expanding format: <'tmux lsw -f '#{?window_active,1,}' -F
'#I'' not ready> # found #{}: ?window_active,1, # condition is: window_active #
condition 'window_active' found # condition 'window_active' is true # expanding
format: 1 # result is: 1 # replaced '?window_active,1,' with '1' # found #I:
window_index # format 'window_index' found: 4 # replaced 'window_index' with
'4' # result is: <'tmux lsw -f '1' -F '4'' not ready> # #() result: <'tmux lsw
-f '1' -F '4'' not ready> # result is: <'tmux lsw -f '1' -F '4'' not ready> #
expanding format: #I # found #I: window_index # format 'window_index' found: 4
# replaced 'window_index' with '4' # result is: 4 # compare == left is: <'tmux
lsw -f '1' -F '4'' not ready> # compare == right is: 4 # replaced '==:#(tmux
lsw -f '#{?window_active,1,}' -F '#I'),#I' with '0' # result is: 0 ``` within
#(), I don't need replacing. So I tried escaping with #. This exited with
error. Then I wrapped with echo ``. Looks better now. Still not working.
```bash $ tmux display -pv -F "#{==:#(echo `tmux lsw -f '#{?window_active,1,}'
-F '#I'`),2}" # expanding format: #{==:#(echo 4),2} # found #{}: ==:#(echo 4),2
# modifier 0 is == # expanding format: #(echo 4) # found #(): echo 4 #
expanding format: echo 4 # result is: echo 4 # expanding format: <'echo 4' not
ready> # result is: <'echo 4' not ready> # #() result: <'echo 4' not ready> #
result is: <'echo 4' not ready> # expanding format: 2 # result is: 2 # compare
== left is: <'echo 4' not ready> # compare == right is: 2 # replaced '==:#(echo
4),2' with '0' # result is: 0 ```
Best regards, Haodong Du
On Sat, Feb 20, 2021 at 2:28 PM, Nicholas Marriott <
[email protected] [[email protected]] > wrote:
I can't try it til next week but if it was me I'd add an active-window-index
format in format_defaults_session in format.c and use that instead of the #().
Then you could also debug the format using display -pv.
On Sat, 20 Feb 2021, 18:42 Haodong Du, < [email protected]
[[email protected]] > wrote:
Hello tmux users,
I'm setting up my tmux status line. I want to achieve something like the figure
below with powerline triangles. But there are gaps between two window tabs and
also with the status left. I want to get rid of gaps completely. So I set all
the divider to none. But I still need to set fg and bg properly. Namely, make
the triangle bg match the bg of the next tab. In order to do that, I need to
know whether the next tab is active or not and whether it's the last tab. ```
#{?window_end_flag,#[fg=colour239#,bg=colour237],#{?#{==:#(tmux lsw -f
'#{?window_active,1,}' -F
'#I'),#{e|+|:#I,1}},#[fg=colour239#,bg=colour214],#[fg=colour239#,bg=colour239]}}"
``` This is what I came up with. I want to compare the index of active window
and this window index plus 1. But this does not seem to work. It always uses
the color setting for the false condition.
Full config for status line if you want to give it a try: ``` set-window-option
-g window-status-current-format "\
#{?window_start_flag,#[fg=colour195#,bg=colour214],#[fg=colour214#,bg=colour214]}\
#[fg=colour239, bg=colour214] #I* \ #[fg=colour239, bg=colour214, bold] #W \
#{?window_end_flag,#[fg=colour214#,bg=colour237],#[fg=colour214#,bg=colour239]}"
set-window-option -g window-status-format "\
#{?window_start_flag,#[fg=colour195#,bg=colour239],#[fg=colour239#,bg=colour239]}\
#[fg=colour223,bg=colour239] #I \ #[fg=colour223, bg=colour239] #W \
#{?window_end_flag,#[fg=colour239#,bg=colour237],#{?#{==:#(tmux lsw -f
'#{?window_active,1,}' -F
'#I'),#{e|+|:#I,1}},#[fg=colour239#,bg=colour214],#[fg=colour239#,bg=colour239]}}"
``` Regards, Haodong Du
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected]
[[email protected]] .
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/3d8a56b9-f36b-4a24-bd52-29a5efdd166an%40googlegroups.com
[https://groups.google.com/d/msgid/tmux-users/3d8a56b9-f36b-4a24-bd52-29a5efdd166an%40googlegroups.com?utm_medium=email&utm_source=footer]
.
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/ac42b3ae-ad25-4aa0-9200-a4aa6b13b145%40gmail.com.