Skip to content

Commit 2baad92

Browse files
committed
tmuxp support for -g in window.show_window_option, window.show_window_options.
1 parent 26b1578 commit 2baad92

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

tmuxp/window.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,31 @@ def set_window_option(self, option, value):
153153
process.stderr
154154
)
155155

156-
def show_window_options(self, option=None):
156+
def show_window_options(self, option=None, g=False):
157157
"""Return a dict of options for the window.
158158
159159
For familiarity with tmux, the option ``option`` param forwards to pick
160160
a single option, forwarding to :meth:`Window.show_window_option`.
161161
162162
:param option: optional. show a single option.
163163
:type option: string
164+
:param g: Pass ``-g`` flag for global variable
165+
:type g: bool
164166
:rtype: :py:obj:`dict`
165167
166168
"""
167169

170+
tmux_args = tuple()
171+
172+
if g:
173+
tmux_args += ('-g',)
174+
168175
if option:
169-
return self.show_window_option(option)
176+
return self.show_window_option(option, g=g)
170177
else:
178+
tmux_args += ('show-window-options',)
171179
window_options = self.tmux(
172-
'show-window-options'
180+
*tmux_args
173181
).stdout
174182

175183
window_options = [tuple(item.split(' ')) for item in window_options]
@@ -182,19 +190,28 @@ def show_window_options(self, option=None):
182190

183191
return window_options
184192

185-
def show_window_option(self, option):
193+
def show_window_option(self, option, g=False):
186194
"""Return a list of options for the window.
187195
188196
todo: test and return True/False for on/off string
189197
190198
:param option: option to return.
191199
:type option: string
200+
:param g: Pass ``-g`` flag, global.
201+
:type g: bool
192202
:rtype: string, int
193203
194204
"""
195205

206+
tmux_args = tuple()
207+
208+
if g:
209+
tmux_args += ('-g',)
210+
211+
tmux_args += (option,)
212+
196213
window_option = self.tmux(
197-
'show-window-options', option
214+
'show-window-options', *tmux_args
198215
).stdout
199216

200217
if window_option:

0 commit comments

Comments
 (0)