Open Rishi5813 opened 3 years ago
By Shortcuts, do you mean shortcuts from the Shortcuts app? I’m not completely sure I understand what you’re asking for.
Yes, Shortcuts App
Yes, We can add a keyword called run-shortcut and write the name of shortcut we want to run.
It would be great if we could just open a code editor app by running a shortcut or even automation would work on iSH.
but you can mount shortcut folder into iSh and then iSh can access shortcul file.
combining with rc script, you can start iSh who, at startup, fetch a script from shortcut folder ;-)
send from my mobile.
François
Le 20 févr. 2021 à 04:53, Fluzzlesnuff notifications@github.com a écrit :
To run Shortcuts from the Shortcuts app, iSH would have to have access to Shortcuts files. iSH is sandboxed, meaning that it can only access its own app files. Perhaps iOS has a built-in API for running Shortcuts, but if not, this would not be possible.
That's what I understand about the issue. I am not an iOS developer, and it is possible that I don't know what I'm talking about.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
By Shortcuts, do you mean shortcuts from the Shortcuts app? I’m not completely sure I understand what you’re asking for.
There is no use for running shortcuts, but using shortcuts to execute ish commands is very useful and achievable
By Shortcuts, do you mean shortcuts from the Shortcuts app? I’m not completely sure I understand what you’re asking for.
There is no use for running shortcuts, but using shortcuts to execute ish commands is very useful and achievable
What's the difference between "running a shortcut" and a shortcut that's 'used to execute iSH commands'?
I don’t think that is possible as iSH is a virtual machine, and can’t actually interact with your devices files let alone open apps or get and execute data from them, unless some modifications are done not actually interacting with the Linux shell. If that is what you mean by “Shortcuts”. If you mean executing a bundle of commands with one command, just use shell script (.sh). Which is a script made up of a bunch of commands and functions. Or, of course, you can also always use alias.
By Shortcuts, do you mean shortcuts from the Shortcuts app? I’m not completely sure I understand what you’re asking for.
There is no use for running shortcuts, but using shortcuts to execute ish commands is very useful and achievable
I can think of many uses for running shortcuts from within iSH, @ppouerct. Being able to do this would allow iSH to control many aspects of the device, like dark mode and focus mode, and to make use of other native apps to process files generated inside iSH, for example.
What's the difference between "running a shortcut" and a shortcut that's 'used to execute iSH commands'?
"Running a shortcut" means invoking an existing shortcut on the device from within iSH. This could be achieved a command similar to open
on macOS, or xdc-open
on linux, which opens a URL in the default app, because shortcuts can be run via a shortcuts://
URL. Adding this command would also allow opening websites in the default system browser from within iSH.
"A shortcut being able to execute iSH commands" would involve registering a URL scheme for iSH itself on the so that other apps and shortcuts could invoke iSH via its own URL scheme, and use X-Callback URLs to receive the stdout from the command, for example. @62f
I just took a quick look at the code, my thinking is that adding another device similar to the PasteBoard at /dev/clipboard
could be used to achieve opening URLs using the iOS native handler. I.e. you write a URL to the device, and iSH asks the system to open that URL. E.g. echo "shortcuts://blah-blah" > /dev/open
If that works, it would be really useful by itself. Maybe it could eventually be extended by also allowing writing a handler binary path for a given X-Callback URL, so that the called shortcut/app could pass data back into iSH once done. E.g.:
# Set up the handler
HANDLER='{ "my-handler": { command: "echo \"$RESULT\"", "shell": "/bin/bash -euo pipefail -c"}}'
echo "$HANDLER" > /dev/handlers
# Invoke the shortcut
URL="shortcuts://x-callback-url/run-shortcut?name=???&input=text&text=???&x-success=ish://my-handler"
echo "$URL" > /dev/open
Hm, my C is not up to scratch, but if you think the design above sounds reasonable, I could attempt to implement this @tbodt ^ (I mean, I would copy/paste the clipboard device code and modify it until hopefully worked...)
Has anyone ever found a way to invoke an ios shortcut from ish?
I just took a quick look at the code, my thinking is that adding another device similar to the PasteBoard at
/dev/clipboard
could be used to achieve opening URLs using the iOS native handler. I.e. you write a URL to the device, and iSH asks the system to open that URL. E.g.echo "shortcuts://blah-blah" > /dev/open
If that works, it would be really useful by itself. Maybe it could eventually be extended by also allowing writing a handler binary path for a given X-Callback URL, so that the called shortcut/app could pass data back into iSH once done. E.g.:
# Set up the handler HANDLER='{ "my-handler": { command: "echo \"$RESULT\"", "shell": "/bin/bash -euo pipefail -c"}}' echo "$HANDLER" > /dev/handlers # Invoke the shortcut URL="shortcuts://x-callback-url/run-shortcut?name=???&input=text&text=???&x-success=ish://my-handler" echo "$URL" > /dev/open
Hm, my C is not up to scratch, but if you think the design above sounds reasonable, I could attempt to implement this @tbodt ^ (I mean, I would copy/paste the clipboard device code and modify it until hopefully worked...)
This is very good design, it would make for an incredibly versatile adapter as such. It fits within the model too, like /dev/location.
I don’t think that is possible as iSH is a virtual machine, and can’t actually interact with your devices files let alone open apps or get and execute data from them, unless some modifications are done not actually interacting with the Linux shell. If that is what you mean by “Shortcuts”. If you mean executing a bundle of commands with one command, just use shell script (.sh). Which is a script made up of a bunch of commands and functions. Or, of course, you can also always use alias.
I'm coming back to this thread a while later to see if there was any progress, and I just thought it necessary to point out for newcomers who may not be able to judge for themselves -- nearly everything in this comment is incorrect and it does more damage to the discussion than it does any good. This commenter either doesn't understand ish or virtualization/emulation on a very basic level. (virtualization =\= emulation, and whether or not something can interact with the host system is not just a matter of if it's a virtual machine. Which ish categorically is not.)
I still love that api design a year later though @samsalisbury . Though I'm unsure how you'd manage handlers past the point of shouting them into existence into the void. Remove, list etc. I guess it could just be more /dev
s.
I don’t think that is possible as iSH is a virtual machine, and can’t actually interact with your devices files let alone open apps or get and execute data from them, unless some modifications are done not actually interacting with the Linux shell. If that is what you mean by “Shortcuts”. If you mean executing a bundle of commands with one command, just use shell script (.sh). Which is a script made up of a bunch of commands and functions. Or, of course, you can also always use alias.
I too WiSH that was true,
For those who are looking for a workaround, I found this in the wiki which is absolutely relevant:
https://github.com/ish-app/ish/wiki/Shortcuts-Integration-Workaround
It's a bit DIY and you'll have to know your way around the shell, but if your desire is to use ish from shortcuts, to be able to drop-into shell, it wouldn't make much sense if you are anyways uncomfortable IN shell. But anyways, I may try and make a shortcut & publish it that can make this a bit easier for users. Not as nice as @samsalisbury 's handler & open API, but I think it can have its arm twisted to get equivalent functionality.
It took me far too much trial and error, but I have developed a way to do this, starting with the outline in the comment above. It’s a little janky, by necessity, but it functions well, and can pass variables back and forth. It can launch a program within iSH from a Shortcut, and then pass variables out of iSH to any URI compatible app, including shortcuts.
https://github.com/Nihilentropy-117/ISH-iOS-bridge/tree/main
It uses root SSH here, and I would definitely advise against that, as well as setting SSH to only accept connections from Localhost. This is really just a proof of functionality though, and I’m so tired of looking at it today.
I'm putting a $50 USD bounty on an actual real iSH "run command" shortcut action and another $50 USD on having it not open the app in the foreground The built-in SSH action is giving me weird and ungoogleable errors that nobody's ever had before and I'm SICK of it
I prefer to use paypal for this but I'm willing to use alternatives if that gets this resolved. Money obviously goes to whoever implements it
It would be great if the iSH App could run Shortcuts. For example if you want to get a full desktop experience you can run a Shortcut which opens a app on a command just like vs code’s “code.” Shortcut.