Android N multi-window support
This PR adds full multi-window support for Android 7.0+.
As soon as the framework enters multi-window mode a new button "New window" (keyboard shortcut Ctrl+Alt+W) becomes visible in the drawer menu. Clicking the button will create a new window. Terminal sessions are shared between windows, however, only one terminal window may attach to a specific session at a time. When creating a new window, the first unattached session will be attached to the new window. If no unattached sessions are available, a new session will be created.
Some screenshots of Termux running in multi-window mode on Android 7.1.1:
(split-screen)
(freeform mode)
In the second screenshot, for example, the left window may not be attached to sessions 2 and 3, since they are already attached to the other windows. Any window can switch to session 4.
ping @fornwall Could you have a look at this PR? Thanks!
@pp3345 Thanks, looks interesting!
What's currently the best way to test freeform mode on a device or emulator?
Freeform mode is still unofficial and experimental in Android. It may be enabled on any device or emulator running Android 7.0 or 7.1 by executing adb shell settings put global enable_freeform_support 1. After rebooting the device (or emulator), apps may be switched to freeform mode by opening Recent Apps and long-clicking on an app window until a square icon appears in the upper right (rarely it won't appear, then just close Recent Apps and try again). Clicking the icon will move the app to freeform. Freeform still has some quirks and bugs, but most of the time it works okay. Split-screen always works and does not require unlocking freeform mode.
Freeform feels better when using a real mouse instead of touch input, especially when resizing windows (you need to hit some unhighlighted area around the window for resizing with touch input), but for testing, touch should be okay.
ping @fornwall Any news?
@pp3345 Sorry for the delay here! Will look into it soon and get back to you (I just have some other issues and features in the pipeline I want to get done first).
News?
?
Nothing has happened here for a while since I didn't receive any feedback from the Termux developer. By now, the PR has some conflicts with the base branch. I'll be happy to resolve those conflicts and update the PR but first I'd like to get some feedback from @fornwall or else this doesn't seem to make a lot of sense to me.
Any updates here?
what's holding this up? I would really like to see this feature added.
I've put the app functionality itself on the back burner for a while focusing on packages, but I'm planning to give the app itself some love going forward!
@pp3345 About freeform mode, has anything happened with that in the upcoming Android 8? Is it getting more official and/or has anything changed?
@fornwall I am not sure about that, I haven't tried out Android O so far. There is nothing about changes to multi-window support in https://developer.android.com/preview/api-overview.html. I'll install the current DP on my Pixel C and see if anything has changed.
Freeform seems to be just the same as in Android 7. The same bugs are still there and it still needs to be enabled manually via adb. This PR still seems to work fine though after some quick tests:

I think this should be merged.
@fornwall So, is this going to happen any time soon?
Ping. This would help me a lot. Please merge.
This would be great, starting to use my Samsung Dex a lot for development. Sometimes I like to create multiple windows to watch multiple build processes. Any chance of getting these conflicts resolved and this PR merged in for a release please?
Isn't this pr obsoleted by https://github.com/termux/termux-app/pull/339? At least the split screen feature works for me on a Lenovo tablet. Or are you talking about the free form windows?
Oh oops. Yes, sorry. I filtered on open PRs when I should have filtered on both open and closed. Nice! Now I'm going to look into better mouse support for selecting text and clicking links. Thanks
Ping @pp3345, still need this and want to get it in?
@buttaface Never received any feedback from @fornwall and time has passed, so there is a pile of conflicts now. I am not really motivated to put effort into fixing them given that this PR got ignored for so much time already.
@fornwall or @xeffyr, if you'd like to get this feature in, I will work with @pp345 to get it merged. Just let us know.
@buttaface I'm ok with it, if it doesn't conflict with or break existing functionality.
@pp3345, it looks like this pull has slipped through the cracks. @xeffyr and I are both more recent committers for Termux and if you update your pull, I will review it and help you get this in.
@buttaface: Okay, I'll try to update the PR. I am afraid I won't have time for that soon though, please give me a month or two.
No hurry, take your time.
Hey any updates? This feature would be an great addition
Any chances of this still making it to a release in the future?
Any chances of this still making it to a release in the future?
There is always a chance (in multiverse of madness)! ;)
The idea is actually pretty interesting. However, termux-app has been refactored greatly in the last year or so, so branch would need updating. I would need to take a closer look at the code too. Also will need to take into consideration that termux-float needs to be merged into termux-app in future, which may have similar reqs.