termux / termux-x11

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

Enable always landscape mode and fullscreen/immersive #78

Closed sukualam closed 1 year ago

sukualam commented 2 years ago

Actually to do that i must use xposed plugin (App Setting Reborn) to override the orientation to always landscape and hide status bar / immersive

Can make this feature built-in instead use xposed?

Dr4kzor commented 1 year ago

Status bar can be removed easily with this changes: https://github.com/termux/termux-x11/pull/185

polkaulfield commented 1 year ago

I made an immersive fullscreen patch. It hides the navigation bar and status bar. Here's my fork: https://github.com/polkaulfield/termux-x11/releases

polkaulfield commented 1 year ago

The patch itself:

Index: app/src/main/java/com/termux/x11/MainActivity.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/com/termux/x11/MainActivity.java b/app/src/main/java/com/termux/x11/MainActivity.java
--- a/app/src/main/java/com/termux/x11/MainActivity.java    (revision f36c19da8e43a5e40c631ce9cc4ddf6a3cc57e1d)
+++ b/app/src/main/java/com/termux/x11/MainActivity.java    (revision 1f27088d351ce07b120ee64176b6ab95a9306df3)
@@ -41,9 +41,13 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

+        /*
         if (didRequestLaunchExternalDisplay()) {
             setFullScreenForExternalDisplay();
         }
+        */
+        // Do it anyways
+        setFullScreenForExternalDisplay();

         LorieService.setMainActivity(this);
         LorieService.start(LorieService.ACTION_START_FROM_ACTIVITY);
Index: app/src/main/java/com/termux/x11/TermuxX11StarterReceiver.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/com/termux/x11/TermuxX11StarterReceiver.java b/app/src/main/java/com/termux/x11/TermuxX11StarterReceiver.java
--- a/app/src/main/java/com/termux/x11/TermuxX11StarterReceiver.java    (revision f36c19da8e43a5e40c631ce9cc4ddf6a3cc57e1d)
+++ b/app/src/main/java/com/termux/x11/TermuxX11StarterReceiver.java    (revision 1f27088d351ce07b120ee64176b6ab95a9306df3)
@@ -68,13 +68,16 @@
     @Nullable
     private Display findExternalDisplay() {
         DisplayManagerCompat displayManager = DisplayManagerCompat.getInstance(this);
+        Display fallbackDisplay = null;
         for (Display display : displayManager.getDisplays()) {
             // id 0 is built-in screen
+            fallbackDisplay = display;
             if (display.getDisplayId() != 0) {
                 return display;
             }
         }
-        return null;
+        //fallback to
+        return fallbackDisplay;
     }

     /**
Index: app/src/main/res/values/styles.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
--- a/app/src/main/res/values/styles.xml    (revision f36c19da8e43a5e40c631ce9cc4ddf6a3cc57e1d)
+++ b/app/src/main/res/values/styles.xml    (revision 1f27088d351ce07b120ee64176b6ab95a9306df3)
@@ -2,20 +2,16 @@

     <!-- Base application theme. -->
     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
-        <!-- Customize your theme here. -->
-        <item name="colorPrimary">@color/colorPrimary</item>
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
-        <item name="colorAccent">@color/colorAccent</item>
-   <item name="android:windowTranslucentStatus">true</item>
-        <item name="android:windowTranslucentNavigation">true</item>
-        <item name="android:fitsSystemWindows">true</item>
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowActionBar">false</item>
+        <item name="android:windowFullscreen">true</item>
+        <item name="android:windowContentOverlay">@null</item>
     </style>
     <style name="NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
-        <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
-   <item name="android:windowTranslucentStatus">true</item>
-        <item name="android:windowTranslucentNavigation">true</item>
-        <item name="android:fitsSystemWindows">true</item>
+        <item name="android:windowActionBar">false</item>
+        <item name="android:windowFullscreen">true</item>
+        <item name="android:windowContentOverlay">@null</item>
     </style>

     <!-- For use w/ external displays to be able to use entire display surface area -->
twaik commented 1 year ago

Fixed by 9de5f2f0deca3f057d429843d8e3e04d88bdfa98