Closed pbartyik closed 4 years ago
let ws = tmux_interface::Windows::get(&session_name, tmux_interface::window::WINDOW_ALL).unwrap();
fixes
Hi,
thank you for your feedback, for choosing/using the library.
If you are calling the function Windows::get()
:
let ws = tmux_interface::Windows::get(&session_name, 64).unwrap();
it expects one or many WINDOW_XXXXXX
flags as the secondary argument. In your example 64
is equal to 1 << 6
(bitwise shift left) and it is equal to WINDOW_FLAGS
flag. This produces the following string as request command to tmux:
tmux list-windows -t session_name -F "#{window_flags}"
and the resulting Windows
structure will be something like:
Vec {
// first window, all fields except window_flag are empty
Window {
None, None, None, ..., Some(WindowFlag(WINDOW_FLAG_DEFAULT), None, None, ...}
},
// second window
Window {
None, None, None, ..., Some(WindowFlag(WINDOW_FLAG_CURRENT), None, None, ...}
},
...
}
You are right you can request all supported fields by using WINDOW_ALL
flag:
let ws = tmux_interface::Windows::get(&session_name, WINDOW_ALL).unwrap();
or you can manually set the bitflag combination for fields you need, for example WINDOW_ID | WINDOW_FLAGS | WINDOW_NAME | WINDOW_HEIGHT | WINDOW_WIDTH
let ws = tmux_interface::Windows::get(
&session_name,
WINDOW_ID | WINDOW_FLAGS | WINDOW_NAME | WINDOW_HEIGHT | WINDOW_WIDTH
).unwrap();
It is made to reduce the size of the text exchanging between tmux and user application.
Sorry for missing documentation which would help you faster. I mark this as documentation required issue.
Please be advised, the library (especially dev
branch) is still in experimental development stage and it is not well tested:
many features are not implemented, or can fail some APIs/structures/names/... can be changed in future some design patterns of the library can be changed etc…
Thanks, digged solution out from source code :)
Session 0 has two windows, one unnamed (id 0) and one named
asd
(id 1). Session 0 window id 1 has two panes.Output of program: