!7 cmodule ELESystemWindows > ELESuggester { start { dm_onUserUtterance(lambda1 processUtterance); } void processUtterance(S s) { print("Got input: " + s); if (dm_moduleIsPoppedOut()) { if (l(suggestions) == 1) { S id = squareBracketStuff(first(suggestions)); if "activate" { print("Activating window " + first(suggestions); activateSystemWindow(wmctrl_EntryFromID(id)); ret; } if "close" { dm_confirmAction("Close window " + quote(afterSquareBracketStuff(first(suggestions))), rEnter { dm_closeSystemWindow(wmctrl_EntryFromID(id)); }); ret; } } else if (l(suggestions) > 1) { print("Filtering for: " + s); LS l = containingIC(suggestions, s); if (nempty(l)) showSuggestions(s, l); ret; } } if "system windows" { print("Showing suggestions and popping out"); showSuggestions(s, map(dm_windows(), w -> "[" + w.windowIdentity + "] " + w.windowTitle)); dm_popOutAndActivateModule(module()); assertEquals(dm_current_mandatory(), module()); } } }