Score:-3

How do I start my GUI script at startup without the desktop environment?

US flag

Currently, I have setup terminal as a startup application.

I'm calling sudo xinit /home/enws/mystarter -- :1 -nocursor in the /home/enws/.bashrc file to start my gui application. But this keeps the X server at 0th display alive and it uses memory. If I try to start the script on the 0th display I get an Xserver is already running error.

I have tried to put the script in .xinit, .xinitrc, .Xsession, /etc/X11/Xsession. None of them seems to work.

How can I start the python Qt GUI script at startup without a desktop environment?

Also, I need the pulseaudio to work without issues so I need a user session. Root user seems to be problematic.

David avatar
cn flag
I do not see how that is possible. GUI is DESKTOP
3nws avatar
md
Can I not replace the one at display 0? I want the application to be on all the time they should not be able to close it by clicking X. They should not even see it.
guiverc avatar
cn flag
What OS/product/release are you asking about?
3nws avatar
md
Ubuntu 18.04, python 3.6.9, Qt 5.15.2.
guiverc avatar
cn flag
Those versions don't match up? Are you using Ubuntu?
3nws avatar
md
@guiverc Yes. What do you mean by don't match up?
guiverc avatar
cn flag
Ubuntu 18.04 LTS didn't have Qt 5.15; that combination exists only in non-Ubuntu repositories.
3nws avatar
md
@guiverc I just installed the `PySide2` package with `pip`. It didn't come with it.
3nws avatar
md
Anyway, I don't know if that is my problem. The script runs just fine manually.
user535733 avatar
cn flag
This smells like a possible [XY Problem](https://en.wikipedia.org/wiki/XY_problem). It is unclear why a script that seems to need no Desktop resources ("*they should not even see it*") needs Desktop resources ("*Qt GUI script*"). The design is puzzling -- what is the issue for which this script is the best solution?
3nws avatar
md
The script runs fine if I start it on display 1, I am just asking how I can make it run on display 0. On display 1 there is no desktop meaning no dock no window controls no anything, just the gui script. And it runs as root user, whic I don't necessarily want because pulseaudio doesn't work well as root user. But I can go back to the regular desktop env. with `shift+alt+f1`. Which I don't want happening. @user535733
Score:0
US flag

On a fresh Ubuntu install, after adding the current user to no password group.

~/.xinitrc

/home/<user>/gui/launch.sh

~/.bashrc

...
sudo startx

launch.sh

#!/bin/sh

pulseaudio --system --realtime --disallow-exit --disallow-module-loading --daemonize=no &

exec /home/<user>/gui/main.py --no-sandbox

for enabling audio:

sudo usermod -a -G audio <user>

autostart terminal in ~/.config/autostart/gnome-terminal.desktop

[Desktop Entry]
Name=Terminal
Comment=Use the command line
Keywords=shell;prompt;command;commandline;cmd;
TryExec=gnome-terminal
Exec=gnome-terminal
Icon=utilities-terminal
Type=Application
X-GNOME-DocPath=gnome-terminal/index.html
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-terminal
X-GNOME-Bugzilla-Component=BugBuddyBugs
X-GNOME-Bugzilla-Version=3.28.2
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
X-GNOME-SingleWindow=false
OnlyShowIn=GNOME;Unity;
Actions=new-window
X-Ubuntu-Gettext-Domain=gnome-terminal

X-AppStream-Ignore=true

[Desktop Action new-window]
Name=New Terminal
Exec=gnome-terminal
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.