Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add support for using iSH on Apple Watches #842

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

AlexGustafsson
Copy link

Intent

The intent of this PR is to start development for supporting iSH on Apple Watches.

iSH is a fantastic piece of code which I think is quite unprecedented. By implementing support for watchOS, the project could continue to grow and allow for new use cases.

Goals

Goals:

  • Support basic iSH functionality on WatchOS such as running commands and seeing their output

Non-goals:

  • Fully interactive shell due to quite obvious interaction constraints on watches

Planned approach

The watch app will be developed using Swift and SwiftUI. The app is meant to run side by side with the iSH app and act as a simple UI for the app.

Within the main iOS app a view will be added to support saving commands such as nslookup google.com for easy access within the watchOS app. The watchOS app will then allow for running these commands and see their output.

The app is planned to interact with the same layer as the terminal running within the iOS app to enable shared interactions.

Comments

I hope to continue to work on this PR every now and then, but without any real time constraints.

I welcome any comments on code quality, procedures etc.

@tbodt
Copy link
Member

tbodt commented Jul 26, 2020

I'm not entirely convinced this is a good idea, but I guess we'll find out.

Also it's best if you use objective-c instead of swift, the app is small enough that adding an empty swift file would inflate it by 5x.

@AlexGustafsson
Copy link
Author

AlexGustafsson commented Jul 30, 2020

@tbodt I’m not sure if how representative it is, but for me the iSH app went from 4.9MB to 8.5MB according to the systems settings. It is quite bad in relative terms, but not quite 5X. I think the situation has gotten a lot better recently since Apple is now bundling most things related to Swift within iOS, which they didn’t do for quite some time (if I remember things correctly).

I’ll try to get the MVP running with Swift and SwiftUI due to its simplicity and then port it to ObjC once we know what we want to achieve.

As for the use cases you’re describing, @filfat, that’s more or less exactly what I’m trying to solve. It mostly works now, but there’s no way of simply adding commands to show up on the watch.

The extension of this is to get the Shortcuts app to work with iSH, but that’s an issue for another day.

@tbodt
Copy link
Member

tbodt commented Jul 30, 2020

Also iSH supports iOS 11, so SwiftUI is out. But it's ok to start with SwiftUI and then port it to ObjC/UIKit.

The 5x number came from building the project in release mode, measuring the size in the finder, than adding an empty swift file and doing it again. It was something like 6mb/30mb.

@AlexGustafsson
Copy link
Author

Thanks for the explanation, @tbodt, Swift is definitely out then.

@saagarjha saagarjha mentioned this pull request Oct 7, 2020
@dontbanmeplz
Copy link

What about preset commands that can be changed from the app

@AlexGustafsson
Copy link
Author

@dontbanmeplz I was thinking about that as well and that's what I'm currently doing in the WIP. However, with the arrival of the Shortcut app to the watch, perhaps it's better to investigate if one can handle commands from Shortcuts instead. Does anyone know if it's possible to add custom abilities so that iSH can be invoked from Shortcuts? If so, we might kill two birds with one stone by implementing that support instead.

@dontbanmeplz
Copy link

@AlexGustafsson if you could make it so you could execute commands and see their output from shortcuts app the shortcuts community would now have no bounds and they would thank you. if it is possible PLEASE do that.

@tbodt
Copy link
Member

tbodt commented Dec 15, 2020

See #59. I looked into this once but at the time the shortcut would have to execute in a different process which would make it pretty unworkable. iOS 14 removes this limitation with in-app intent handling, but I haven't had the chance to give it another shot. Would appreciate contributions here.

@dontbanmeplz
Copy link

Tbh i know nothing about iOS coding so i cant be of much help

@ifuchs
Copy link

ifuchs commented Dec 15, 2020 via email

@dontbanmeplz
Copy link

Well yes but you know it would be so much better

@0n1cOn3
Copy link

0n1cOn3 commented Jun 25, 2023

Hey !

Interesting approach. But There was no update even after 3 years. So I would like to ask what the current stage this WIP is and if this will be continued or dropped.

Thanks in advance
0n1c0n3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants