Styles do not support formats unless you use a very new tmux, so you will
not be able to do it like this.

You may be able to check the variable with if-shell -F instead, for example

set-hook -g pane-focus-in "if -F '#{==:#{window_name},netkit-vm}' 'set
status-style bg=blue' 'set status-style bg=red'"

You change the format to whatever you like.


On Wed, 6 Jan 2021, 05:01 Billy Bromell, <[email protected]> wrote:

> Thank you !
>
> I'm working on a tool that will be used by other people who likely won't
> have the latest tmux version - so the second one is a better option for now.
>
> I tried to do this before but was missing the && bit. It still isn't quite
> working - ive currently got:
>
> set-hook -g pane-focus-in 'set -g status-style
> "bg=#{?#{&&:#{==:#{window_name},netkit-vm},#{==:#{pane_index},0}},red,blue}"'
>
> When i switch panes it fails with Bad style:
> bg=#{?#{&&:#{==:#{window_name},netkit-vm},#{==:#{pane_index},0}},red,blue}
>
> but when i replace "set -g status-style" with "display-message" i see
> bg=blue or bg=red, so I'm assuming theres some kind of syntax that allows
> it to evaluate the statement but I'm not sure where?
>
> Cheers,
> Billy
>
> On Tuesday, 5 January 2021 at 20:08:12 UTC [email protected] wrote:
>
>> The marked pane is server wide.
>>
>> If your tmux is new enough (built from master or 3.2-rc) you could set a
>> user option on the pane you started with and then check it in status-style,
>> for example:
>>
>> set -p @firstpane 1
>> set -g status-style 'bg=#{?@firstpane,red,blue}'
>>
>> Or just check its name, something like (not tested):
>>
>> set -g status-style
>> 'bg=#{?#{&&:#{==:#{window_name},netkit-vm},#{==:#{pane_index},0}},red,blue}'
>>
>>
>> On Tue, 5 Jan 2021 at 19:35, Billy Bromell <[email protected]> wrote:
>>
>>>
>>> Hi
>>>
>>> I'm trying to set up tmux so that the when the active pane is the pane
>>> that the session started with, the status bar is a different colour to that
>>> of when it is in a pane that has been created later. Here is what I have so
>>> far:
>>>
>>> set-hook -g session-created 'select-pane -m; rename-window netkit-vm;
>>> set -t 0 remain-on-exit on'
>>> set-hook -g pane-focus-in 'if -F "#{==:#{pane_marked},1}" "set
>>> status-style bg=#c78add" "set status-style bg=blue"'
>>>
>>> The second hook works - whenever i move to a marked pane the status bar
>>> turns purple, and whenever i move to an unmarked pane it turns blue.
>>>
>>> However when I'm using multiple sessions, it seems that only one of them
>>> has a marked pane. I wasn't sure if "set -g" was the right option but the
>>> rename-window part of the hook seems to work as all sessions have the first
>>> window named correctly.
>>>
>>> Is a pane mark global to a tmux server (running all sessions under `tmux
>>> -L netkit` ) ? I thought they were session specific rather than server
>>> specific?
>>>
>>> As the pane that i want the purple active status bar for, should always
>>> have window_name 'netkit-vm', pane_index 0 - this might be useful for the
>>> pane-focus hook but i couldnt work out an if statement that worked.
>>>
>>> Any help would be appreciated!!
>>>
>>> Billy
>>>
>>> --
>>> 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/8379d701-2df8-4163-ab8d-12d89eb25d40n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tmux-users/8379d701-2df8-4163-ab8d-12d89eb25d40n%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/f5e06dcf-9a97-4bf0-8969-d36beabc2573n%40googlegroups.com
> <https://groups.google.com/d/msgid/tmux-users/f5e06dcf-9a97-4bf0-8969-d36beabc2573n%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/CAEdLfcHKh9CVfwe-ZNuFvRNHssr7uzs-vPbMth_m0e%2BOCux%2BqA%40mail.gmail.com.

Reply via email to