Qt application GUI -- automatic start -- linux - linux

I need to run my Qt GUI application immediately when my linux system starts.
I do not need any other things apart from this Qt GUI application. No need of desktop.
Previously I have started daemo using update-rc.d command but I do not know how to start GUI and I do not have much knowledge about X11.
I went through net & found two links:
Running a Qt application at startup
This is telling to create desktop entry file for you... but as i do not need desktop.
And only want my GUI to run. So this is not the solution which i am looking for.
http://www.qtcentre.org/threads/28564-Qt-app-in-linux-startup
Here I am not able to understand what I have to do with /xinitrc.d.
And how my application GUI can start. Can some one clarify this point?
Can some one suggest what I will have to do to start only GUI application?

You very probably need some X window manager to run your Qt application, perhaps even some desktop environment (i.e. you want EWMH & ICCCM compliance), and you obviously need a running X11 server (usually Xorg). So you could manage to have some xinitrc for all that.
Notice that some session -or display- managers like lightdm can be configured to start some special sessions.
In all cases, you need a lot more than just your application to be running, and you certainly need to understand in detail what your Qt application really requires (mostly thru Qt libraries). Learn more about the X11 protocol. See also freedesktop.org.

If you're using lightdm Desktop Manager, then edit your /etc/lightdm/lightdm.conf file by uncommenting line
session-setup-script=
and immediately after equal sign (without spaces) add path to your gui application!
Save lightdm.conf file, and restart the system!

Related

Can I deactivate a monitor/display with node/electron?

I, I'm writing an app with electron (http://electron.atom.io/). I would like to deactivate the monitor/display of the pc and only activate it again, when something in the app happens (for energy-saving). Is there a way to do this?
The only think I found, is the powerSaveBlocker (http://electron.atom.io/docs/api/power-save-blocker/) which doesn't help me...
You'll need to use native system APIs to do this, on Windows you can use one of the solutions proposed in Turn on/off monitor.
One of the ways you can do that is by executing batch files from electron/node in Windows , shell scripts in Linux and whatever MAC OS uses to execute commands.
These scripts would contain the OS level commands to turn on/off the display which are easily available .
When to fire these scripts would depend on your application logic .

Firefox/Chrome Shell for Ubuntu

I have googled my tail off - but can't seem to find what I am looking for. In Ubuntu (or any Linux distro for that matter) is there a way to set the GUI shell to only be Firefox or Chrome. Meaning - I don't need an entire desktop environment - just the one application.
I am pretty much trying to figure out a Linux equivalent to changing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon from explorer.exe to firefox.exe.
By default, distributions are setup the way that a display manager is fired up right after the X server. For Gnome, that would be GDM, for KDE that would be KDM etc. What you need to do is to replace a Window manager with a custom application, which in your case is a web browser. Generally, you can achieve this by putting your command(s) into ~/.xinitrc and ~/.xsession files, for example:
#!/usr/bin/env bash
firefox &
For Ubuntu, this process is explained in details here. Other distros are quite similar.
Hope it helps. Good Luck!

How to find my JavaFX application in process manager?

I have a JavaFX application that should check if it has already been launched when you launch it (need only single instance running at the time). The problem is how to define it!
I have tried packing my JavaFX application into .exe file (or make an .exe launcher) that will be shown as the "MyProg.exe" process in the Windows task manager, not the "javaw.exe". But it is not the solution (I've tried netbeans' tools) because it adds jre to my application thus enlarging it from 1 mb. to 130+ mb. (can you help me with it?)
I've tried launch4j, but both launcher and .exe package starts javaw.exe to run my app. And when I check process manager and see 2 javaw.exe I don't know, is it 2 instances of my app or just another app running?
I hope I described it clearand will be very thankful if somebody can help me with it!
Judging by your approach it seems that you are already found a way to get a list of Windows' processes from Java. In this case you can use one of the next solutions:
Take other process info into account. E.g. command line or window title. Windows command line can be retrieved using wmic.exe PROCESS command and for Unix-bases systems by ps -Af.
When your program starts store it's process id in the registry or file in homedir. When another instance starts it should check that value and if process with that id alive then just exit.

How to execute a setup from an application to update it?

I'am currently writing an application that has to search on a web site if an update exists for this application. If it is the case the application download a setup file (created with inosetup) and then execute it.
My application is written in C++. And I do not arrive to do this process. I'am trying to call the setup using system(). If the command is system("mysetup") I cannot obtain what I want because the setup cannot replace the exe (currently running). So, I have tried to use system("cmd /C mysetup"), system("cmd/C start /min mysetup"), system ("cmd /C start /min /separate mysetup") without success. In these cases, the fact to stop the application also stop the setup. So I suppose that the setup is considered as a child process.
I have seen in some posts that it might be possible to use execcl(). But this function is in unistd.h. And this library is a little bit to specific for my needs (I need to be able to run on virtualized windows).
So do you have a way to do what I want?
Thanks for your help
OK,
A colleague to me gave me the solution. As we are using QT a QProcess::startDetached does exactly what I want.

How to run Application.exe before windows startup?

I have a windows application with user Interface that do some stuff...
Now my client wants that, when he pushes the power button MyApplication run before he forced to input the username and password!
comment: the system is multi user on windows XP or Seven.
Is it possible anyway?
I found the way to do this was to create a scheduled task with a trigger for "on startup". This starts the application before windows logon. This is particularly useful in a server type environment if you need to have something run that is not a service.
It is simple. The process is.
Run gpedit.msc
Go to computer Configuration -> Windows Setting -> Scripts(Startup/shutdown)
Go to Startup properties then you will get the new windows.
Now add the program that you want to run before login.
The right way to do this is to implement a Windows service.
I've used this article here as I run a Minecraft server which I need to have the console interactive so I can manage the server and running it as a service is not a good solution in such a case: https://www.tenforums.com/tutorials/138685-turn-off-automatically-restart-apps-after-sign-windows-10-a.html
What I did was edit the registry:
Go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Create a new DWORD value (if this DWORD doesn't exist already) and
call it RestartApps with the value of 1
This now starts apps that usually startup before you log in and starts the programs in shell:startup
You can not run an exe without first loading the operating system. You can, however, run the exe without logging in first. Just add copy and paste the shortcut for the exe into C:\Documents and Settings\Administrator[or other user name]\Start Menu\Programs\Startup. Then check msconfig to make sure your exe is checked to run on startup.

Resources