termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.98k stars 2.98k forks source link

[ENHANCEMENT]: Recommended way to install and run X11 GUI. #19197

Open twaik opened 7 months ago

twaik commented 7 months ago

Hello. People who want to run X11 GUI in termux come to discord termux/general and matrix termux/termux very often. They are not Linux enthusiasts, but even if they are, they still have problems running GUI. The reason for this is pretty much simple: termux's way of running GUI is not very straightforward. People do not really want to play with multiple X servers and DEs. They want to simply run startx or something simmilar and enjoy graphical environment. Or someone is not experienced enough and follows guides in Internet (which are malicious in some cases, unfortunately). So, IMHO, we should do the following things (maybe all of them, maybe not).

Also something recommended but not related to GUI directly.

I did not post it in Discussions intentionally. That really seems like our flaw.

One or all points mentioned here should make termux more newbie-friendly, but I am not someone who makes decisions here (at least not make decisions alone).

I am pinging the whole team and locking conversation only for collaborators. I really want to hear opinions of everybody to avoid misunderstanding. @termux/app-maintainers @termux/package-maintainers

finagolfin commented 7 months ago

Sounds good, it is just up to someone who wants to do the work. I have never tried using the X support, so not going to be me.

sylirre commented 7 months ago

Do you really think that Linux kindergarten human behavior is fixable programmatically? It can't be fixed this way.

Lack of the official Termux content creators is the main issue here. People have to look somewhere else to take instructions for getting desired setup and of course third parties may not follow our recommendations.

This is what has to be fixed first instead of modifying apt or whatever else. Does anyone know that Termux has (had?) an official YouTube channel? It is here: https://www.youtube.com/channel/UCGCVyLywi5KfW6n-54tiiJQ. Now compare it with non-official Termux channels.

The question is only who will work on content. Community is not that active at posting guides on our social media pages, particularly on Reddit.

Termux desktop script

I agree that we can make a script for automating setup of desktop environments. Perhaps it is possible to use proot-distro project as base and optimize it specifically for setting up desktops.

Resulting script usage can look like this:

# install xfce and deps and configure as VNC server
termux-desktop configure --mode-vnc xfce

# reconfigure to termux-x11
termux-desktop configure --mode-termux-x11 xfce

# start or stop
termux-desktop start
termux-desktop stop

For each DE there can be a small script in $PREFIX/etc/termux-desktop with custom steps, just like proot-distro does for distributions.


Dealing with partial upgrades

Yes, it is possible to resolve this issue by patching apt:

Result of these changes would be that user have no choice to not upgrade environment. The package manager will do such action on its own.

These changes are breaking and we'll get a lot of complaints because of unexpected actions of package manager. Many people intentionally not upgrade their Termux environment, even though this is not supported. They had choice when using apt previously, now they don't have such choice.

IMO, this would be a total mess but working...

twaik commented 7 months ago

Do you really think that ~Linux kindergarten~ human behavior is fixable programmatically? It can't be fixed this way.

I agree, we can not fix human behaviour. But we can fix/avoid reasons they complain about (at least some of them).

I agree that we can make a script for automating setup of desktop environments.

We can simply use update-alternatives mechanism and make some dialog GUI for this. No need to implement something new. Most DEs can set x-session-manager alternative which can be used by our startx. X server can be configured via update-alternatives too. Our script (in perfect case) should only invoke apt update && apt install, update-alternatives and dialog.

sylirre commented 7 months ago

But we can fix/avoid reasons they complain about (at least some of them).

You never know what and how configured in users environment. User may even not know that something is wrong with it.

Any helper can fix only specific issue that happens in specific conditions. Thus user may set up a custom library versions and you'll have to spend a while to understand what is going on so the user has an unreproducible problem.

My main point is that you can't stop people from posting stupid issues which normally can't happen.

Here I see two possible solutions:

We can simply use update-alternatives mechanism and make some dialog GUI for this. No need to implement something new. Most DEs can set x-session-manager alternative which can be used by our startx.

If required action is such simple, then indeed perhaps better to go with update-alternatives method.

sylirre commented 7 months ago

Instead of patching apt, we can just hide it (remove from PATH). Users will have to use pkg then.

I think this is much better than messing up package manager.

twaik commented 7 months ago
  • I don't know how this can look like, maybe packaged as custom bootstrap archives.

No need for custom bootstraps. We may simply install everything with our magic script. About how it should look like: when you install Ubuntu or Debian most needed tools (WM, DE, file manager, text editor) are already set up and ready to be launched. I think we should have simmilar setup. Maybe we should not install everything, we may do something like flavors (like xfce-desktop, xfce-minimal, mate-desktop, mate-minimal).

Instead of patching apt, we can just hide it (remove from PATH). Users will have to use pkg then.

I agree. We can move it somewhere to $PREFIX/libexec.

sylirre commented 7 months ago

Custom bootstraps or their equivalent is the way to deliver environment that is sane and guaranteed to work.

With script you just pulling current package versions, which may be not tested for compatibility or user for some reason left custom libdependencyname.so in $PREFIX/lib and it broke everything.

And I'm talking not only about desktops here.

twaik commented 7 months ago

Custom bootstrap means the whole environment will be reset, does not it?

TomJo2000 commented 7 months ago

I think something along the lines of a display manager utility could work quite well for this.

I don't wanna start any bike-shedding, but let's say we provide something like a termux/termux-sessions repo which contains setup/startx scripts for various Desktops and Window Managers (as well as having the component packages as dependencies for each). Say a termux-xfce-session, termux-sway-session, termux-lxqt-session, etc.

I guess a closer equivalent would be the "session files" used by Display Managers usually stored in /usr/share/{wayland,x}-sessions on regular distros.

This way users can install a desktop (or WM) of their choice and use a standardized utility to properly start any of their installed desktops. Maintenance burden should be manageable past the initial effort of writing and testing sessions. Though I recognize this shifts the burden setup verification mostly onto the session setup scripts. Overall from a user perspective it should make the whole experience very modular, transparent and extensible; over something like a "Spins" or "Flavors" approach which is more so the impression I am getting from the custom bootstraps concept. Though the two are of course not mutually exclusive.

sylirre commented 7 months ago

Custom bootstrap means the whole environment will be reset, does not it?

Yeah, the whole idea is to bring a preconfigured system as starting point for further user actions.

TomJo2000 commented 7 months ago

I'd like to address the general packaging points one by one.


We should merge x11-repo to main repo. Also there are enough packages requiring (both QT and regular) which are CLI only but depend on packages in x11-repo and can be used without X server (I do not remember names, but still relevant).

I disagree about scrapping the x11-repo entirely, it's a useful distinction. Perhaps instead including the x11-repo stub package as part of the default apt repos shipped in the bootstrap, so users don't need to separately install it, makes more sense.

  • We should make apt ask about apt update in the case of interactive console (to avoid prompting in scripts) and only in the case if last update was more than 6 hours ago (because auto-updater launching has this period) and chain it to the start of package installing process. I suggest to patch the apt and not pkg intentionally. This will make people update environment more often. That is related to both rolling release model and to partial upgrade problem. I am not sure how exactly it is done in other rolling release distros.

I agree that we should make it clearer that partial updates are unsupported on Termux and perhaps a warning or patch to do a full-upgrade instead should be included, though I'm unsure how exactly this should be handled. As for "reminding users" that updates are available, I'm not sure how I feel about that. Perhaps we could bring back the dynamic MOTD concept from a while ago to remind users about updates, but we should never force or "nag" users to update. Though a full upgrade when installing new packages should obviously remain the recommendation, and a notice if attempting to install new packages with pending updates seems appropriate.

  • We should make automatic correcting releases for both github and f-droid to make it used up-to-date bootstrap and, again, avoid partial upgrade problem. Or maybe remove bootstrap from apk and force downloading it from Internet or sdcard (in the case if Internet is not available).

I am entirely unsure how you propose to manage, and for that matter distribute this. Perhaps I just need some more clarification. I'm not opposed to the idea in principle.

  • We should add some newbie-friendly guides to our site for most popular cases, i.e. updating environment, installing packages, installing GUI, explaining basics, etc. I know we are not Linux kindergarten, but many people have ZERO knowledge about Linux and want to get started. It is not neccessary, but people like that can make A LOT of noise in discord.

As far as I know a wiki revamp is already underway at termux/termux-community#1, and I fully agree that a update to our official resources is sorely needed. Though that is obviously a time and labor intensive process.

twaik commented 7 months ago

I am entirely unsure how you propose to manage, and for that matter distribute this. Perhaps I just need some more clarification. I'm not opposed to the idea in principle.

The main idea is to make apk users get from Github or F-Droid always be updated.

I disagree about scrapping the x11-repo entirely, it's a useful distinction. Perhaps instead including the x11-repo stub package as part of the default apt repos shipped in the bootstrap, so users don't need to separately install it, makes more sense.

I agree.

TomJo2000 commented 7 months ago

The main idea is to make apk users get from Github or F-Droid always be updated.

That would work for F-Droid - Provided they are pulling the releases. But for GitHub it would require essentially switching to weekly(?) releases for the main App, no? I'm actually not 100% clear on how the bootstrapping process works in detail. Now that I think about it, shouldn't it just pull down the latest bootstrap when first running the app?


In any case I don't think we should force pre-existing users to install the latest bootstrap. Maybe a notification when a new bootstrap is released to remind them that updates are available?

twaik commented 7 months ago

Now that I think about it, shouldn't it just pull down the latest bootstrap when first running the app?

AFAIK termux-app unpacks bootstrap contained in apk. It is inlined to shared library.

Bootstrap is only applied when termux runs first time or it's data is reset.

In any case I don't think we should force pre-existing users to install the latest bootstrap. Maybe a notification when a new bootstrap is released to remind them that updates are available?

Irrelevant to existing users.

Newer bootstrap means downloading less updates while doing pkg update first time in fresh environment.

agnostic-apollo commented 7 months ago

My thoughts on this.

agnostic-apollo commented 7 months ago

Btw, I plan on writing a guide for setting up a DE, termux-x11 and firefox for mozilla people this week, finishing up some other work currently.

agnostic-apollo commented 7 months ago

Newer bootstrap means downloading less updates while doing pkg update first time in fresh environment.

The bootstrap is like 25MB only for each architecture, downloading archives of outdated packages wouldn't take that long. And if we download latest bootstrap, same thing basically. One time setup time is irrelevant anyways.