Esempio n. 1
0
def window_state(ui_window: Ident, twindow: Window, layout: ViewTree) -> Do:
    window_id = yield TS.from_maybe(twindow.id, 'window_state: `{twindow}` has no id')
    native_window_e = yield TS.lift(window(window_id))
    native_window = yield TS.from_either(native_window_e)
    panes = yield TS.lift(window_panes(window_id))
    native_pane, tail = yield TS.from_maybe(panes.detach_head, 'no panes in window')
    reference_pane = yield pane_by_id(native_pane.id)
    state = (
        reference_pane
        .map(L(TrackedWindow)(native_window, ui_window, layout, native_pane, _)) |
        L(PristineWindow)(native_window, ui_window, layout, native_pane)
    )
    yield TS.pure(state)
Esempio n. 2
0
 def go() -> Do:
     yield ui_open_simple_pane(StrIdent('one'))
     yield ui_open_simple_pane(StrIdent('two'))
     yield open_simple_pane(StrIdent('three'))
     panes = yield all_panes().state
     positions = panes / _.position
     yield TS.from_maybe(positions.lift_all(0, 1, 2),
                         'invalid number of panes')
Esempio n. 3
0
def create_tmux_window(session: Session, ident: Ident) -> Do:
    sid = yield TS.from_maybe(session.id, 'no session id')
    yield TS.lift(create_window(sid, ident.str))