Search code examples
centos8gdm

Starting Synergy during gdm startup (greeter) in CentOS8


This is similar to Starting synergy automatically on RHEL/CentOS However this doesn't seem to be working anymore.

What I basically want to do is execute a program when the greeter is shown. THis has been working before by adding it to the /etc/gdm/Init/Default script. However right now the script doesn't seem to be called anymore (tested with a 'logger' call).

SElinux is in permissive mode. The script is executable. synergyc is specified with the full path.


Solution

  • The below resolves the issue. So to make synergyc always running at the GDM greeter use the PostSession script below and put the /usr/share/gdm/greeter/autostart/synergyc.desktop file into place:

    [Desktop Entry]
    Type=Application
    Name=Synergy Client
    Exec=synergyc 192.168.1.110
    X-GNOME-AutoRestart=true
    

    /etc/gdm/PostSession/Default:

    #!/bin/sh
    
    # Kill old process
    /usr/bin/killall synergyc
    while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
    
    # Get the xauthority file 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