15 from string_util
import *
18 server = libtmux.Server()
19 session = server.sessions[0]
20 curWindow = session.attached_window
21 curPane = session.attached_pane
27 return "\n".join(pane.cmd(
"capturep",
"-p").stdout)
36 paneId = paneId % len(window.panes)
40 if type(windowNameOrId)
is int:
41 windowNameOrId =
"@" + str(windowNameOrId)
42 window = session.get_by_id(windowNameOrId)
43 if window
is not None:
47 windowTuples = map(
lambda x : (x._info[
"window_name"], x), session.windows)
48 filteredWindows = filter (
lambda (name, window): name == windowNameOrId, windowTuples)
49 if len(filteredWindows) > 0:
50 return filteredWindows[0][1]
54 if window
is not None:
55 window.select_window()
57 print(
"window not found")
60 return len(session.windows)
63 windows = session.windows
64 validWindowIds = map(
lambda x: x._window_id, windows)
70 for i
in range(0, nPanes):
77 for i
in range(0, nPanes):
91 return len(session.attached_window.panes)
95 paneId = paneId % nPanes
96 session.attached_window.panes[paneId].select_pane()
99 session.attached_pane.cmd(
"send-keys",
"C-C")
106 lastSymbol = lastLine[-1]
if len(lastLine) > 0
else "" 107 if "$" == lastSymbol:
116 session.attached_pane.cmd(
"send-keys",
"Up")
117 session.attached_pane.enter()
124 lastSymbol = lastLine[-1]
if len(lastLine) > 0
else "" 125 if "$" == lastSymbol:
131 oldPane = session.attached_pane
132 if type(windowAndPanes)
is not list:
133 windowAndPanes = [windowAndPanes]
134 for (windowNameOrId, paneId)
in windowAndPanes:
138 oldPane.window.select_window()
139 oldPane.select_pane()
142 oldPane = session.attached_pane
143 if type(windowAndPanes)
is not list:
144 windowAndPanes = [windowAndPanes]
145 for (windowNameOrId, paneId)
in windowAndPanes:
149 oldPane.window.select_window()
150 oldPane.select_pane()
157 subprocess.call(
"tmux kill-server", shell=
True)
def restartPanes(windowAndPanes)
def getTmuxOut(windowNameOrId, paneId)
def terminateAllWindows()
def terminatePanes(windowAndPanes)
def getWindow(windowNameOrId)
def selectWindow(windowNameOrId)
def selectWindowAndPane(windowNameOrId, paneId)
def terminateCurrentPane()
def getLastLinesFrom(str, pos)