|
|
|
|
@ -37,6 +37,26 @@ closeWindowById = id \
|
|
|
|
|
i = index id (map (w \ w.id) osState.windows);
|
|
|
|
|
closeWindowByIndex (unwrapOr 0 i);
|
|
|
|
|
|
|
|
|
|
scrollToWindow = index \
|
|
|
|
|
windows = osState.windows;
|
|
|
|
|
widths = map (w \ w.width) windows;
|
|
|
|
|
gap = 1;
|
|
|
|
|
windowX = (sum (take index widths)) + (index * gap);
|
|
|
|
|
windowW = unwrapOr 400 (nth index widths);
|
|
|
|
|
scrollOffset = osState.wm.scrollOffset;
|
|
|
|
|
vw = viewport.width;
|
|
|
|
|
(windowX < scrollOffset
|
|
|
|
|
| True \ windowX
|
|
|
|
|
| False \ (windowX + windowW > scrollOffset + vw
|
|
|
|
|
| True \ windowX + windowW - vw
|
|
|
|
|
| False \ scrollOffset));
|
|
|
|
|
|
|
|
|
|
focusWindow = index \
|
|
|
|
|
batch [
|
|
|
|
|
osState.wm.focusedIndex := index,
|
|
|
|
|
osState.wm.scrollOffset := scrollToWindow index
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
onSelect = input \
|
|
|
|
|
result = eval input;
|
|
|
|
|
result
|
|
|
|
|
@ -100,8 +120,8 @@ windowComponent = config \ ui.stateful {
|
|
|
|
|
focusable = True,
|
|
|
|
|
init = {},
|
|
|
|
|
update = state event \ event
|
|
|
|
|
| Focused \ { state = state, emit = [osState.wm.focusedIndex := config.index] }
|
|
|
|
|
| ChildFocused \ { state = state, emit = [osState.wm.focusedIndex := config.index] }
|
|
|
|
|
| Focused \ { state = state, emit = [focusWindow config.index] }
|
|
|
|
|
| ChildFocused \ { state = state, emit = [focusWindow config.index] }
|
|
|
|
|
| _ \ { state = state, emit = [] },
|
|
|
|
|
view = state \ renderWindow config.window config.isActive
|
|
|
|
|
};
|
|
|
|
|
@ -120,20 +140,6 @@ renderWindows = _ \
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
scrollToWindow = index \
|
|
|
|
|
windows = osState.windows;
|
|
|
|
|
widths = map (w \ w.width) windows;
|
|
|
|
|
gap = 1;
|
|
|
|
|
windowX = (sum (take index widths)) + (index * gap);
|
|
|
|
|
windowW = unwrapOr 400 (nth index widths);
|
|
|
|
|
scrollOffset = osState.wm.scrollOffset;
|
|
|
|
|
vw = viewport.width;
|
|
|
|
|
(windowX < scrollOffset
|
|
|
|
|
| True \ windowX
|
|
|
|
|
| False \ (windowX + windowW > scrollOffset + vw
|
|
|
|
|
| True \ windowX + windowW - vw
|
|
|
|
|
| False \ scrollOffset));
|
|
|
|
|
|
|
|
|
|
os = ui.stateful {
|
|
|
|
|
key = "os",
|
|
|
|
|
autoFocus = True,
|
|
|
|
|
@ -146,18 +152,12 @@ os = ui.stateful {
|
|
|
|
|
| Key { key = "ArrowLeft", meta = True } \
|
|
|
|
|
(
|
|
|
|
|
newIndex = max 0 (osState.wm.focusedIndex - 1);
|
|
|
|
|
{ state = state, emit = [
|
|
|
|
|
osState.wm.focusedIndex := newIndex,
|
|
|
|
|
osState.wm.scrollOffset := scrollToWindow newIndex
|
|
|
|
|
] }
|
|
|
|
|
{ state = state, emit = [focusWindow newIndex] }
|
|
|
|
|
)
|
|
|
|
|
| Key { key = "ArrowRight", meta = True } \
|
|
|
|
|
(
|
|
|
|
|
newIndex = min (len osState.windows - 1) (osState.wm.focusedIndex + 1);
|
|
|
|
|
{ state = state, emit = [
|
|
|
|
|
osState.wm.focusedIndex := newIndex,
|
|
|
|
|
osState.wm.scrollOffset := scrollToWindow newIndex
|
|
|
|
|
] }
|
|
|
|
|
{ state = state, emit = [focusWindow newIndex] }
|
|
|
|
|
)
|
|
|
|
|
| Key { key = "d", meta = True } \
|
|
|
|
|
{ state = state, emit = [closeFocusedWindow 0] }
|
|
|
|
|
|