You are not logged in.

#1 2017-05-21 15:58:58

Mr.Doko
Member
Registered: 2017-05-14
Posts: 9

[Solved]Doubts with systemd set-environment

Hello guys,

I have a doubt with systemd/systemctl that I didn't get much information reading the man page of it. On the Dunst repository at git, they are doing the approach of not setting the DISPLAY environment variable explicitly on the service file, to make it more flexible in case someone is using Wayland instead of Xorg. The solution is to use:

systemctl --user set-environment DISPLAY="the value"

I did, and later enabled and started the service as user. All good.

But when I logout and login back, the service has failed to start because it doesn't know which display it will show. And when I put the command:

systemctl --user show-environment

DISPLAY is not set, so this is the reason the Dunst service isn't working

What is the way to set DISPLAY permanently on systemd environment variables?

Last edited by Mr.Doko (2017-05-21 17:24:46)

Offline

#2 2017-05-21 16:06:45

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Solved]Doubts with systemd set-environment


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-05-21 16:19:37

Mr.Doko
Member
Registered: 2017-05-14
Posts: 9

Re: [Solved]Doubts with systemd set-environment

Thanks for the response. I was reading https://wiki.archlinux.org/index.php/Sy … XAUTHORITY, but it seems it is not importing DISPLAY.  Should I move the script from /etc/X11/xinit/xinitrc.d/50-systemd-user.sh to another place?

EDIT: I executed it and it imports the variables. So it seems it must be loaded when the session starts. I have a clue of what to do.

Last edited by Mr.Doko (2017-05-21 16:23:26)

Offline

#4 2017-05-21 16:23:17

loqs
Member
Registered: 2014-03-06
Posts: 17,314

Re: [Solved]Doubts with systemd set-environment

Are you using gdm by any chance?

Online

#5 2017-05-21 16:24:06

Mr.Doko
Member
Registered: 2017-05-14
Posts: 9

Re: [Solved]Doubts with systemd set-environment

loqs wrote:

Are you using gdm by any chance?

No, I'm not using any DM for now

Offline

#6 2017-05-21 16:27:20

loqs
Member
Registered: 2014-03-06
Posts: 17,314

Re: [Solved]Doubts with systemd set-environment

How are you starting X?  If it is startx please post the relevant .xinitrc.

Online

#7 2017-05-21 16:37:02

Mr.Doko
Member
Registered: 2017-05-14
Posts: 9

Re: [Solved]Doubts with systemd set-environment

loqs wrote:

How are you starting X?  If it is startx please post the relevant .xinitrc.

conky -d
exec i3

Offline

#8 2017-05-21 16:38:15

loqs
Member
Registered: 2014-03-06
Posts: 17,314

Re: [Solved]Doubts with systemd set-environment

Please see the third note on Xinit.

Online

#9 2017-05-21 17:08:35

Mr.Doko
Member
Registered: 2017-05-14
Posts: 9

Re: [Solved]Doubts with systemd set-environment

I seem to get what's going on, but I'm still having problems.

https://wiki.archlinux.org/index.php/Sy … _variables indicates that the script at xinitrc.d (50-systemd-user.sh) is the one that sets the DISPLAY environment at systemd.

If there is no .xinitrc, it executes the xinitrc at /etc/X11/xinit/xinitrc, which by default loads the script I need for the display.

I copied the line that reads all the scripts inside xinitrc.d to my own .xinitrc, and even I tried to execute this only script directly on my .zprofile file, but the service is loading before the DISPLAY variable is exported on systemd, still giving me the same error of "cannot open display".

Just in case, the service is located in here https://github.com/dunst-project/dunst/ … service.in. It has a PartOf=graphical-session.target, which seems to work when the graphical session is executed.

Anything I might not be looking?

EDIT: It was a typo with .zshenv before, it was .zprofile. I added the lines that load the files at xinitrc.d at the beginning of the .zshenv and now it is working. Thanks for the help!

Last edited by Mr.Doko (2017-05-21 17:24:25)

Offline

Board footer

Powered by FluxBB