Author Topic: Xpra (minimal), or alike, but 100% written in C  (Read 2200 times)

0 Members and 1 Guest are viewing this topic.

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4217
  • Country: gb
Xpra (minimal), or alike, but 100% written in C
« on: January 20, 2024, 06:13:02 pm »
So, this is xpra

Quote
Xpra is known as "screen for X" : its seamless mode allows you to run X11 programs, usually on a remote host, direct their display to your local machine, and then to disconnect from these programs and reconnect from the same or another machine(s), without losing any state. Effectively giving you remote access to individual graphical applications. It can also be used to access existing desktop sessions and start remote desktop sessions.

this stuff is great but it has*a lot* of dependencies, including python!

Do you know if there is a stripped-down version? or anything like that but 100% written only in C and without any run-time dependency?
I don't want to support Rust, llvm, and python in order to compile and run my "screen for X11".
If there is nothing around, I will develop myself minimal version: I don't want/need to support anything but { keyboard, mouse, screen }

(in case, feel free to PM me if interested)
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3859
  • Country: de
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #1 on: January 20, 2024, 09:16:45 pm »
If you only want to access your Linux machine's screen remotely then what is wrong with something like x11vnc or xrdp? And connect to it using normal remote desktop clients.

That has the advantage that it will also work with modern applications like browsers (or stuff like Electron) which don't work over X11 remote connections anymore due to the ancient OpenGL version supported by the X11 extensions required to make OpenGL work across network.

Or install an X server on Windows, enable XDMCP on your Linux machine and log in remotely. It is not secure, though - which is why it is disabled by default on most modern Linux systems.
 
Expecting that you will find something with no dependencies but that implements stuff like literally an entire X protocol, has built-in web client, can interact with the various desktop session protocols, forwards stuff like audio, webcams, etc. - good luck. Get real, that ain't gonna happen. Nobody is going to re-implement things like that from scratch (and introduce myriads of bugs in the process) instead of using existing and tested libraries.

Quote
If there is nothing around, I will develop myself minimal version: I don't want/need to support anything but { keyboard, mouse, screen }

Feel free to. However, I think you will quickly discover that the problem even for your minimal case is tad more complicated than you think if you want to actually have an usable desktop. But feel free to reinvent VNC or RDP, along with the image compression and encryption/authentication, it is your time ;)
« Last Edit: January 20, 2024, 09:25:21 pm by janoc »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15172
  • Country: fr
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #2 on: January 20, 2024, 09:19:25 pm »
Never used it, but looking at the project, Python is not just a "dependency", it looks like most of the code for xpra is Python code. "Porting" it to pure C makes no sense IMO, better write your own indeed. It would be like rewriting it almost entirely.
 

Offline audiotubes

  • Regular Contributor
  • *
  • Posts: 176
  • Country: cz
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #3 on: January 20, 2024, 09:29:09 pm »
Not sure what you are trying to do, but WSL has been able to support X apps for a while now. You don't even have to mess with Windows firewall, it works out of the box.

I use Fedora WSL and I can run X apps locally, X-forward apps via SSH on Linux and FreeBSD boxes, etc.
I have taken apart more gear than many people. But I have put less gear back together than most people. So there is still room for improvement.
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4217
  • Country: gb
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #4 on: January 21, 2024, 10:24:28 am »
Never used it, but looking at the project, Python is not just a "dependency", it looks like most of the code for xpra is Python code. "Porting" it to pure C makes no sense IMO, better write your own indeed. It would be like rewriting it almost entirely.

"dependency" in Gentoo terms; I see x11-wm/xpra requires { python, ... }, whether it does it during the build-up (build-dependency) or because it needs it at run-time (run-time-dependency), it's a dependency from the "ebuild" (therefore for Catalyst) point of view.

I'm finishing another project at the moment and I haven't yet had time to understand how many parts of Xpra are written in Python, in any case: the protocol they studied makes lot of sense as it's better than the tradicitional X11 protocol, so it makes sense for me to rewrite the parts in Python in C, eliminating all the superfluous functions.

Code: [Select]
# cat /etc/portage/package.use/x11-wm---xpra
x11-wm/xpra client clipboard -crypt lz4 server trayicon -brotli -csc -cups -dbus -debug -doc -ffmpeg -html -ibus -jpeg -lzo minimal -oauth -opengl -pinentry -pulseaudio -sound -systemd -test -udev -vpx -webcam -webp -xdg xinerama
(see how many to-be-built features it has ...)

In the end my Xpra-minimum (just "screen/tmux for X11") must run on
  • GNU/Linux MIPS32@200Mhz machine
  • MUSL-embedded profile
  • ram-rootfs
  • 128Mbytes of ram

The persistent session level is one of the reasons I chose it, as it's exactly what I need for the project.

I don't even think about supporting Python on the target, I just DON'T even want to see it mentioned in my final stage to be loaded on the target as it's currently the "antichrist" for all the things that it breaks along the path.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4217
  • Country: gb
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #5 on: January 21, 2024, 11:01:11 am »
If you only want to access your Linux machine's screen remotely then what is wrong with something like x11vnc or xrdp?

I'm developing x11 terminals { mechanics, hardware, firmware, kernel-support, userspace-support, apps } that must work exactly as "screen/tmus" works, i.e. offer the possibility of being able to allow you to run X11 programs on a remote host, direct their display to your local machine (my X11 terminal), and then to disconnect from these programs and reconnect from the same or another machine(s), without losing any state.

That's "screen for X11", a persistent connection.

That has the advantage that it will also work with modern applications like browsers (or stuff like Electron) which don't work over X11 remote connections anymore due to the ancient OpenGL version supported by the X11 extensions required to make OpenGL work across network.

I don't know if I will support OpenGL, anyway, Web-browers are always problematic for X11.

They require too much bandwidth, they move too many tcp/ip connections: luckily I don't have to support any browser(1), or video player, only X11 applications like { Geany, nedit, ... or even things that rely on openMotif } therefore very light.

(1) must be "distraction free": no browsers/Youtube, no socials, ...

Expecting that you will find something with no dependencies but that implements stuff like literally an entire X protocol, has built-in web client, can interact with the various desktop session protocols, forwards stuff like audio, webcams, etc. - good luck. Get real, that ain't gonna happen. Nobody is going to re-implement things like that from scratch (and introduce myriads of bugs in the process) instead of using existing and tested libraries.

This is precisely the point: to clean up and eliminate everything that is superfluous, physically clone the repo, remove the not wanted code(2), purge Python parts, distill the project, and package it in a "minimal" and "essential" form

(2) remove[]={ built-in web client, interact with the various desktop session protocols, forwards stuff like audio, webcams, etc, ... }. Don't  need/want these.

Quote
feel free to reinvent VNC or RDP, along with the image compression and encryption/authentication, it is your time ;)

Actually, umm, I did a similar thing by "hacking" a couple of strange objects built in China that bought on eBay. They capture the XVGA video stream (1024x768, we are on 70Mhz pixel clock, so it is less than 20fps), compress it in H26*, and send it in TCP/IP packets on ethernet 1000Mbit/sec.

At the other end I built an ad-hoc application in C (fbcon/directfb) that intercepts the packets and reconstructs the transmitted information on /dev/fb0.
It is a very crude system, it works directly in contact with the kernel services, I recently also added audio (remote-out, local-in) and remote keyboard/mouse (local-in, remote-out to kernel /dev/input).

The problem is: it somehow works, though.... with three of those things connected to the router I'm literally "pissing off" the OpenSpace guys  :o :o :o
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3859
  • Country: de
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #6 on: January 21, 2024, 08:59:05 pm »
This is precisely the point: to clean up and eliminate everything that is superfluous, physically clone the repo, remove the not wanted code(2), purge Python parts, distill the project, and package it in a "minimal" and "essential" form

You have obviously no clue. Xpra is literally written in Python, with some C extensions written using Cython. So if you "purge Python parts" you will be left with nothing to "distill" into the "minimal and essential form"  :-//

Actually, umm, I did a similar thing by "hacking" a couple of strange objects built in China that bought on eBay. They capture the XVGA video stream (1024x768, we are on 70Mhz pixel clock, so it is less than 20fps), compress it in H26*, and send it in TCP/IP packets on ethernet 1000Mbit/sec.

But that's not even close to what xpra purports (I don't use it myself) to do. There is a huge difference between doing a "dumb" screen capture, compressing it and streaming it over the network and actually redirecting peripherals, supporting notifications, sound and what not that is required to have a full featured remote desktop session these days.

If the dumb capture + keyboard/mouse input is all you need, then just use either VNC or buy/build and deploy something like PiKVM (https://pikvm.org/) and don't mess with (and complain about dependencies of) tools that are not intended for your use case. It is a long solved problem.
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 4217
  • Country: gb
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #7 on: January 21, 2024, 09:39:35 pm »
There is a huge difference between doing a "dumb" screen capture, compressing it and streaming it over the network and actually redirecting peripherals, supporting notifications, sound and what not that is required to have a full featured remote desktop session these days.

these days, then you have to remove them in order to promote "distraction-free" solutions   :D
(e.g. remarkable2+folio marketing vs a laptop)

If the dumb capture + keyboard/mouse input is all you need, then just use either VNC or buy/build and deploy something like PiKVM (https://pikvm.org/) and don't mess with (and complain about dependencies of) tools that are not intended for your use case. It is a long solved problem.

The difference, from my point of view, is the persistent connection made "with-in X11", rather than passing through an hw+sw hack as KVM.

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online abeyer

  • Frequent Contributor
  • **
  • Posts: 349
  • Country: us
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #8 on: January 22, 2024, 01:43:21 am »
Do you know if there is a stripped-down version? or anything like that but 100% written only in C and without any run-time dependency?

I don't know of anything. There's been a longstanding request to implement X11 forwarding in mosh, which might work for this use case, but afaik it's never been implemented. I'd love to see it built there, though that wouldn't be 100% dependency free.

If there is nothing around, I will develop myself minimal version: I don't want/need to support anything but { keyboard, mouse, screen }

I suspect you won't be able to get along without Xft as well, since most modern software is going to be reliant on freetype and client-side font rendering.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3868
  • Country: us
Re: Xpra (minimal), or alike, but 100% written in C
« Reply #9 on: January 22, 2024, 04:25:10 pm »
NX is a non python terminal multiplexer for x11.  It's not "dependency free" but might be closer to what you want than xpra.
 
The following users thanked this post: DiTBho


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf