Offer Rename / Kill when long pressing a session in the drawer - #5264
Offer Rename / Kill when long pressing a session in the drawer#5264kedimuzafer wants to merge 2 commits into
Conversation
Long pressing a session in the drawer went straight to renaming it, so there was no way to close a session from the drawer at all. Killing one meant switching to it first and using the terminal's own context menu, or typing exit. Long press now opens a two item dialog offering Rename and Kill, with the same confirmation prompt the terminal context menu uses before killing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
finishIfRunning() only sends SIGKILL. The process exits asynchronously, and TermuxSession.finish() ignores a session that is still running, so removing the session in the same breath silently did nothing: killing a live session from the drawer left it in the list. An already exited session was removed fine, which hid the bug. Defer the removal to onSessionFinished() instead, via killAndRemoveSession(). Sessions that exit on their own are unaffected. Also build the dialogs with android.app.AlertDialog, as the rest of the app does. The appcompat builder picks up the activity theme, whose window background is black, leaving the buttons unreadable.
|
Pushed a fix for two problems in the original commit, found while using it. Killing a running session did not remove it. The removal is now deferred to The confirmation dialog was unreadable. It was built with |
Long pressing a session in the drawer goes straight to renaming it, so there is no way to close a
session from the drawer at all. Killing one means switching to it first and using the terminal's own
context menu, or typing
exit.This makes long press open a two item dialog offering Rename and Kill. Rename keeps the
existing behaviour; Kill reuses the same confirmation prompt (
title_confirm_kill_session) beforecalling
finishIfRunning()and removing the finished session, matching what the terminal contextmenu already does.
Two strings are added for the menu items and one for the confirmation.
Tested on an Android 16 device and an API 31 emulator: renaming still works, killing removes the
session from the drawer list, and cancelling leaves it running.