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

Conversation

@twaik
Copy link
Member

@twaik twaik commented Sep 11, 2021

Solves #21
Pay attention. After compiling you should copy $repo/starter/build/intermediates/stripped_native_libs/debug/out/lib/$TARGET_ARCH/libstarter.so (or extract from apk (lib/$TARGET_ARCH/libstarter.so)) to $TERMUX_PREFIX/libexec/termux-x11/libstarter.so. Also you should put $repo/starter/build/outputs/apk/debug/starter-debug.apk to $TERMUX_PREFIX/libexec/termux-x11/starter.apk
I think we can use this build.sh as a reference.

P.S. Almost forgot $repo/termux-x11 script. It should be copied to $TERMUX_PREFIX/bin/

  • Remove/ignore build.gradle changing to prevent downgrading gradle plugin.
  • Remove hardcoding $XDG_RUNTIME_DIR in sources. Replace with checking if it is set in environment and export default value if it is not exported.
  • Start Xwayland if/when connection is established.
  • Send RUN_COMMAND intent if an app was started from launcher, not from commandline.
  • Implement a way to extract logs. Maybe we will pass fd of logfile next to socket's fd and write output of logcat (logcat started in an app can extract logs of the app and apps with the same android:sharedUserId).
  • Implement a way to read termux.properties file. Using fd sending or through Termux's ContentProvider
  • A way to avoid using JNI to extract non-basic arguments (not int/long/boolean types).
  • Implement mechanism of avoiding errors if there is an API version mismatch. Maybe we can just not perform an action if there is RemoteException error.

@twaik
Copy link
Member Author

twaik commented Sep 11, 2021

@xeffyr Hi. Can we make a new package for apt repos or we should test it longer?

Copy link
Contributor

@creepy-pasta101 creepy-pasta101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pay attention. After compiling you should copy $repo/starter/build/intermediates/stripped_native_libs/debug/out/lib/$TARGET_ARCH/libstarter.so (or extract from apk (lib/$TARGET_ARCH/libstarter.so)) to $TERMUX_PREFIX/libexec/termux-x11/libstarter.so. Also you should put $repo/starter/build/outputs/apk/debug/starter-debug.apk to $TERMUX_PREFIX/libexec/termux-x11/starter.apk

Abou that... I suggest using termux's own RUN_COMMAND intent

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

I suggest using termux's own RUN_COMMAND intent

It should be done just one time after package installation. Do you think I should install it using RUN_COMMAND, not pkg/apt?

@creepy-pasta101
Copy link
Contributor

It should be done just one time after package installation

Then I guess adding it to termux-packages/packages/termux-x11 would be better

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

termux-x11 script is needed to run starter.apk which creates socket and sends server file descriptor to termux-x11 app. It is impossible to use termux's private directories without android:sharedUserId.

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

Also I forgot to complete a code which starts Xwayland in the end. Maybe we will make something like starting XFCE/other DE session after Xwayland. That will allow us to send RUN_COMMAND to termux to avoid writing any commands. Less movements. And also it will start all the stuff after receiving SECONDARY_HOME intent.

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

@suhan-paradkar do you think an app should check API version used in starter.apk? That will help to avoid segfault when versions of termux-x11 and starter.apk do not match.

@creepy-pasta101
Copy link
Contributor

creepy-pasta101 commented Sep 12, 2021

I guess better would be to add a logger to the app and also bump the version of termux-x11 script whenever starter.apk is updated.. this means a pkg update by the user wil solve it all

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

That can be a bit problematic. I mean mechanism of extracting logs. Maybe I can add extra argument for extracting log of previous run. I think I will do that after cleaning up the code and separation debug/verbose and release logging mode.

@twaik
Copy link
Member Author

twaik commented Sep 12, 2021

There is a problem. When JNI code tries to use JNIEnv* env it segfaults. And JNI_OnLoad function gets JavaVM *vm = NULL. What is a problem? Maybe there is a solution?
@agnostic-apollo @xeffyr

@twaik twaik self-assigned this Sep 27, 2021
@twaik twaik added the enhancement New feature or request label Sep 27, 2021
Copy link
Contributor

@creepy-pasta101 creepy-pasta101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good

@twaik twaik requested a review from creepy-pasta101 October 1, 2021 14:20
Make Termux:X11 start user-defined commands in Termux ($PREFIX/libexec/termux-x11/termux-startx11)
Make debug_build.yml build companion package for termux and upload it as an artifact.
Update README.md
@twaik
Copy link
Member Author

twaik commented Oct 1, 2021

I think it is ready to be merged.
Last artifact contains both apk and deb file of companion package.
@suhan-paradkar @wmcb-tech
Can you please test it?
Maybe I should add something?

@RalfWerner
Copy link

I checked your Artifact on one of my devices but not studied your descriptions above (do it tomorrow), and made comparison:

  • Installation as the update of the last version is not possible (only after de-install)
  • Fullscreen mode is not included and the Extra Keys correspond to your base version (not ekeys).
  • As XServer I could not use this app by OTS but get short messages.

@twaik
Copy link
Member Author

twaik commented Oct 1, 2021

@RalfWerner

  1. This version is signed with different key. That is a reason update process fails.
  2. Fullscreen mode commit is located in ekeys branch which is still not merged. There is no reason to use it as a base branch.
  3. After tapping on application icon in launcher T:X11 triggers termux-app to run script $PREFIX/libexec/termux-x11/termux-startx11. Also this script may be used to start X11 session from Termux session.
    This script starts termux-x11 binary to create and export socket to termux-x11 app, starts Xwayland and x-session-manager.
    x-session-manager is symlink to xfce-session. You can override it to be a link to your script.
    You do not need to use 3rd party scripts starting termux-x11. The process of starting it has changed and it is incompatible with previous versions.

@ghost
Copy link

ghost commented Oct 2, 2021

I think it is ready to be merged.
Last artifact contains both apk and deb file of companion package.
@suhan-paradkar @wmcb-tech
Can you please test it?
Maybe I should add something?

Good morning folks! during the installation it fails for some reason. so i have to switch to Termux F-droid or something @twaik ?

Ok now it works after uninstalling and reinstalling the app. felt dumb

@ghost
Copy link

ghost commented Oct 2, 2021

the termux-x11 package dependency needs to be xwayland and not Xwayland since it's case sensitive apt will report a non-existent package. repacking the deb fixed it

@RalfWerner
Copy link

RalfWerner commented Oct 2, 2021

Ok now it works after uninstalling and reinstalling the app. felt dumb

@wmcb-tech My experiance! Where dit you find $PREFIX/libexec/termux-x11/termux-startx11 to start xwayland process?
With "felt dumb" I agree! What practical advantage should have this branch? Its more worse than basic X11

@twaik
Copy link
Member Author

twaik commented Oct 2, 2021

the termux-x11 package dependency needs to be xwayland and not Xwayland since it's case sensitive apt will report a non-existent package. repacking the deb fixed it

Fixed

Where dit you find $PREFIX/libexec/termux-x11/termux-startx11 to start xwayland process?

It is present in companion package. Now installation is fixed.

What practical advantage should have this branch? Its more worse than basic X11

It is better because it can be used with any version of termux, even signed with another key. There are not many people who rebuilds/resigns their application in order to guarantee compatibility.

@twaik
Copy link
Member Author

twaik commented Oct 2, 2021

@wmcb-tech Does it work well? Do you think it can be merged?

@ghost
Copy link

ghost commented Oct 3, 2021

@wmcb-tech Does it work well? Do you think it can be merged?

I just moved to F-droid version of Termux for testing and it seems it does work fine (although additional steps need to be done like permission granting and setting allow-external-apps = true needs to be set)

i think it's ready to merge as it's works flawlessly not having to use debug builds of Termux

@twaik
Copy link
Member Author

twaik commented Oct 3, 2021

additional steps need to be done like permission granting

It is impossible to override it. And it is needed only to start termux-startx11 command from external app.

allow-external-apps = true needs to be set

I prefer not to do that automatically because it can impact termux-app's security.

Ok. I am merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants