User Input #527
Replies: 4 comments 8 replies
-
is it possible to 'preload' the text to make it a bit like: |
Beta Was this translation helpful? Give feedback.
-
Is there a way to allow multiple-select on arg options? |
Beta Was this translation helpful? Give feedback.
-
It would be great if one could use This would allow for some vim or emacs like For example: // Menu: [C]ycle through windows
// Description: Use arrows up and down to cycle through the stacked windows
let cont = true;
while(cont) {
focusedWindow = await getFocusedWindow();
let keyData = await hotkey({
// this would be the setting I'd like to have
invisiblePrompt: true,
// Exit the script on escape, kind of like exiting a mode
onEscape: async () => {
cont = false;
}
});
if(keyData.key === 'ArrowDown') {
await $`yabai -m window --focus stack.next`;
}
if(keyData.key === 'ArrowUp') {
await $`yabai -m window --focus stack.prev`;
}
} Is this possible already somehow? |
Beta Was this translation helpful? Give feedback.
-
Hello, How can I create an |
Beta Was this translation helpful? Give feedback.
-
User Input
Receive text from a user by adding
arg
to your script:arg
will prompt the user to enter text, wait for the text, then return the value of the text tovalue
and continue on with the script.You can then use
value
as a string in your script however you want.If you want to tell the user what information the prompt expects, provide a string:
If you want give the user options to select, provide an array as the second argument:
Drag and drop
Prompt the user to drag and drop a file by using the
drop
method:Longer Text
Allow the user to input multiple lines of text using
textarea
:Pre-load the
textarea
with text by passing a string:Code Editor
(💵 In the future, using
editor
will require a paid update)Launch a full code editor using
editor
. This is greatPre-load the
editor
with text and specify a language for code highlighting/features:Keyboard Shortcut
If you were to type
cmd+j
,keyData
would give you the following response:Beta Was this translation helpful? Give feedback.
All reactions