SDL2, X11, No Desktop Environment: application without focus, no input events - x11

I have an SDL application that correctly works in fullscreen if launched from command line on a Raspberry Pi that doesn't have a Desktop Environment with this command:
/path_to_my_app/myapp -parameter1 -parameter2 value_for_parameter_2
If I launch the application with xinit, using .xinitrc with application path and its parameters inside, the application normally starts but I can't get keyboard and mouse events.
I can't get a way in order to have my application focused (I think this is the problem), have you any idea?
Content of .xinitrc:
/path_to_my_app/myapp -parameter1 -parameter2 value_for_parameter_2
that I launch from command line with this command:
xinit

Related

Starting screen sessions and running commands in it

I'm trying to write a bash script that should be capable of starting a java application in a separate screen. (detached terminal)
what I want to achieve:
Start a named Screen session
Run a java command in it
The session should not be attached
The java command I want to run is a jar application. This application will be running until it is manually stopped, that's why I want the screen to be detached.

Using VMRUN to execute selenium process in Ubuntu VM without XVFB

I'm using vmrun.exe from VMware Workstation to start an Ubuntu 16 desktop VM and launch a Java selenium Firefox process in it. I can start and launch the script however I would like the selenium process to be visible in case a user would like to monitor it. It gives the following error when trying to launch firefox with a visible GUI.
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/home/vmdops/firefox/firefox) on port 7055; process output follows:
Error: GDK_BACKEND does not match available displays
The following bash script is used to launch the process
java -jar seleniumProcess.jar
I can execute the process headless with XVFB and run the selenium process in memory however then I cannot view the process running visually.
/usr/bin/Xvfb :1 & export DISPLAY=:1
java -jar seleniumProcess.jar
What is the proper terminology to explain why the firefox browser cannot be displayed?
Is there anyway to launch the selenium process from VMRUN that allows the firefox browser to display normally?
Thanks
Conteh
I was able to resolve the issue adding -interactive to the end of the command
vmrun -T player -gu vmdops -gp xxxx runScriptInGuest "C:\VMDOPS2\VMDOPS2.vmx" /bin/bash "sh /home/vmdops/autovpn/runProfiler.sh" -interactive
This works when the use is already logged in interactively. When I launch too quickly after starting the vm I get the following error.
Error: The specified guest user must be logged in interactively to perform this operation
So one must wait a while after booting.

Windows Linux Subsystem: start Bash Application as a Service

As the title already summarizes:
How can I start a bash-script automatically, when the computer starts - ideally without the need to log in to windows - using the Microsoft Subsystem for Linux's Bash.
At the moment, this isn't supported, because the WSL session manager service will close after the last bash.exe wrapper instance closes. There are a few options, but the absolute simplest one at the moment is to use the run utility from the Xming developer and just add a shortcut to your startup folder (in the start menu) pointing to
run.exe bash.exe -c "/home/user/daemoninit.sh ; /bin/bash". Unfortunately, if your daemon initialization requires root access, for example, something like sshd, you will need to add an exception to sudoers that allows anybody to run the daemon with root privileges.
Also, there are problems getting it to run as a true Windows system service, since each lxss installation is user-specific. Some people have gotten it to run on system startup, but it launches in a separate Windows session for that user and makes it so you can't launch bash.exe in your current user session.

Opening programs on Raspberry Pi from terminal

When I first set up my Rasbperry Pi, I had it running with its own keyboard, mouse and monitor, and I could easily open applications using the terminal (e.g. python idle, etc.).
A few weeks ago I tried setting up X11 Forwarding to my windows machine using Xming and it worked great. But yesterday I tried opening Python IDLE and got the following message:
$ idle
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1545, in main
root = Tk(className="Idle")
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "localhost:0.0"
I tried going back to using the Pi directly (mouse, keyboard and monitor attached) and got the same message. Even more mysteriously, my friend's account on the same Pi works fine.
The only remedy I can find is that manually setting the DISPLAY variable solves this completely (when working locally):
$ export DISPLAY=:0
But I don't have time to make this change every time. Is there something I can change in the configuration files to do this? And how can I fix my X11 Forwarding? Any help is appreciated.
**Please note: IDLE is just an example, this is true for any programs with GUIs including the epiphany browser.
You could append that command to /etc/rc.local to have it run every time you boot the machine.

How do I run a windows task without flashing a command prompt box BUT still show a dialog box when I need to?

I creating a scheduled task in windows using windows command prompt:
schtasks /create /sc minute /mo 30 /tn "javadobe" /tr "\Program Files (x86)\BuildingIntelligence\javadobe\node.exe '\Program Files (x86)\BuildingIntelligence\javadobe\index.js'" /RL HIGHEST
Which is telling the command line to run "node index.js" every 30 minutes with the highest running privileges.
In my index.js file, I am checking a remote server for a version number I compare against a local version number. Now when they are the same, a node prompt window flashes briefly on the screen, which is obnoxious, and I would like to stop.
However, when the host server uploads a new version of the software, I show a dialog box asking the user if they want to install the update now or later. I want to keep this functionality.
How can I keep the dialog box popping up but not show the node.js command prompt flashing all the time?
Things I have tried:
I have tried running my script as a service instead of a scheduled task, which keeps the windows command prompt from appearing, but doesn't allow the dialog box to appear to the user (because services run in a different desktop session).
In normal windows command prompt, you can start a program minimized, using
START /MIN [application name]
and so I tried changing my /tr argument to "start node index.js /MIN" but that didn't work.
Thanks a bunch in advance for any help!
Whether or not Windows creates a console window for an application is controlled by the Windows Subsystem specified in the binary image (exe file) — something specified at compile time.
If this is CONSOLE (as node.js is), Windows creates the console window before the application begins executing. In other words, it is impossible to control at runtime whether or not a window appears. If WINDOWS, Windows does not create a console window, as it expects the application to create UI.
You will have to create a custom build of the node.js executable with subsystem WINDOWS.

Resources