-3

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.

3nws
  • 103
  • 6
  • 1
    I do not see how that is possible. GUI is DESKTOP – David Oct 10 '22 at 05:49
  • 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. – 3nws Oct 10 '22 at 05:51
  • What OS/product/release are you asking about? – guiverc Oct 10 '22 at 05:51
  • Ubuntu 18.04, python 3.6.9, Qt 5.15.2. – 3nws Oct 10 '22 at 05:52
  • Those versions don't match up? Are you using Ubuntu? – guiverc Oct 10 '22 at 05:58
  • @guiverc Yes. What do you mean by don't match up? – 3nws Oct 10 '22 at 05:59
  • Ubuntu 18.04 LTS didn't have Qt 5.15; that combination exists only in non-Ubuntu repositories. – guiverc Oct 10 '22 at 06:00
  • @guiverc I just installed the `PySide2` package with `pip`. It didn't come with it. – 3nws Oct 10 '22 at 06:01
  • Anyway, I don't know if that is my problem. The script runs just fine manually. – 3nws Oct 10 '22 at 06:01
  • 1
    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? – user535733 Oct 10 '22 at 06:27
  • 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 – 3nws Oct 10 '22 at 06:49

1 Answers1

0

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
3nws
  • 103
  • 6