openOrFocus
This commit is contained in:
parent
988d2f8ee4
commit
91e9ccd92e
1 changed files with 11 additions and 3 deletions
|
|
@ -32,6 +32,7 @@ os =
|
|||
|
||||
focusWindow = index \
|
||||
batch [
|
||||
osState.palette.visible := False,
|
||||
osState.wm.focusedIndex := index,
|
||||
osState.wm.scrollOffset := scrollToWindow index
|
||||
];
|
||||
|
|
@ -167,13 +168,20 @@ os =
|
|||
Item { label = q }
|
||||
];
|
||||
|
||||
openOrFocus = title content \
|
||||
index title (map (w \ w.title) osState.windows)
|
||||
| Some i \ focusWindow i
|
||||
| None \ openWindow title content;
|
||||
|
||||
onSelect = input \
|
||||
result = eval input;
|
||||
_ = debug "onSelect eval result" result;
|
||||
result
|
||||
| Defined name \ openOrFocus name (size \ inspector { name = name, w = size.w, h = size.h })
|
||||
|
||||
| Value v \ (getSource input == ""
|
||||
| True \ openWindow input (_ \ ui.text { content = show v, color = "white" })
|
||||
| False \ openWindow input (size \ inspector { name = input, w = size.w, h = size.h }));
|
||||
| True \ openOrFocus input (_ \ ui.text { content = show v, color = "white" })
|
||||
| False \ openOrFocus input (size \ inspector { name = input, w = size.w, h = size.h }))
|
||||
| Err msg \ (_ = debug "Error" msg; noOp);
|
||||
|
||||
handleFocusLeftEvent = state \
|
||||
newIndex = max 0 (osState.wm.focusedIndex - 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue