I have a Rust application that runs from a console. When run I want the application to run a thread that opens a 'new console' window and prints text to that window.
Is there a crate or configuration anyone can suggest for launching a second (and maybe third and fourth) Terminal screen?
That's very platform specific. You could start a new process, use x on Linux in process, use Wayland on Linux in process, use Win32 API on Windows, (list goes on)
You also might consider any ui frameworks etc for rust (of which there are few)
Creating a new process of terminal emulator on the system and writing to it's std in while launching cat in it is probably your best bet https://doc.rust-lang.org/std/process/struct.Command.html
I hope this helps
Related
This one is a pretty strange question of mine so I'll try to explain the best I can.
On a DOS Linux distribution, without having installed any graphical environment, if I start an application which is supposed to have a GUI, will I be able to interact with that window via code?
What I thought is that if KDE/GNOME's role is to graphically represent an existing GUI, I should be able to interact with it but if these graphical environments have an active role in the window creation there is nothing I can do.
You won't be able to run a graphical program without a window manager.
The reason is that the window manager is doing a lot more than just allowing the window to be shown to the user. It comes with libraries and services for constructing windows and components and interacting with them. Without these libraries and services, the program won't be able to start.
The only exception would be if a program contained all the graphical code built into it, and didn't rely on a window manager. Realistically this would only happen for a fairly simple program and in special cases; for instance, Raspbian includes OMXPlayer, which shows full screen video without relying on any window manager.
Quoting (with some adaptation) from https://raspberrypi.stackexchange.com/a/3974 which answers how to start mplayer in X11 without a window manager:
The X server is really usually called X and you can just start it. You can set the DISPLAY number as an argument along with some other things.
You might want to have some sort of session, though, and still go through xinit or such and start X with startx. You can use .xinitrc or such as a script and simply not start a window manager there. You will need a "magic client" as the last command that stays running so X doesn't terminate immediately. In a traditional "failsafe" session, that was an xterm. If you know what to launch and launch once only, it could be that program or any UI/wrapper that does the launching for you. When the last ("magic") client in the init script terminates, X terminates.
If all you want to do is play video, you might see if you can run mplayer with directfb instead and skip using X11 entirely.
I want to make a system which would get input from USB barcode scanner, validate it on remote server and display an answer (text and images).
I would use JavaFX or in-browser JS web application to grab scanner input somehow.
I'm planning to run this application on Raspberry Pi or plain PC.
Is there a way (or a special linux distribution) to ensure that system always loads the same way and starts JavaFX app or opens particular web page in browser?
e.g. no login page, NO update or other popups are shown.
Any other ideas? Thanks
...
Found an interesting solution here, where JavaFX GUI app is started from command line, without X-Server(linux graphical interface) at all.
I have recently done something similar, and it's not too hard. Obviously working on the Pi, you will want to use something like Linux and having limited hardware will mean that you should be minimising what you are running. Due to this, I would recomend that you run a light weight distro. Something like arch (which is what I used) allows you to build only what you want from the ground up without the need to find and compile everything like you do for LFS or Gentoo.
As for booting, the following two wikis will give you the details of starting the Gui without manual login:
https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console
https://wiki.archlinux.org/index.php/Start_X_at_Login
After that, it is simply a matter of putting the command to launch your program in .xinitrc.
I'm programming something and I need debugging support on most operating systems (linux, windows, macosx).
This is what the program is supposed to do:
- fork a new program (platform specific program - like adobe reader on windows, but evince on linux)
- monitor for exceptions (handled and unhandled)
- execute a predefined function based on the exception
So basically I need some kind of a debugger, a library which I can use to make this possible. I would then start a debugger, start a program, and monitor for the exceptions.
It would also be great if I could execute & monitor for the exceptions over the network. So let's say my program is running on computer A and is connected to computer B (via ssh, RDP, whatever) and I would start a new program in computer B from computer A, and also monitor and react based on the exceptions from the computer B.
So my question is: is anything like that already written in form of a perl/python/whatever library or something similar. If it is, I would very much like to know about it.
Just to make this more clear: the linux only library call for this (just not supporing the network part) is ptrace system call.
gdb
There is a built in python debugger.pdb
I've got a C/C++ app using the GLFW Library on a netbook-like device running Ubuntu 8.10.
As far as I understand the source the GLFW lib, it creates its window using calls to the X-Window library.
We do not use any desktop on the machine but login to a tty and start a X-server in the background. When running the compiled application from a tty* on the target platform during the call to
glfwOpenWindow( ... );
glXQueryExtension( ...);
_glfwChooseVisual( ... );
XGetVisualInfo( ... );
the application halts. It does NOT crash. When switching to the X-Window by hitting Ctrl+Alt+F7 the application continues normally.
What could cause this weird behaviour?
BEGIN_EDIT:
Now I am quite sure the problem is related to the configuration of either Ubuntu or the x-server. When I try to run
glxinfo
in the shell the command also hangs until I switch to the X-window by hitting CTRL+ALT+F7. When I return to my shell after hitting the keys the command has finished.
Could it be that the X-server is put to 'sleep' when in console mode?
END_EDIT;
If the X window server runs in the background, it (obviously) doesn't own the display. Thus it can't reply to requests until its back in the foreground.
That would be my expectation at least. You can't ask a display server to open a window, if that display server is not actually owning the display hardware at the time of the request.
Blocking until it gets control of the hardware back sounds totally sensible to me.
Is a login manager running on the X server? They typically will grab the X server for exclusive use. Try logging in and see if that makes a difference.
I have got a gtk application. I want it to start automatically when I boot up the system, such that instead of getting usual login screen, my application greets the user.
My application is a sort of cash dispensing application. So user should not even see the login screen of linux. Whenever machine in boot up, after loading services and all that, my application should appear on the screen. One should not have to put any password or login in anyway to start that application.
Now so far I have tried the following but all in vain.
I put the command in my /etc/rc.local file
/home/EXE/cashier
Then rebooted machine in run level 5. But nothing happens. I get the usual login screen. Other programs that do not involve any gui or gtk, they are automatically started in this manner but not the gtk application.
Then I put
xint /home/EXE/cahier
and later
xint /home/EXE/./cashier
But they too didn't work. When I looked into details, I found out that "An Xserver is already running on screen 0, cannot open other server" or something like that.
Then I tried booting into run level 3, this time it worked.
xint /home/EXE/.cachier
But in run level 3, the font and icon sizes are smaller. Moreover some windows do not cover the whole screen.
Now I will really appreciate a way to run my application in run level 5, without showing login screen automatically.
Regards
Edit
Currently, the application is running on fedora core 2
This is more a question about linux distribution startup than it is about Gtk applications. The specifics are going to depend on your distribution, but the essence is:
Disable the gdm facility, which is normally responsible for spawning your X server.
Run xinit (not "xint") to start the server manually. This takes a client as its argument. It may work to run your Gtk application directly (it needs to be smart enough to position and size itself instead of relying on a window manager), but more likely you will want to pick a window manager to run it in. The easiest way to do this is via script that you pass to xinit.