termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2.12k stars 314 forks source link

Added: Auto launch fullscreen on external display (Android 10+) #158

Closed dkramer95 closed 2 years ago

dkramer95 commented 2 years ago

This is only applicable for Android 10+ devices that support HDMI output over USB and have enabled the Experimental desktop mode developer option. (Oreo technically supports external displays, but keyboard + mouse input isn't mapped properly, so wouldn't be very useful.)

If there is an external display connected, the MainActivity will be launched on that external display. It will also be displayed in fullscreen w/o any navigation / floating window controls, allowing to use entire display surface area.

My Setup

On my personal device, I have a tasker termux shortcut accessible from home screen that runs the commands from the README

export XDG_RUNTIME_DIR=${TMPDIR}
termux-x11 :1 &
env DISPLAY=:1 xfce4-session

Now, when I tap the shortcut the MainActivity will be launched on my external display if it is connected.

twaik commented 2 years ago

Looks interesting. Did you override navbar appearing on external display? Or navbar appears every time you try to use taskbar in GUI?

dkramer95 commented 2 years ago

Ya the nav bar consumed ~100px of vertical height on external display and is basically dead space. (No part of the Activity can show in that blank area, it's just grey) So for external displays, it will be hidden.

5A52 commented 2 years ago

Unfortunatelly does not change anything in samsung DEX mode. Im not good in android programming, but can i provide any log or debug information?

twaik commented 2 years ago

It is intended to work with Android Desktop mode, not Dex.

5A52 commented 2 years ago

Is there any way to recognise Dex as an external display also?

twaik commented 2 years ago

As far as I know it is not external display, or at least not in traditional meaning.

dkramer95 commented 2 years ago

@5A52 It might be possible... I don't have a Samsung DEX capable device to test... Currently it is checking for the Experimental Desktop mode flag. Since DEX is a much more polished implementation, I highly doubt that flag exists on Samsung devices, but if you have adb installed you can check with:

adb shell settings get global "force_desktop_mode_on_external_displays"

If null is returned then it doesn't exist.

If you have Android Studio, you can just comment out that check:

Change this line to:

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || /*!hasEnabledAndroidDesktopModeSetting()*/ || externalDisplay == null) {

and see if it works...

I'm not sure how/if Samsung handles mapping keyboard + mouse input on external displays if it wasn't launched from DEX.

v8karlo commented 2 years ago

#

Samsung S20 DEX

Full screen without upper Nav Bar and down Bar

#

image

#

Enabled Force Desktop Mode [ Experimental Desktop mode on secondary displays ] Restart DEX [ Build#196 installed ] and start X11

image

#

image

#

5A52 commented 2 years ago

@v8karlo Thanks, works, but at least with 3 disadvantages

  1. starts minimised
  2. With force desktop mode enabled, touchpad icon disapiers from phone NAV bar
  3. When hitting bottom edge with cursor DEX bar pops out I think the better option will be to have "full screen" chekbox in preferencies. Because even on phone screen full screen is useful sometime.
twaik commented 2 years ago

When hitting bottom edge with cursor DEX bar pops out I think the better option will be to have "full screen" chekbox in preferencies. Because even on phone screen full screen is useful sometime.

We can not disable this behaviour. It happens in normal Android, desktop mode and DEX. I can try to write a tool which can work with adb or root rights and intercept mouse and keyboard events, but it will not happen soon.

5A52 commented 2 years ago

We can not disable this behaviour. It happens in normal Android, desktop mode and DEX. I can try to write a tool which can work with adb or root rights and intercept mouse and keyboard events, but it will not happen soon.

xsdl Xserver does somehow. Not sure if it intercepts mouse. Also most full screen app does, m$ RDP, any full screen game. Anyway intercepting mouse\keyboard is a GREAT idea, alt+f4 will be intercepted in this case!! And not in a far future, is it possible to add a full screen chekbox in preferencies screen? It is much better than auto launch full screen by detecting screen modes.

twaik commented 2 years ago

As far as I know no app can app can avoid navbar appearing. It is a part of security mechanisms of Android... But we can intercept Alt+F4 and other key combinations on Samsungdevices suporting DEX. See https://github.com/termux/termux-x11/issues/47#issuecomment-1202070823

twaik commented 2 years ago

Regular application can hide navbar but can not disable it completely. Anyway it appears when you move mouse to area of navbar or do swipe up bottom edge of screen...

pecbraz commented 2 years ago

I have a strange issue using the hdmi output. It goes indeed fullscreen, but the colors are all lighter/brighter, and it's very noticiable. For example, black turn into grey... This is super annoying. Could it be some android setting that affects full screen apps? If I disable Force Desktop Mode in developer settings, the colors are normal again, but no fullscreen in this case...

I'm also having the issue of it starting minimized, but not so annoying as the color issue.

The DEX bar pops out moving the mouse to the bottom, but this does not annoy me, it's actually good, so then I can close termux-x11 from the notifications shortcut, or change to other apps from there.

I'm still able to use the phone as a touchpad, so this issue I do not have.

PS: my device is a Z Fold 4 with proot-distro with xfce4

v8karlo commented 2 years ago

#

@v8karlo Thanks, works, but at least with 3 disadvantages

  1. starts minimised
  2. With force desktop mode enabled, touchpad icon disapiers from phone NAV bar
  3. When hitting bottom edge with cursor DEX bar pops out I think the better option will be to have "full screen" chekbox in preferencies. Because even on phone screen full screen is useful sometime.

#

  1. Yes , minimized , I can live with that , no big deal .
  2. I am working with Linux only in DEX mode on big screen , never on mobile , so for me thats ok ! Mosue and keyboard only .
  3. I mix all the time DEX and Linux software and bottom DEX bar is wanted to use both Android and Linux together , the only thing which is missing is Clipboard beetween Android and Linux in order to use both as one OS .

The Clipboard Android Linux is last step which I need .

I hope you understand what I am trying to accomplish .

#

twaik commented 2 years ago

the only thing which is missing is Clipboard beetween Android and Linux in order to use both as one OS .

I am already on it, but it will take some time.

v8karlo commented 2 years ago

Thx Twaik , the Clipboard Android Liinux is essencial .

Anyway thx for all the huge effort you did till now !

v8karlo commented 2 years ago

#

Zman from Ubuntu on Android already have some success on Clipboard ,

and is almost done .

Maybe will be good idea to invite him on this matter ?

#

v8karlo commented 2 years ago

I proposed same to Zman .

twaik commented 2 years ago

I already know what exactly I must do to make clipboard support, but first I need to write wayland protocol parser and get rid of JNI in core code. It is pretty simple, but requires a lot of time for writing and debugging code.

v8karlo commented 2 years ago

I understand how much time and effort it needs .

Thx again on your excelent work !!!

5A52 commented 2 years ago

3. the only thing which is missing is Clipboard beetween Android and Linux

Yes this will be very good feature, but "full screen" chek box in preferencies is also very usefull. I prefere to have full screen even on phone screen.

twaik commented 2 years ago

It is already in TODO list.

twaik commented 2 years ago

For some reason it was disabled by @suhan-paradkar . https://github.com/termux/termux-x11/commit/a7f4111b10c30900aed75341d0257a0cf9ac8c9d

twaik commented 2 years ago

a detailed knowledge of your lorie implementation

I am preparing a big update so it will be a bit outdated.

I still find the idea (common ExtraKeys) very interesting.

Me too.

v8karlo commented 2 years ago

Enabled Force Desktop Mode [ Experimental Desktop mode on secondary displays ]

messed up my phone display ( DEX worked fine ) , when I disable it everything went back to normal .

So I can not use it for full screen .

Maybe full screen check box is a good idea at the end .

kulturguda commented 1 year ago

Build is expired, how can I download to test it?