a-shell icon indicating copy to clipboard operation
a-shell copied to clipboard

a-shell keeps ios26 and ipad0s26 devices on

Open tthkbw opened this issue 2 months ago • 7 comments

Since switching to ios26 and ipados26, if a-shell is in the foreground and I set the device aside, the device stays on--that is, the screen does not go blank, I have to manually turn the device off, or switch to another app or the desktop.

Am I missing a setup that enables this? How do I fix it?

tthkbw avatar Nov 25 '25 22:11 tthkbw

I have no idea what is happening here. I hadn't noticed it on my iOS 26 devices. I'll need to run more tests.

holzschu avatar Nov 26 '25 09:11 holzschu

Based on your comment, I did a bit more careful research on this issue this morning.

I mostly use a-shell as an ssh client. Turns out, that if you run the ssh client and leave the device alone, it never turns off. If you are just running a-shell locally on the device, it does.

Maybe the ssh client is continually pinging the server and that keeps it alive? I know Blink has a setting that does something to keep from closing the connection when turning off the device.

Anyway, maybe a good place to look. And I don't think previous versions of a-shell did this.

tthkbw avatar Nov 26 '25 16:11 tthkbw

same prob, iOS 26.2, it keeps the session even if I exit and restart the app.

KrsMt-0113 avatar Nov 26 '25 17:11 KrsMt-0113

https://github.com/holzschu/a-shell/blob/ef73cea64044ed6afd6e1317622de4007f9801b4/a-Shell/SceneDelegate.swift#L2537_L2550

The ssh command doesn't exit until disconnected from a server, so it might be stuck between these lines. If so, UIApplication.shared.isIdleTimerDisabled = false will never be executed, preventing a device from turning its display off.

kkebo avatar Nov 26 '25 20:11 kkebo

Thank you for the extra information. This issue is indeed connected to the lines pointed by @kkebo. I added those lines a while ago (1-2 years?), at the request of other users, so that a-Shell does not go to sleep when it's running a long-running command (like curl or ffmpeg). I remember that they didn't work then, so it's reassuring that they're working now.

Now, we need to think about the specific of ssh. Unlike other commands, you want a-Shell to go to sleep while running ssh. I can add a specific case for ssh here. The bad news is that if a-Shell goes to sleep for a long time, it will disconnect to the server. I could also add a line to restart ssh if ssh was running when a-Shell was terminated (this functionality is already present for dash and vim).

holzschu avatar Nov 27 '25 09:11 holzschu

I could also add a line to restart ssh if ssh was running when a-Shell was terminated (this functionality is already present for dash and vim).

If the purpose is to reconnect to the server, I think that's insufficient.

On iOS, TCP/UDP sockets are closed when the device enters sleep mode (≠ screen lock). That's a common issue.

  • https://forum.qt.io/topic/77402/ios-network-socket-being-closed-on-sleep

In such situations, since the TCP socket closes while a-Shell remains alive, a-Shell will not attempt to reconnect to the server even if the device is woken from sleep.

It's a very difficult problem.

kkebo avatar Nov 27 '25 14:11 kkebo

I added those lines a while ago (1-2 years?), at the request of other users, so that a-Shell does not go to sleep when it's running a long-running command (like curl or ffmpeg).

Since it only works on iOS 26 and later, this is a future consideration, but if a-Shell can determine in advance that the command that is about to execute will take time, the following API might be a smarter solution than isIdleTimerDisabled.

https://developer.apple.com/documentation/backgroundtasks/performing-long-running-tasks-on-ios-and-ipados?language=objc

kkebo avatar Nov 27 '25 15:11 kkebo

Just want to chip in here... I don't use ssh at all, and what @KrsMt-0113 described:

same prob, iOS 26.2, it keeps the session even if I exit and restart the app.

...happens on my end too. Simple steps to reproduce:

  • cd /to/a/path
  • ls
  • exit
  • close a-Shell from the iOS App Switcher
  • re-open it, and often times a-Shell renders the past session/history (with output from the above commands)

saiki-k avatar Dec 09 '25 09:12 saiki-k