openOrFocus

master
Dustin Swan 1 week ago
parent 988d2f8ee4
commit 91e9ccd92e
Signed by: dustinswan
GPG Key ID: 30D46587E2100467

@ -32,6 +32,7 @@ os =
focusWindow = index \ focusWindow = index \
batch [ batch [
osState.palette.visible := False,
osState.wm.focusedIndex := index, osState.wm.focusedIndex := index,
osState.wm.scrollOffset := scrollToWindow index osState.wm.scrollOffset := scrollToWindow index
]; ];
@ -167,13 +168,20 @@ os =
Item { label = q } Item { label = q }
]; ];
openOrFocus = title content \
index title (map (w \ w.title) osState.windows)
| Some i \ focusWindow i
| None \ openWindow title content;
onSelect = input \ onSelect = input \
result = eval input; result = eval input;
_ = debug "onSelect eval result" result;
result result
| Defined name \ openOrFocus name (size \ inspector { name = name, w = size.w, h = size.h })
| Value v \ (getSource input == "" | Value v \ (getSource input == ""
| True \ openWindow input (_ \ ui.text { content = show v, color = "white" }) | True \ openOrFocus input (_ \ ui.text { content = show v, color = "white" })
| False \ openWindow input (size \ inspector { name = input, w = size.w, h = size.h })); | False \ openOrFocus input (size \ inspector { name = input, w = size.w, h = size.h }))
| Err msg \ (_ = debug "Error" msg; noOp);
handleFocusLeftEvent = state \ handleFocusLeftEvent = state \
newIndex = max 0 (osState.wm.focusedIndex - 1); newIndex = max 0 (osState.wm.focusedIndex - 1);

Loading…
Cancel
Save