systemctl service: Desktop application does not start maximized at boot

Xrockyman

New Member
Joined
Aug 4, 2022
Messages
1
Reaction score
0
Credits
21
Dear all,

I've created a service to start a .net core desktop application (Avalonia) and if the application is closed or if it crashed it starts automatically.
It all works almost as expected, if I start the service after the system is already boot, my application starts maximized. If I reboot my system, my application does not start maximized and I've to do it manually.

Here is my setup:
Hardware: Raspberry pi 4B
OS: Raspberry Pi Os
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian

my service:
-------------------------------
[Unit]
Description=Dotnet Desktop App
After=multi-user.graphical.target

[Service]
Type=simple
Environment="DISPLAY=:0"
WorkingDirectory=/home/pi/Release/net6.0/
ExecStart=/home/pi/dotnet/dotnet /home/pi/Release/net6.0/Myapp.dll
StandardOutput=inherit
StandardError=inherit
Restart=always
RemainAfterExit=no
User=pi

[Install]
WantedBy=graphical.target
-------------------------------

Note that "Myapp" was compiled in order to start automatically maximized (WindowState="Maximized" -> property in mainwindow xaml) but when launched by the service at system boot, that does not work.

Thank you in advance for your help!

Regards
 


osprey

Member
Joined
Apr 15, 2022
Messages
77
Reaction score
43
Credits
672
Usually in the ExecStart config, to run the command the convention often seen is:
Code:
ExecStart= /bin/sh -c '<the command>'
Maybe worth a shot.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top