Replies: 2 comments 2 replies
-
I was wondering when someone would bring this up 😇 I'm AFK today, but I'll type up what it will look like tomorrow. We should be able to keep it really simple 😊 |
Beta Was this translation helpful? Give feedback.
-
The concept of an "action" or "context menu" in a UI doesn't really exist when thinking about running a script in a terminal. The closest concept we have is "flags", e.g., Flags are already supported (although I've never talked about it) in Script Kit as they're just named booleans on // testing-flags
let value = await arg("Some file")
if (arg?.open) {
console.log(`Open ${value}`)
} else {
console.log(`${value}`)
} testing-flags pizza.js --open
# This is broken:
testing-flags --open pizza.js Script Kit uses Conversely, we never prompt for flags. We assume Making the UI flag-aware
☝️ I agree, in some cases. So we need a way for the user to inject a flag while the script is already running. // A function which immediately sends flag options to the UI
flags({
open: {
shortcut: "cmd+o",
},
edit: {
shortcut: "cmd+e",
},
}) When the script runs, now the UI would know there are some options/flags for the script. The big difference between Script Kit and other tools is that these are script options (not arg options). "Submit" a flagIn the UI, a user would expect to So we can do this: if a user right-clicks or presses a shortcut, then prompt for // Makes the UI aware of available flags, but doesn't prompt unless user requests
flags({
open: {
shortcut: "cmd+o",
},
edit: {
shortcut: "cmd+e",
},
})
let value = await arg("Some file")
// If the user submit a flag, then Kit internals will toggle these to `true`
if (flags?.open) {
console.log(`Open ${value}`)
} else {
console.log(`${value}`)
} This should feel like the same experience from Raycast/Alfred, just conceptually different.
|
Beta Was this translation helpful? Give feedback.
-
Raycast has an super useful feature I am not able to replicate in kit.
By hitting the
cmd+k
shortcut, you are able to provide a list of options for the selected item. However, you can also trigger the main action (opening the file) by just using the enter key. Alfred also provide this feature in the file view using the right arrow key.I propose this syntax to replicate the feature in kit:
Using the right arrow key, you would list the available options. But you can trigger an option directly with the keyboard shortcut.
It seems the closer alternative in kit is tabs, but I feel like it complicates both the dev experience and the user experience quite a bit. It seems more logical to me to select a task and then select an action.
Beta Was this translation helpful? Give feedback.
All reactions