LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-08-2016, 10:45 AM   #1
mshlinux
Member
 
Registered: Mar 2013
Location: Yangon, Myanmar.
Distribution: Fedora, Arch
Posts: 177

Rep: Reputation: Disabled
start GUI application from systemd unit .service?


I use systemd unit .service file to start GUI application.
I have startxterm.service file in ~/.config/systemd/user directory:
Code:
[Unit]
Description=Start Xterm

[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/msh/.Xauthority"
ExecStart=/usr/bin/xterm &

[Install]
WantedBy=graphical.target
then execute:
Quote:
$ systemctl --user start startxterm.service
But it doesn't start any GUI application.

Last edited by mshlinux; 10-08-2016 at 11:02 AM.
 
Old 10-09-2016, 08:41 AM   #2
mshlinux
Member
 
Registered: Mar 2013
Location: Yangon, Myanmar.
Distribution: Fedora, Arch
Posts: 177

Original Poster
Rep: Reputation: Disabled
just need to remove "&".
 
Old 10-09-2016, 03:32 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Most people would just the "autostart" feature of the desktops.

simpler and more portable.
 
Old 10-10-2016, 01:10 AM   #4
mshlinux
Member
 
Registered: Mar 2013
Location: Yangon, Myanmar.
Distribution: Fedora, Arch
Posts: 177

Original Poster
Rep: Reputation: Disabled
Sorry for my question.
It was just example for what I want.
Actually I was trying to use SystemD/User .timer and SystemD/User .service to execute battery monitoring script I wrote.
In that script, I have the line:
Code:
echo "Battery Power low" | dzen -p 3 &
to start GUI application, dzen2.

After setting environment variables and removing "&" at the end of the line, it works perfect.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Systemd service: AUTOSSH.service does not start at boot, how can I fix this? The_Linux_Machine Linux - Newbie 1 07-06-2016 12:00 PM
[SOLVED] systemd unit does not load at startup. manual start shows no such file/dir failure zjmarlow Linux - Newbie 9 07-19-2015 06:19 AM
[SOLVED] new Sabayon 13.04 install: Can't get GPM to start as a service... {systemd} jtwdyp Sabayon 2 06-16-2013 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration