这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Rillian-Grant
Copy link

This change removes finished terminal sessions from the recent apps view.

@agnostic-apollo
Copy link
Member

Reasonable, but that will need to be added as a termux.properties property since not everyone would want that. Default should be false.

https://github.com/termux/termux-app/blob/master/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxPropertyConstants.java

@Rillian-Grant
Copy link
Author

I've added it. Could you check my placement of it it the settings menu along with the text.

Screenshot_20220817-225853.png

@Rillian-Grant
Copy link
Author

While working on this I noticed that the app exits with finishAndRemoveTask if the back button is pressed. Should this be the case as pressing the back button is a less extreme exit than the terminal itself exiting?

Apologies for the large screenshot.

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Aug 17, 2022

You have added it in preferences, not in properties like mentioned above. Termux user settings must all go in termux.properties so that they can be backed up easily by users, unless they are critical and accessing them with termux.properties would be an issue if something breaks or they shouldn't be backed up.

Should this be the case as pressing the back button is a less extreme exit than the terminal itself exiting?

You should check with TermuxService if any sessions remain before calling finishAndRemoveTask().

A key like remove-termux-activity-from-recents-on-exit should be fine.

@Rillian-Grant
Copy link
Author

Rillian-Grant commented Aug 18, 2022

I've added it to properties and undone the other changes.
Can you advise on how to add the option commented out to the default termux.properties file?

At present, the back button calls finishAndRemoveTask no matter how many sessions remain. This seems wrong. Some better options are:

  • Exiting the app with no effect on running sessions and staying in recent apps.
  • Closing the current session or if none remains exit and remove from recent apps.

But this looks like a separate issue, I'll create a separate issue and pull request.

@RalfWerner
Copy link

A key like remove-termux-activity-from-recents-on-exit should be fine.

What happens when it set?

Current state in the screenshot below, the recent processes are on the left. Termux was finished here and also to the right where a SSH session on the same device that was also ended after the ps process was displayed. The notifications are no longer included, which remains the case when an SSH session is started again.
It is only back when the recent Termux session is activated again. In the notifications, Termux can be closed with exit, but this maintains the process status and the recent processes.
grafik
Except 2842 and 4737 all other processes have ended only when the recent Termux process is removed. If Termux is then started again (first OTS=5411+2842+8786+8793), this is no longer possible without ending Termux-X11 via the notification.
Removing the recent Termux-X11 process (like for Termux) is here insufficient!

@agnostic-apollo
Copy link
Member

I've added it to properties and undone the other changes.

The key variable name and function name must match the key name.

Can you advise on how to add the option commented out to the default termux.properties file?

That goes in https://github.com/termux/termux-tools/blob/master/termux.properties

This seems wrong.

Following should likely work from a quick look. There might be other cases as well that may need to be looked into.

if (mProperties.isRemoveTermuxActivityFromRecentsOnExitEnabled() && mTermuxService != null && mTermuxService.isTermuxSessionsEmpty())
	finishAndRemoveTask();
else
	finish();

But this looks like a separate issue, I'll create a separate issue and pull request.

It is not a separate issue, you created the issue in this pull request with the feature add and any issues should be fixed here and feature properly implemented before it can be merged.

And there should be no merge commits in pull requests.

@RalfWerner

This comment was marked as off-topic.

@nomeata
Copy link

nomeata commented Apr 20, 2023

I just noticed that syncthing has added code to remove it from recent tasks upon exit, which made me happy. The other “persistentish” app where I always have to manually kill it from the recent tasks list to avoid accidentally restarting it is termux, so I came to suggest the same. Glad someone is already working on it! Much appreciated. @Rillian-Grant, are you going to see this through code review?

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.

4 participants