tmux_interface/formats/
formats.rs

1use super::Variable;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct Formats {
6    // XXX: string or char, join(), split() ?
7    pub separator: char,
8    pub variables: Vec<Variable>,
9}
10
11impl Default for Formats {
12    fn default() -> Self {
13        Formats {
14            separator: '\'',
15            variables: Vec::new(),
16        }
17    }
18}
19
20impl fmt::Display for Formats {
21    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22        let output = self
23            .variables
24            .iter()
25            .map(|v| v.to_string())
26            .collect::<Vec<String>>()
27            .join(&self.separator.to_string());
28        write!(f, "{}", output)
29    }
30}
31
32impl Formats {
33    pub fn new() -> Self {
34        Default::default()
35    }
36
37    /// set separator character
38    pub fn separator(&mut self, c: char) -> &mut Self {
39        self.separator = c;
40        self
41    }
42
43    /// append with variable
44    pub fn push(&mut self, variable: Variable) {
45        self.variables.push(variable)
46    }
47
48    // TODO: check vec same size, return type?
49    // XXX: mb from_string for default format too?
50    // pub fn custom_string(String) pub fn custom_usize(String)
51
52    // tmux variables
53
54    /// `alternate_on` - if pane is in alternate screen
55    #[cfg(feature = "tmux_1_8")]
56    pub fn alternate_on(&mut self) -> &mut Self {
57        self.push(Variable::AlternateOn);
58        self
59    }
60
61    /// `alternate_saved_x` - Saved cursor X in alternate screen
62    #[cfg(feature = "tmux_1_8")]
63    pub fn alternate_saved_x(&mut self) -> &mut Self {
64        self.push(Variable::AlternateSavedX);
65        self
66    }
67
68    /// `alternate_saved_y` - Saved cursor Y in alternate screen
69    #[cfg(feature = "tmux_1_8")]
70    pub fn alternate_saved_y(&mut self) -> &mut Self {
71        self.push(Variable::AlternateSavedY);
72        self
73    }
74
75    // Buffer
76
77    /// `buffer_created` - Time buffer created
78    #[cfg(feature = "tmux_2_6")]
79    pub fn buffer_created(&mut self) -> &mut Self {
80        self.push(Variable::BufferCreated);
81        self
82    }
83
84    /// `buffer_name` - Name of buffer
85    #[cfg(feature = "tmux_2_3")]
86    pub fn buffer_name(&mut self) -> &mut Self {
87        self.push(Variable::BufferName);
88        self
89    }
90
91    /// `buffer_sample` - First 50 characters from the specified buffer
92    #[cfg(feature = "tmux_1_7")]
93    pub fn buffer_sample(&mut self) -> &mut Self {
94        self.push(Variable::BufferSample);
95        self
96    }
97
98    /// `buffer_size` - Size of the specified buffer in bytes
99    #[cfg(feature = "tmux_1_7")]
100    pub fn buffer_size(&mut self) -> &mut Self {
101        self.push(Variable::BufferSize);
102        self
103    }
104
105    // Client
106    /// `client_activity` - Integer time client last had activity
107    #[cfg(feature = "tmux_1_6")]
108    pub fn client_activity(&mut self) -> &mut Self {
109        self.push(Variable::ClientActivity);
110        self
111    }
112
113    /// `client_cell_height` - Height of each client cell in pixels
114    #[cfg(feature = "tmux_3_1")]
115    pub fn client_cell_height(&mut self) -> &mut Self {
116        self.push(Variable::ClientCellHeight);
117        self
118    }
119
120    /// `client_cell_width` - Width of each client cell in pixels
121    #[cfg(feature = "tmux_3_1")]
122    pub fn client_cell_width(&mut self) -> &mut Self {
123        self.push(Variable::ClientCellWidth);
124        self
125    }
126
127    /// `client_activity_string` - Option<String> time client last had activity
128    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_2")))]
129    pub fn client_activity_string(&mut self) -> &mut Self {
130        self.push(Variable::ClientActivityString);
131        self
132    }
133
134    /// `client_created` - Integer time client created
135    #[cfg(feature = "tmux_1_6")]
136    pub fn client_created(&mut self) -> &mut Self {
137        self.push(Variable::ClientCreated);
138        self
139    }
140
141    /// `client_created_string` - Option<String> time client created
142    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_2")))]
143    pub fn client_created_string(&mut self) -> &mut Self {
144        self.push(Variable::ClientCreatedString);
145        self
146    }
147
148    /// `client_control_mode` - 1 if client is in control mode
149    #[cfg(feature = "tmux_2_1")]
150    pub fn client_control_mode(&mut self) -> &mut Self {
151        self.push(Variable::ClientControlMode);
152        self
153    }
154
155    /// `client_discarded` - Bytes discarded when client behind
156    #[cfg(feature = "tmux_2_1")]
157    pub fn client_discarded(&mut self) -> &mut Self {
158        self.push(Variable::ClientDiscarded);
159        self
160    }
161
162    /// `client_cwd` - Working directory of client
163    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_1_9")))]
164    pub fn client_cwd(&mut self) -> &mut Self {
165        self.push(Variable::ClientCwd);
166        self
167    }
168
169    /// `client_height` - Height of client
170    #[cfg(feature = "tmux_1_6")]
171    pub fn client_height(&mut self) -> &mut Self {
172        self.push(Variable::ClientHeight);
173        self
174    }
175
176    /// `client_key_table` - Current key table
177    #[cfg(feature = "tmux_2_2")]
178    pub fn client_key_table(&mut self) -> &mut Self {
179        self.push(Variable::ClientKeyTable);
180        self
181    }
182
183    /// `client_last_session` - Name of the client's last session
184    #[cfg(feature = "tmux_1_8")]
185    pub fn client_last_session(&mut self) -> &mut Self {
186        self.push(Variable::ClientLastSession);
187        self
188    }
189
190    /// `client_name` - Name of client
191    #[cfg(feature = "tmux_2_4")]
192    pub fn client_name(&mut self) -> &mut Self {
193        self.push(Variable::ClientName);
194        self
195    }
196
197    /// `client_pid` - PID of client process
198    #[cfg(feature = "tmux_2_1")]
199    pub fn client_pid(&mut self) -> &mut Self {
200        self.push(Variable::ClientPid);
201        self
202    }
203
204    /// `client_prefix` - 1 if prefix key has been pressed
205    #[cfg(feature = "tmux_1_8")]
206    pub fn client_prefix(&mut self) -> &mut Self {
207        self.push(Variable::ClientPrefix);
208        self
209    }
210
211    /// `client_readonly` - 1 if client is readonly
212    #[cfg(feature = "tmux_1_6")]
213    pub fn client_readonly(&mut self) -> &mut Self {
214        self.push(Variable::ClientReadonly);
215        self
216    }
217
218    /// `client_session` - Name of the client's session
219    #[cfg(feature = "tmux_1_8")]
220    pub fn client_session(&mut self) -> &mut Self {
221        self.push(Variable::ClientSession);
222        self
223    }
224
225    /// `client_termname` - Terminal name of client
226    #[cfg(feature = "tmux_1_6")]
227    pub fn client_termname(&mut self) -> &mut Self {
228        self.push(Variable::ClientTermname);
229        self
230    }
231
232    /// `client_termtype` - Terminal type of client
233    #[cfg(all(feature = "tmux_2_4", not(feature = "tmux_3_1")))]
234    pub fn client_termtype(&mut self) -> &mut Self {
235        self.push(Variable::ClientTermtype);
236        self
237    }
238
239    /// `client_tty` - Pseudo terminal of client
240    #[cfg(feature = "tmux_1_6")]
241    pub fn client_tty(&mut self) -> &mut Self {
242        self.push(Variable::ClientTty);
243        self
244    }
245
246    /// `client_utf8` - 1 if client supports UTF-8
247    #[cfg(feature = "tmux_1_6")]
248    pub fn client_utf8(&mut self) -> &mut Self {
249        self.push(Variable::ClientUtf8);
250        self
251    }
252
253    /// `client_width` - Width of client
254    #[cfg(feature = "tmux_1_6")]
255    pub fn client_width(&mut self) -> &mut Self {
256        self.push(Variable::ClientWidth);
257        self
258    }
259
260    /// `client_written` - Bytes written to client
261    #[cfg(feature = "tmux_2_4")]
262    pub fn client_written(&mut self) -> &mut Self {
263        self.push(Variable::ClientWritten);
264        self
265    }
266
267    // Command
268
269    /// `command_hooked` - Name of command hooked, if any
270    #[cfg(feature = "tmux_2_3")]
271    pub fn command_hooked(&mut self) -> &mut Self {
272        self.push(Variable::CommandHooked);
273        self
274    }
275
276    /// `command_name` - Name of command in use, if any
277    #[cfg(all(feature = "tmux_2_2", not(feature = "tmux_2_4")))]
278    pub fn command_name(&mut self) -> &mut Self {
279        self.push(Variable::CommandName);
280        self
281    }
282
283    /// `command` - Name of command in use, if any
284    #[cfg(feature = "tmux_2_4")]
285    pub fn command(&mut self) -> &mut Self {
286        self.push(Variable::Command);
287        self
288    }
289
290    /// `command_list_name` - Command name if listing commands
291    #[cfg(feature = "tmux_2_3")]
292    pub fn command_list_name(&mut self) -> &mut Self {
293        self.push(Variable::CommandListName);
294        self
295    }
296
297    /// `command_list_alias` - Command alias if listing commands
298    #[cfg(feature = "tmux_2_3")]
299    pub fn command_list_alias(&mut self) -> &mut Self {
300        self.push(Variable::CommandListAlias);
301        self
302    }
303
304    /// `command_list_usage` - Command usage if listing commands
305    #[cfg(feature = "tmux_2_3")]
306    pub fn command_list_usage(&mut self) -> &mut Self {
307        self.push(Variable::CommandListUsage);
308        self
309    }
310
311    // Cursor
312
313    /// `cursor_flag` - Pane cursor flag
314    #[cfg(feature = "tmux_1_8")]
315    pub fn cursor_flag(&mut self) -> &mut Self {
316        self.push(Variable::CursorFlag);
317        self
318    }
319
320    /// `cursor_character` - Character at cursor in pane
321    #[cfg(feature = "tmux_2_9")]
322    pub fn cursor_character(&mut self) -> &mut Self {
323        self.push(Variable::CursorCharacter);
324        self
325    }
326
327    /// `cursor_x` - Cursor X position in pane
328    #[cfg(feature = "tmux_1_8")]
329    pub fn cursor_x(&mut self) -> &mut Self {
330        self.push(Variable::CursorX);
331        self
332    }
333
334    /// `cursor_y` - Cursor Y position in pane
335    #[cfg(feature = "tmux_1_8")]
336    pub fn cursor_y(&mut self) -> &mut Self {
337        self.push(Variable::CursorY);
338        self
339    }
340
341    /// `copy_cursor_line` - Line the cursor is on in copy mode
342    #[cfg(feature = "tmux_3_1")]
343    pub fn copy_cursor_line(&mut self) -> &mut Self {
344        self.push(Variable::CopyCursorLine);
345        self
346    }
347
348    /// `copy_cursor_word` - Word under cursor in copy mode
349    #[cfg(feature = "tmux_3_1")]
350    pub fn copy_cursor_word(&mut self) -> &mut Self {
351        self.push(Variable::CopyCursorWord);
352        self
353    }
354
355    /// `copy_cursor_x` - Cursor X position in copy mode
356    #[cfg(feature = "tmux_3_1")]
357    pub fn copy_cursor_x(&mut self) -> &mut Self {
358        self.push(Variable::CopyCursorX);
359        self
360    }
361
362    /// `copy_cursor_y` - Cursor Y position in copy mode
363    #[cfg(feature = "tmux_3_1")]
364    pub fn copy_cursor_y(&mut self) -> &mut Self {
365        self.push(Variable::CopyCursorY);
366        self
367    }
368
369    /// `current_file` - Current configuration file
370    #[cfg(feature = "tmux_3_2")]
371    pub fn current_file(&mut self) -> &mut Self {
372        self.push(Variable::CurrentFile);
373        self
374    }
375
376    // history
377
378    /// `history_bytes`             Number of bytes in window history
379    #[cfg(feature = "tmux_1_7")]
380    pub fn histoty_bytes(&mut self) -> &mut Self {
381        self.push(Variable::HistotyBytes);
382        self
383    }
384
385    /// `history_limit`             Maximum window history lines
386    #[cfg(feature = "tmux_1_7")]
387    pub fn history_limit(&mut self) -> &mut Self {
388        self.push(Variable::HistotyLimit);
389        self
390    }
391
392    /// `history_size`              Size of history in bytes
393    #[cfg(feature = "tmux_1_7")]
394    pub fn history_size(&mut self) -> &mut Self {
395        self.push(Variable::HistorySize);
396        self
397    }
398
399    // hook
400
401    /// `hook` - Name of running hook, if any
402    #[cfg(feature = "tmux_2_4")]
403    pub fn hook(&mut self) -> &mut Self {
404        self.push(Variable::Hook);
405        self
406    }
407
408    /// `hook_pane` - ID of pane where hook was run, if any
409    #[cfg(feature = "tmux_2_4")]
410    pub fn hook_pane(&mut self) -> &mut Self {
411        self.push(Variable::HookPane);
412        self
413    }
414
415    /// `hook_session` - ID of session where hook was run, if any
416    #[cfg(feature = "tmux_2_4")]
417    pub fn hook_session(&mut self) -> &mut Self {
418        self.push(Variable::HookSession);
419        self
420    }
421
422    /// `hook_session_name` - Name of session where hook was run, if any
423    #[cfg(feature = "tmux_2_4")]
424    pub fn hook_session_name(&mut self) -> &mut Self {
425        self.push(Variable::HookSessionName);
426        self
427    }
428
429    /// `hook_window` - ID of window where hook was run, if any
430    #[cfg(feature = "tmux_2_4")]
431    pub fn hook_window(&mut self) -> &mut Self {
432        self.push(Variable::HookWindow);
433        self
434    }
435
436    /// `hook_window_name` - Name of window where hook was run, if any
437    #[cfg(feature = "tmux_2_4")]
438    pub fn hook_window_name(&mut self) -> &mut Self {
439        self.push(Variable::HookWindowName);
440        self
441    }
442
443    // host
444
445    /// `host` - Hostname of local host
446    #[cfg(feature = "tmux_1_6")]
447    pub fn host(&mut self) -> &mut Self {
448        self.push(Variable::Host);
449        self
450    }
451
452    /// `host_short` - #h Hostname of local host (no domain name)
453    #[cfg(feature = "tmux_1_9")]
454    pub fn host_short(&mut self) -> &mut Self {
455        self.push(Variable::HostShort);
456        self
457    }
458
459    /// `insert_flag` - Pane insert flag
460    #[cfg(feature = "tmux_1_8")]
461    pub fn insert_flag(&mut self) -> &mut Self {
462        self.push(Variable::InsertFlag);
463        self
464    }
465
466    /// `keypad_cursor_flag` - Pane keypad cursor flag
467    #[cfg(feature = "tmux_1_8")]
468    pub fn keypad_cursor_flag(&mut self) -> &mut Self {
469        self.push(Variable::KeypadCursorFlag);
470        self
471    }
472
473    /// `keypad_flag` - Pane keypad flag
474    #[cfg(feature = "tmux_1_8")]
475    pub fn keypad_flag(&mut self) -> &mut Self {
476        self.push(Variable::KeypadFlag);
477        self
478    }
479
480    /// `line` - Line number in the list
481    #[cfg(feature = "tmux_1_6")]
482    pub fn line(&mut self) -> &mut Self {
483        self.push(Variable::Line);
484        self
485    }
486
487    // `mouse_all_flag` - Pane mouse all flag
488    //#[cfg(feature = "tmux_3_0")]
489    //pub fn mouse_all_flag(&mut self) -> &mut Self {
490    //self.push(Variable::MouseAllFlag);
491    //self
492    //}
493
494    /// `mouse_any_flag` - Pane mouse any flag
495    #[cfg(feature = "tmux_1_8")]
496    pub fn mouse_any_flag(&mut self) -> &mut Self {
497        self.push(Variable::MouseAnyFlag);
498        self
499    }
500
501    /// `mouse_button_flag` - Pane mouse button flag
502    #[cfg(feature = "tmux_1_8")]
503    pub fn mouse_button_flag(&mut self) -> &mut Self {
504        self.push(Variable::MouseButtonFlag);
505        self
506    }
507
508    /// `mouse_line` - Line under mouse, if any
509    #[cfg(feature = "tmux_3_0")]
510    pub fn mouse_line(&mut self) -> &mut Self {
511        self.push(Variable::MouseLine);
512        self
513    }
514
515    /// `sgr_flag` - Pane mouse SGR flag
516    #[cfg(feature = "tmux_3_0")]
517    pub fn sgr_line(&mut self) -> &mut Self {
518        self.push(Variable::MouseSgrFlag);
519        self
520    }
521
522    /// `mouse_standard_flag` - Pane mouse standard flag
523    #[cfg(feature = "tmux_1_8")]
524    pub fn mouse_standard_flag(&mut self) -> &mut Self {
525        self.push(Variable::MouseStandardFlag);
526        self
527    }
528
529    /// `mouse_status_line` - Status line on which mouse event took place
530    #[cfg(feature = "tmux_3_4")]
531    pub fn mouse_status_line(&mut self) -> &mut Self {
532        self.push(Variable::MouseStatusLine);
533        self
534    }
535
536    /// `mouse_status_range` - Range type or argument of mouse event on status line
537    #[cfg(feature = "tmux_3_4")]
538    pub fn mouse_status_range(&mut self) -> &mut Self {
539        self.push(Variable::MouseStatusRange);
540        self
541    }
542
543    /// `mouse_utf8_flag` - Pane mouse UTF-8 flag
544    #[cfg(all(feature = "tmux_1_8", not(feature = "tmux_2_2"), feature = "tmux_3_0"))]
545    pub fn mouse_utf8_flag(&mut self) -> &mut Self {
546        self.push(Variable::MouseUtf8Flag);
547        self
548    }
549
550    /// `mouse_all_flag` - Pane mouse all flag
551    #[cfg(feature = "tmux_2_4")]
552    pub fn mouse_all_flag(&mut self) -> &mut Self {
553        self.push(Variable::MouseAllFlag);
554        self
555    }
556
557    /// `mouse_word` - Word under mouse, if any
558    #[cfg(feature = "tmux_3_0")]
559    pub fn mouse_word(&mut self) -> &mut Self {
560        self.push(Variable::MouseWord);
561        self
562    }
563
564    /// `mouse_x` - Mouse X position, if any
565    #[cfg(feature = "tmux_3_0")]
566    pub fn mouse_x(&mut self) -> &mut Self {
567        self.push(Variable::MouseX);
568        self
569    }
570
571    /// `mouse_y` - Mouse Y position, if any
572    #[cfg(feature = "tmux_3_0")]
573    pub fn mouse_y(&mut self) -> &mut Self {
574        self.push(Variable::MouseY);
575        self
576    }
577
578    /// `origin_flag` - Pane origin flag
579    #[cfg(feature = "tmux_3_0")]
580    pub fn origin_flag(&mut self) -> &mut Self {
581        self.push(Variable::OriginFlag);
582        self
583    }
584
585    // pane
586
587    /// `pane_active` - 1 if active pane
588    #[cfg(feature = "tmux_1_6")]
589    pub fn pane_active(&mut self) -> &mut Self {
590        self.push(Variable::PaneActive);
591        self
592    }
593
594    /// `pane_at_bottom` - 1 if pane is at the bottom of window
595    #[cfg(feature = "tmux_2_6")]
596    pub fn pane_at_bottom(&mut self) -> &mut Self {
597        self.push(Variable::PaneAtBottom);
598        self
599    }
600
601    /// `pane_at_left` - 1 if pane is at the left of window
602    #[cfg(feature = "tmux_2_6")]
603    pub fn pane_at_left(&mut self) -> &mut Self {
604        self.push(Variable::PaneAtLeft);
605        self
606    }
607
608    /// `pane_at_right` - 1 if pane is at the right of window
609    #[cfg(feature = "tmux_2_6")]
610    pub fn pane_at_right(&mut self) -> &mut Self {
611        self.push(Variable::PaneAtRight);
612        self
613    }
614
615    /// `pane_at_top` - 1 if pane is at the top of window
616    #[cfg(feature = "tmux_2_6")]
617    pub fn pane_at_top(&mut self) -> &mut Self {
618        self.push(Variable::PaneAtTop);
619        self
620    }
621
622    /// `pane_bottom` - Bottom of pane
623    #[cfg(feature = "tmux_2_0")]
624    pub fn pane_bottom(&mut self) -> &mut Self {
625        self.push(Variable::PaneBottom);
626        self
627    }
628
629    /// `pane_current_command` - Current command if available
630    #[cfg(feature = "tmux_1_8")]
631    pub fn pane_current_command(&mut self) -> &mut Self {
632        self.push(Variable::PaneCurrentCommand);
633        self
634    }
635
636    /// `pane_current_path` - Current path if available
637    #[cfg(feature = "tmux_1_7")]
638    pub fn pane_current_path(&mut self) -> &mut Self {
639        self.push(Variable::PaneCurrentPath);
640        self
641    }
642
643    /// `pane_dead` - 1 if pane is dead
644    #[cfg(feature = "tmux_1_6")]
645    pub fn pane_dead(&mut self) -> &mut Self {
646        self.push(Variable::PaneDead);
647        self
648    }
649
650    /// `pane_dead_status` - Exit status of process in dead pane
651    #[cfg(feature = "tmux_2_0")]
652    pub fn pane_dead_status(&mut self) -> &mut Self {
653        self.push(Variable::PaneDeadStatus);
654        self
655    }
656
657    /// `pane_format` - 1 if format is for a pane
658    #[cfg(feature = "tmux_2_6")]
659    pub fn pane_format(&mut self) -> &mut Self {
660        self.push(Variable::PaneFormat);
661        self
662    }
663
664    /// `pane_height` - Height of pane
665    #[cfg(feature = "tmux_1_6")]
666    pub fn pane_height(&mut self) -> &mut Self {
667        self.push(Variable::PaneHeight);
668        self
669    }
670
671    /// `pane_id` - #D Unique pane ID
672    #[cfg(feature = "tmux_1_6")]
673    pub fn pane_id(&mut self) -> &mut Self {
674        self.push(Variable::PaneId);
675        self
676    }
677
678    /// `pane_in_mode` - 1 if pane is in a mode
679    #[cfg(feature = "tmux_1_8")]
680    pub fn pane_in_mode(&mut self) -> &mut Self {
681        self.push(Variable::PaneInMode);
682        self
683    }
684
685    /// `pane_index` - #P Index of pane
686    #[cfg(feature = "tmux_1_7")]
687    pub fn pane_index(&mut self) -> &mut Self {
688        self.push(Variable::PaneIndex);
689        self
690    }
691
692    /// `pane_input_off` - 1 if input to pane is disabled
693    #[cfg(feature = "tmux_2_0")]
694    pub fn pane_input_off(&mut self) -> &mut Self {
695        self.push(Variable::PaneInputOff);
696        self
697    }
698
699    /// `pane_left` - Left of pane
700    #[cfg(feature = "tmux_2_0")]
701    pub fn pane_left(&mut self) -> &mut Self {
702        self.push(Variable::PaneLeft);
703        self
704    }
705
706    /// `pane_marked` - 1 if this is the marked pane
707    #[cfg(feature = "tmux_3_0")]
708    pub fn pane_marked(&mut self) -> &mut Self {
709        self.push(Variable::PaneMarked);
710        self
711    }
712
713    /// `pane_marked_set` - 1 if a marked pane is set
714    #[cfg(feature = "tmux_3_0")]
715    pub fn pane_marked_set(&mut self) -> &mut Self {
716        self.push(Variable::PaneMarkedSet);
717        self
718    }
719
720    /// `pane_mode` - Name of pane mode, if any
721    #[cfg(feature = "tmux_2_5")]
722    pub fn pane_mode(&mut self) -> &mut Self {
723        self.push(Variable::PaneMode);
724        self
725    }
726
727    /// `pane_path` - #T Path of pane (can be set by application)
728    #[cfg(feature = "tmux_3_1")]
729    pub fn pane_path(&mut self) -> &mut Self {
730        self.push(Variable::PanePath);
731        self
732    }
733
734    /// `pane_pid` - PID of first process in pane
735    #[cfg(feature = "tmux_1_6")]
736    pub fn pane_pid(&mut self) -> &mut Self {
737        self.push(Variable::PanePid);
738        self
739    }
740
741    /// `pane_pipe` - 1 if pane is being piped
742    #[cfg(feature = "tmux_2_6")]
743    pub fn pane_pipe(&mut self) -> &mut Self {
744        self.push(Variable::PanePipe);
745        self
746    }
747
748    /// `pane_right` - Right of pane
749    #[cfg(feature = "tmux_2_0")]
750    pub fn pane_right(&mut self) -> &mut Self {
751        self.push(Variable::PaneRight);
752        self
753    }
754
755    /// `pane_search_string` - Last search `Option<String>` in copy mode
756    #[cfg(feature = "tmux_2_5")]
757    pub fn pane_search_string(&mut self) -> &mut Self {
758        self.push(Variable::PaneSearchString);
759        self
760    }
761
762    /// `pane_start_command` - Command pane started with
763    #[cfg(feature = "tmux_1_6")]
764    pub fn pane_start_command(&mut self) -> &mut Self {
765        self.push(Variable::PaneStartCommand);
766        self
767    }
768
769    /// `pane_start_path` - Path pane started with
770    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_0")))]
771    pub fn pane_start_path(&mut self) -> &mut Self {
772        self.push(Variable::PaneStartPath);
773        self
774    }
775
776    /// `pane_synchronized` - 1 if pane is synchronized
777    #[cfg(feature = "tmux_1_9")]
778    pub fn pane_synchronized(&mut self) -> &mut Self {
779        self.push(Variable::PaneSynchronized);
780        self
781    }
782
783    /// `pane_tabs` - Pane tab positions
784    #[cfg(feature = "tmux_1_8")]
785    pub fn pane_tabs(&mut self) -> &mut Self {
786        self.push(Variable::PaneTabs);
787        self
788    }
789
790    /// `pane_title` - #T Title of pane (can be set by application)
791    #[cfg(feature = "tmux_1_6")]
792    pub fn pane_title(&mut self) -> &mut Self {
793        self.push(Variable::PaneTitle);
794        self
795    }
796
797    /// `pane_top` - Top of pane
798    #[cfg(feature = "tmux_2_0")]
799    pub fn pane_top(&mut self) -> &mut Self {
800        self.push(Variable::PaneTop);
801        self
802    }
803
804    /// `pane_tty` - Pseudo terminal of pane
805    #[cfg(feature = "tmux_1_6")]
806    pub fn pane_tty(&mut self) -> &mut Self {
807        self.push(Variable::PaneTty);
808        self
809    }
810
811    /// `pane_unseen_changes` - 1 if there were changes in pane while in mode
812    #[cfg(feature = "tmux_3_4")]
813    pub fn pane_unseen_changes(&mut self) -> &mut Self {
814        self.push(Variable::PaneUnseenChanges);
815        self
816    }
817
818    /// `pane_width` - Width of pane
819    #[cfg(feature = "tmux_1_6")]
820    pub fn pane_width(&mut self) -> &mut Self {
821        self.push(Variable::PaneWidth);
822        self
823    }
824
825    /// `saved_cursor_x` - Saved cursor X in pane
826    #[cfg(any(feature = "tmux_1_8", not(feature = "tmux_2_1")))]
827    pub fn saved_cursor_x(&mut self) -> &mut Self {
828        self.push(Variable::SavedCursorX);
829        self
830    }
831
832    /// `saved_cursor_y` - Saved cursor Y in pane
833    #[cfg(any(feature = "tmux_1_8", not(feature = "tmux_2_1")))]
834    pub fn saved_cursor_y(&mut self) -> &mut Self {
835        self.push(Variable::SavedCursorY);
836        self
837    }
838
839    /// `pid` - Server PID
840    #[cfg(feature = "tmux_2_1")]
841    pub fn pid(&mut self) -> &mut Self {
842        self.push(Variable::Pid);
843        self
844    }
845
846    /// `rectangle_toggle` - 1 if rectangle selection is activated
847    #[cfg(feature = "tmux_2_7")]
848    pub fn rectangle_toggle(&mut self) -> &mut Self {
849        self.push(Variable::RectangleToggle);
850        self
851    }
852
853    /// `scroll_position` - Scroll position in copy mode
854    #[cfg(feature = "tmux_2_2")]
855    pub fn scroll_position(&mut self) -> &mut Self {
856        self.push(Variable::ScrollPosition);
857        self
858    }
859
860    /// `scroll_region_lower` - Bottom of scroll region in pane
861    #[cfg(feature = "tmux_1_8")]
862    pub fn scroll_region_lower(&mut self) -> &mut Self {
863        self.push(Variable::ScrollRegionLower);
864        self
865    }
866
867    /// `scroll_region_upper` - Top of scroll region in pane
868    #[cfg(feature = "tmux_1_8")]
869    pub fn scroll_region_upper(&mut self) -> &mut Self {
870        self.push(Variable::ScrollRegionUpper);
871        self
872    }
873
874    /// `selection_active` - 1 if selection started and changes with the curso
875    #[cfg(feature = "tmux_3_1")]
876    pub fn selection_active(&mut self) -> &mut Self {
877        self.push(Variable::SelectionActive);
878        self
879    }
880
881    /// `selection_end_x` - X position of the end of the selection
882    #[cfg(feature = "tmux_3_1")]
883    pub fn selection_end_x(&mut self) -> &mut Self {
884        self.push(Variable::SelectionEndX);
885        self
886    }
887
888    /// `selection_end_y` - Y position of the end of the selection
889    #[cfg(feature = "tmux_3_1")]
890    pub fn selection_end_y(&mut self) -> &mut Self {
891        self.push(Variable::SelectionEndY);
892        self
893    }
894
895    /// `selection_present` - 1 if selection started in copy mode
896    #[cfg(feature = "tmux_2_6")]
897    pub fn selection_present(&mut self) -> &mut Self {
898        self.push(Variable::SelectionPresent);
899        self
900    }
901
902    /// `selection_start_x` - X position of the start of the selection
903    #[cfg(feature = "tmux_3_1")]
904    pub fn selection_start_x(&mut self) -> &mut Self {
905        self.push(Variable::SelectionStartX);
906        self
907    }
908
909    /// `selection_start_y` - Y position of the start of the selection
910    #[cfg(feature = "tmux_3_1")]
911    pub fn selection_start_y(&mut self) -> &mut Self {
912        self.push(Variable::SelectionStartY);
913        self
914    }
915
916    // Session
917    /// `session_activity` - Time of session last activity
918    #[cfg(feature = "tmux_2_1")]
919    pub fn session_activity(&mut self) -> &mut Self {
920        self.push(Variable::SessionActivity);
921        self
922    }
923
924    /// `session_activity_string` - Option<String> time of session last activity
925    #[cfg(all(feature = "tmux_2_1", not(feature = "tmux_2_2")))]
926    pub fn session_activity_string(&mut self) -> &mut Self {
927        self.push(Variable::SessionActivityString);
928        self
929    }
930
931    /// `session_alerts` - List of window indexes with alerts
932    #[cfg(feature = "tmux_2_1")]
933    pub fn session_alerts(&mut self) -> &mut Self {
934        self.push(Variable::SessionAlerts);
935        self
936    }
937
938    /// `session_attached` - Number of clients session is attached to
939    #[cfg(feature = "tmux_1_6")]
940    pub fn session_attached(&mut self) -> &mut Self {
941        self.push(Variable::SessionAttached);
942        self
943    }
944
945    /// `session_attached_list` - List of clients session is attached to
946    #[cfg(feature = "tmux_3_1")]
947    pub fn session_attached_list(&mut self) -> &mut Self {
948        self.push(Variable::SessionAttachedList);
949        self
950    }
951
952    /// `session_created` - Time session created
953    #[cfg(feature = "tmux_1_6")]
954    pub fn session_created(&mut self) -> &mut Self {
955        self.push(Variable::SessionCreated);
956        self
957    }
958
959    /// `session_created_string` - Option<String> time session created
960    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_2")))]
961    pub fn session_created_string(&mut self) -> &mut Self {
962        self.push(Variable::SessionCreatedString);
963        self
964    }
965
966    /// `session_format` - 1 if format is for a session (not assuming the current)
967    #[cfg(feature = "tmux_2_6")]
968    pub fn session_format(&mut self) -> &mut Self {
969        self.push(Variable::SessionFormat);
970        self
971    }
972
973    /// `session_group` - Name of session group
974    #[cfg(feature = "tmux_1_6")]
975    pub fn session_group(&mut self) -> &mut Self {
976        self.push(Variable::SessionGroup);
977        self
978    }
979
980    /// `session_group_attached` - Number of clients sessions in group are attached >
981    #[cfg(feature = "tmux_3_1")]
982    pub fn session_group_attached(&mut self) -> &mut Self {
983        self.push(Variable::SessionGroupAttached);
984        self
985    }
986
987    /// `session_group_attached_list` - List of clients sessions in group are attached to
988    #[cfg(feature = "tmux_3_1")]
989    pub fn session_group_attached_list(&mut self) -> &mut Self {
990        self.push(Variable::SessionGroupAttachedList);
991        self
992    }
993
994    /// `session_group_list` - List of sessions in group
995    #[cfg(feature = "tmux_2_7")]
996    pub fn session_group_list(&mut self) -> &mut Self {
997        self.push(Variable::SessionGroupList);
998        self
999    }
1000
1001    /// `session_group_many_attached` - 1 if multiple clients attached to sessions in gro
1002    #[cfg(feature = "tmux_3_1")]
1003    pub fn session_group_many_attached(&mut self) -> &mut Self {
1004        self.push(Variable::SessionGroupManyAttached);
1005        self
1006    }
1007
1008    /// `session_group_size` - Size of session group
1009    #[cfg(feature = "tmux_2_7")]
1010    pub fn session_group_size(&mut self) -> &mut Self {
1011        self.push(Variable::SessionGroupSize);
1012        self
1013    }
1014
1015    /// `session_grouped` - 1 if session in a group
1016    #[cfg(feature = "tmux_1_6")]
1017    pub fn session_grouped(&mut self) -> &mut Self {
1018        self.push(Variable::SessionGrouped);
1019        self
1020    }
1021
1022    /// `session_height` - Height of session
1023    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_9")))]
1024    pub fn session_height(&mut self) -> &mut Self {
1025        self.push(Variable::SessionHeight);
1026        self
1027    }
1028
1029    /// `session_width` - Width of session
1030    #[cfg(all(feature = "tmux_1_6", not(feature = "tmux_2_9")))]
1031    pub fn session_width(&mut self) -> &mut Self {
1032        self.push(Variable::SessionWidth);
1033        self
1034    }
1035
1036    /// `session_id` - Unique session ID
1037    #[cfg(feature = "tmux_1_8")]
1038    pub fn session_id(&mut self) -> &mut Self {
1039        self.push(Variable::SessionId);
1040        self
1041    }
1042
1043    /// `session_last_attached` - Time session last attached
1044    #[cfg(feature = "tmux_2_1")]
1045    pub fn session_last_attached(&mut self) -> &mut Self {
1046        self.push(Variable::SessionLastAttached);
1047        self
1048    }
1049
1050    /// `session_last_attached_string` - Option<String> time session last attached
1051    #[cfg(all(feature = "tmux_2_1", not(feature = "tmux_2_2")))]
1052    pub fn session_last_attached_string(&mut self) -> &mut Self {
1053        self.push(Variable::SessionLastAttachedString);
1054        self
1055    }
1056
1057    /// `session_many_attached` - 1 if multiple clients attached
1058    #[cfg(feature = "tmux_2_0")]
1059    pub fn session_many_attached(&mut self) -> &mut Self {
1060        self.push(Variable::SessionManyAttached);
1061        self
1062    }
1063
1064    /// `session_name` - #S Name of session
1065    #[cfg(feature = "tmux_1_6")]
1066    pub fn session_name(&mut self) -> &mut Self {
1067        self.push(Variable::SessionName);
1068        self
1069    }
1070
1071    /// `session_stack` - Window indexes in most recent order
1072    #[cfg(feature = "tmux_2_5")]
1073    pub fn session_stack(&mut self) -> &mut Self {
1074        self.push(Variable::SessionStack);
1075        self
1076    }
1077
1078    /// `session_windows` - Number of windows in session
1079    #[cfg(feature = "tmux_1_6")]
1080    pub fn session_windows(&mut self) -> &mut Self {
1081        self.push(Variable::SessionWindows);
1082        self
1083    }
1084
1085    /// `socket_path` - Server socket path
1086    #[cfg(feature = "tmux_2_2")]
1087    pub fn socket_path(&mut self) -> &mut Self {
1088        self.push(Variable::SocketPath);
1089        self
1090    }
1091
1092    /// `start_time` - Server start time
1093    #[cfg(feature = "tmux_2_2")]
1094    pub fn start_time(&mut self) -> &mut Self {
1095        self.push(Variable::StartTime);
1096        self
1097    }
1098
1099    /// `version` - Server version
1100    #[cfg(feature = "tmux_2_4")]
1101    pub fn version(&mut self) -> &mut Self {
1102        self.push(Variable::Version);
1103        self
1104    }
1105
1106    // Window
1107    //
1108    /// `window_active` - 1 if window active
1109    #[cfg(feature = "tmux_1_6")]
1110    pub fn window_active(&mut self) -> &mut Self {
1111        self.push(Variable::WindowActive);
1112        self
1113    }
1114
1115    /// `window_active_clients` - Number of clients viewing this window
1116    #[cfg(feature = "tmux_3_1")]
1117    pub fn window_active_clients(&mut self) -> &mut Self {
1118        self.push(Variable::WindowActiveClients);
1119        self
1120    }
1121
1122    /// `window_active_clients_list` - List of clients viewing this window
1123    #[cfg(feature = "tmux_3_1")]
1124    pub fn window_active_clients_list(&mut self) -> &mut Self {
1125        self.push(Variable::WindowActiveClientsList);
1126        self
1127    }
1128
1129    /// `window_active_sessions` - Number of sessions on which this window is active
1130    #[cfg(feature = "tmux_3_1")]
1131    pub fn window_active_sessions(&mut self) -> &mut Self {
1132        self.push(Variable::WindowActiveSessions);
1133        self
1134    }
1135
1136    /// `window_active_sessions_list` - List of sessions on which this window is active
1137    #[cfg(feature = "tmux_3_1")]
1138    pub fn window_active_sessions_list(&mut self) -> &mut Self {
1139        self.push(Variable::WindowActiveSessionsList);
1140        self
1141    }
1142
1143    /// `window_activity` - Time of window last activity
1144    #[cfg(feature = "tmux_2_1")]
1145    pub fn window_activity(&mut self) -> &mut Self {
1146        self.push(Variable::WindowActivity);
1147        self
1148    }
1149
1150    /// `window_activity_string` - String time of window last activity
1151    #[cfg(all(feature = "tmux_2_1", not(feature = "tmux_2_2")))]
1152    pub fn window_activity_string(&mut self) -> &mut Self {
1153        self.push(Variable::SessionActivityString);
1154        self
1155    }
1156
1157    /// `window_activity_flag` - 1 if window has activity
1158    #[cfg(any(
1159        all(feature = "tmux_1_9", not(feature = "tmux_2_2")),
1160        feature = "tmux_2_3"
1161    ))]
1162    pub fn window_activity_flag(&mut self) -> &mut Self {
1163        self.push(Variable::WindowActivityFlag);
1164        self
1165    }
1166
1167    /// `window_bell_flag` - 1 if window has bell
1168    #[cfg(feature = "tmux_1_9")]
1169    pub fn window_bell_flag(&mut self) -> &mut Self {
1170        self.push(Variable::WindowBellFlag);
1171        self
1172    }
1173
1174    /// `window_content_flag` - 1 if window has content alert
1175    #[cfg(all(feature = "tmux_1_9", not(feature = "tmux_2_0")))]
1176    pub fn window_content_flag(&mut self) -> &mut Self {
1177        self.push(Variable::WindowContentFlag);
1178        self
1179    }
1180
1181    /// `window_bigger` - 1 if window is larger than client
1182    #[cfg(feature = "tmux_2_9")]
1183    pub fn window_bigger(&mut self) -> &mut Self {
1184        self.push(Variable::WindowBigger);
1185        self
1186    }
1187
1188    /// `window_cell_height` - Height of each cell in pixels
1189    #[cfg(feature = "tmux_3_1")]
1190    pub fn window_cell_height(&mut self) -> &mut Self {
1191        self.push(Variable::WindowCellHeight);
1192        self
1193    }
1194
1195    /// `window_cell_width` - Width of each cell in pixels
1196    #[cfg(feature = "tmux_3_1")]
1197    pub fn window_cell_width(&mut self) -> &mut Self {
1198        self.push(Variable::WindowCellWidth);
1199        self
1200    }
1201
1202    /// `window_end_flag` - 1 if window has the highest index
1203    #[cfg(feature = "tmux_2_9")]
1204    pub fn window_end_flag(&mut self) -> &mut Self {
1205        self.push(Variable::WindowEndFlag);
1206        self
1207    }
1208
1209    /// `window_find_matches` - Matched data from the find-window command if available
1210    #[cfg(all(feature = "tmux_1_7", not(feature = "tmux_2_6")))]
1211    pub fn window_find_matches(&mut self) -> &mut Self {
1212        self.push(Variable::WindowFindMatches);
1213        self
1214    }
1215
1216    /// `window_flags` - #F Window flags
1217    #[cfg(feature = "tmux_1_6")]
1218    pub fn window_flags(&mut self) -> &mut Self {
1219        self.push(Variable::WindowFlags);
1220        self
1221    }
1222
1223    // TODO: WindowRawFlags
1224    /// `window_raw_flags` - Window flags with nothing escaped
1225    #[cfg(feature = "tmux_3_2")]
1226    pub fn window_raw_flags(&mut self) -> &mut Self {
1227        self.push(Variable::WindowRawFlags);
1228        self
1229    }
1230
1231    /// `window_format` - 1 if format is for a window
1232    #[cfg(feature = "tmux_2_6")]
1233    pub fn window_format(&mut self) -> &mut Self {
1234        self.push(Variable::WindowFormat);
1235        self
1236    }
1237
1238    /// `window_height` - Height of window
1239    #[cfg(feature = "tmux_1_6")]
1240    pub fn window_height(&mut self) -> &mut Self {
1241        self.push(Variable::WindowHeight);
1242        self
1243    }
1244
1245    /// `window_id` - Unique window ID
1246    #[cfg(feature = "tmux_1_7")]
1247    pub fn window_id(&mut self) -> &mut Self {
1248        self.push(Variable::WindowId);
1249        self
1250    }
1251
1252    /// `window_index` - #I Index of window
1253    #[cfg(feature = "tmux_1_6")]
1254    pub fn window_index(&mut self) -> &mut Self {
1255        self.push(Variable::WindowIndex);
1256        self
1257    }
1258
1259    /// `window_last_flag` - 1 if window is the last used
1260    #[cfg(feature = "tmux_2_0")]
1261    pub fn window_last_flag(&mut self) -> &mut Self {
1262        self.push(Variable::WindowLastFlag);
1263        self
1264    }
1265
1266    /// `window_layout` - Window layout description, ignoring zoomed window panes
1267    #[cfg(feature = "tmux_1_6")]
1268    pub fn window_layout(&mut self) -> &mut Self {
1269        self.push(Variable::WindowLayout);
1270        self
1271    }
1272
1273    /// `window_linked` - 1 if window is linked across sessions
1274    #[cfg(feature = "tmux_2_1")]
1275    pub fn window_linked(&mut self) -> &mut Self {
1276        self.push(Variable::WindowLinked);
1277        self
1278    }
1279
1280    /// `window_linked_sessions` - Number of sessions this window is linked to
1281    #[cfg(feature = "tmux_3_1")]
1282    pub fn window_linked_sessions(&mut self) -> &mut Self {
1283        self.push(Variable::WindowLinkedSessions);
1284        self
1285    }
1286
1287    /// `window_linked_sessions_list` - List of sessions this window is linked to
1288    #[cfg(feature = "tmux_3_1")]
1289    pub fn window_linked_sessions_list(&mut self) -> &mut Self {
1290        self.push(Variable::WindowLinkedSessionsList);
1291        self
1292    }
1293
1294    /// `window_marked_flag` - 1 if window contains the marked pane
1295    #[cfg(feature = "tmux_3_1")]
1296    pub fn window_marked_flag(&mut self) -> &mut Self {
1297        self.push(Variable::WindowMarkedFlag);
1298        self
1299    }
1300
1301    /// `window_name` - #W Name of window
1302    #[cfg(feature = "tmux_1_6")]
1303    pub fn window_name(&mut self) -> &mut Self {
1304        self.push(Variable::WindowName);
1305        self
1306    }
1307
1308    /// `window_offset_x` - X offset into window if larger than client
1309    #[cfg(feature = "tmux_2_9")]
1310    pub fn window_offset_x(&mut self) -> &mut Self {
1311        self.push(Variable::WindowOffsetX);
1312        self
1313    }
1314
1315    /// `window_offset_y` - Y offset into window if larger than client
1316    #[cfg(feature = "tmux_2_9")]
1317    pub fn window_offset_y(&mut self) -> &mut Self {
1318        self.push(Variable::WindowOffsetY);
1319        self
1320    }
1321
1322    /// `window_panes` - Number of panes in window
1323    #[cfg(feature = "tmux_1_7")]
1324    pub fn window_panes(&mut self) -> &mut Self {
1325        self.push(Variable::WindowPanes);
1326        self
1327    }
1328
1329    /// `window_silence_flag` - 1 if window has silence alert
1330    #[cfg(feature = "tmux_1_9")]
1331    pub fn window_silence_flag(&mut self) -> &mut Self {
1332        self.push(Variable::WindowSilenceFlag);
1333        self
1334    }
1335
1336    /// `window_stack_index` - Index in session most recent stack
1337    #[cfg(feature = "tmux_2_5")]
1338    pub fn window_stack_index(&mut self) -> &mut Self {
1339        self.push(Variable::WindowStackIndex);
1340        self
1341    }
1342
1343    /// `window_start_flag` - 1 if window has the lowest index
1344    #[cfg(feature = "tmux_2_9")]
1345    pub fn window_start_flag(&mut self) -> &mut Self {
1346        self.push(Variable::WindowStartFlag);
1347        self
1348    }
1349
1350    /// `window_visible_layout` - Window layout description, respecting zoomed window panes
1351    #[cfg(feature = "tmux_2_2")]
1352    pub fn window_visible_layout(&mut self) -> &mut Self {
1353        self.push(Variable::WindowVisibleLayout);
1354        self
1355    }
1356
1357    /// `window_width` - Width of window
1358    #[cfg(feature = "tmux_1_6")]
1359    pub fn window_width(&mut self) -> &mut Self {
1360        self.push(Variable::WindowWidth);
1361        self
1362    }
1363
1364    /// `window_zoomed_flag` - 1 if window is zoomed
1365    #[cfg(feature = "tmux_2_0")]
1366    pub fn window_zoomed_flag(&mut self) -> &mut Self {
1367        self.push(Variable::WindowZoomedFlag);
1368        self
1369    }
1370
1371    /// `wrap_flag` - Pane wrap flag
1372    #[cfg(feature = "tmux_1_8")]
1373    pub fn wrap_flag(&mut self) -> &mut Self {
1374        self.push(Variable::WrapFlag);
1375        self
1376    }
1377}