[SOLVED] Start program (synergyc) with GDM

Issues related to applications and software problems and general support
Post Reply
th3penguinwhisperer
Posts: 6
Joined: 2017/04/24 20:16:44

[SOLVED] Start program (synergyc) with GDM

Post by th3penguinwhisperer » 2021/05/05 10:05:47

Hi,

I've been using Synergy on CentOS7 and now on CentOS8.
It is both started when a session got started and when the greeter was shown.

I've disabled Wayland and have the following added in /etc/gdm/Init/Default before exit 0:

Code: Select all

/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc 192.168.1.110
When I restart gdm synergyc doesn't seem to be started. SElinux is permissive.
So I've added a "logger" call at the start of the script and it seems the Default script is not even triggered.
I've enabled the debug in gdm/custom.conf and there's no mention of that script. Not sure I'm looking in the right log though.

All methods I can find to get it started in the greeter mention the same thing.
Last edited by th3penguinwhisperer on 2021/05/05 12:42:08, edited 2 times in total.

th3penguinwhisperer
Posts: 6
Joined: 2017/04/24 20:16:44

Re: Start program with GDM

Post by th3penguinwhisperer » 2021/05/05 10:39:04

I seemed to have found a workaround:

cat /usr/share/gdm/greeter/autostart/synergyc.desktop

Code: Select all

[Desktop Entry]
Type=Application
Name=Synergy Client
Exec=synergyc 192.168.1.110
#NoDisplay=true
#AutostartCondition=GSettings org.gnome.desktop.a11y.applications screen-reader-enabled
X-GNOME-AutoRestart=true
Restart GDM and it works.

! Take into account after you log out from the session synergyc is not executed again which feels odd but didn't found a way yet to do this.
Last edited by th3penguinwhisperer on 2021/05/05 10:59:30, edited 1 time in total.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Start program with GDM

Post by jlehtone » 2021/05/05 10:40:45

What is "Synergy" and what does it have to do with GDM?

th3penguinwhisperer
Posts: 6
Joined: 2017/04/24 20:16:44

Re: Start program with GDM

Post by th3penguinwhisperer » 2021/05/05 11:00:25

jlehtone wrote:
2021/05/05 10:40:45
What is "Synergy" and what does it have to do with GDM?
It's irrelevant. I want to execute a program when the GDM greeter is shown.

th3penguinwhisperer
Posts: 6
Joined: 2017/04/24 20:16:44

Re: Start program with GDM

Post by th3penguinwhisperer » 2021/05/05 12:32:31

I found a solution that works with Gdm PostSession script.

/etc/gdm/PostSession/Default:

Code: Select all

#!/bin/sh

# Kill old process
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done

# Get the xauthority file that GDM uses, setup DISPLAY var and start synergyc again
xauthfile=$(ps aux |grep Xauth | grep '^gdm' | grep -oP '\-auth \K[\w/]+')
export DISPLAY=:0
export XAUTHORITY=${xauthfile}
/usr/bin/synergyc 192.168.1.110

exit 0
Now after every logout synergyc is started again.

Post Reply