2

I have a working TeamViewer that I can successfully connect to after I started the GUI of TeamViewer. Unfortunately though, I cannot connect to my computer when the GUI of TeamViewer is not started. All documentation that can be found out there suggests that running the TeamViewer daemon teamviewerd is enough to be able to remotely connect to a machine, but it does not seem like that is the case for me.

Without TeamViewer GUI (just teamviewerd)

Output of teamviewer status:

 TeamViewer                           11.0.57095  (DEB) 

 teamviewerd status                   ● teamviewerd.service - TeamViewer remote control daemon
   Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sa 2016-04-30 17:01:55 CEST; 11min ago
  Process: 15518 ExecStart=/opt/teamviewer/tv_bin/teamviewerd -d (code=exited, status=0/SUCCESS)
 Main PID: 15521 (teamviewerd)
   CGroup: /system.slice/teamviewerd.service
           └─15521 /opt/teamviewer/tv_bin/teamviewerd -d

Apr 30 17:01:54 rvaio systemd[1]: Starting TeamViewer remote control daemon...
Apr 30 17:01:55 rvaio systemd[1]: teamviewerd.service: PID file /var/run/teamviewerd.pid not readable (yet?) after start: No such file or directory
Apr 30 17:01:55 rvaio systemd[1]: Started TeamViewer remote control daemon. 

 TeamViewer ID:                        123456789

Output of sudo netstat -ntap | grep teamviewer:

tcp        0      0 0.0.0.0:5938            0.0.0.0:*               LISTEN      1447/teamviewerd
tcp        0      0 127.0.0.1:5940          0.0.0.0:*               LISTEN      1447/teamviewerd
tcp6       0      0 :::5938                 :::*                    LISTEN      1447/teamviewerd

With TeamViewer GUI started

Output of teamviewer status:

 TeamViewer                           11.0.57095  (DEB) 

 teamviewerd status                   ● teamviewerd.service - TeamViewer remote control daemon
   Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sa 2016-04-30 17:01:55 CEST; 18min ago
  Process: 15518 ExecStart=/opt/teamviewer/tv_bin/teamviewerd -d (code=exited, status=0/SUCCESS)
 Main PID: 15521 (teamviewerd)
   CGroup: /system.slice/teamviewerd.service
           └─15521 /opt/teamviewer/tv_bin/teamviewerd -d

Apr 30 17:01:54 rvaio systemd[1]: Starting TeamViewer remote control daemon...
Apr 30 17:01:55 rvaio systemd[1]: teamviewerd.service: PID file /var/run/teamviewerd.pid not readable (yet?) after start: No such file or directory
Apr 30 17:01:55 rvaio systemd[1]: Started TeamViewer remote control daemon. 

 TeamViewer ID:                        123456789

Output of sudo netstat -ntap | grep teamviewer:

tcp        0      0 0.0.0.0:5938            0.0.0.0:*               LISTEN      15521/teamviewerd
tcp        0      0 127.0.0.1:5940          0.0.0.0:*               LISTEN      15521/teamviewerd
tcp        0      0 127.0.0.1:5940          127.0.0.1:48475         ESTABLISHED 15521/teamviewerd
tcp6       0      0 :::5938                 :::*                    LISTEN      15521/teamviewerd
tcp6       0      0 2003:72:2d76:2701:46132 2a01:488:2001:1c01:5938 ESTABLISHED 15521/teamviewerd

As you can see, having the GUI launched causes two connections to become established, unlike with just the daemon.

5
  • This may be an issue with the program itself... I have it running all the time in the tray
    – John Orion
    Apr 30, 2016 at 15:37
  • If you have it running in the tray, do you have some startup parameter or something so it starts minimized (I currently have it configured to start the GUI on startup, but I have to close the windows manually)?
    – randers
    Apr 30, 2016 at 15:38
  • 1
    well I use a program called gDevilspie to minimize the window and hide the taskbar item ..you have to set up two rules for teamviewer .. one for the main window and one for the contacts list. but with this program .. you will have to launch it and stop it to view the windows again when you need too
    – John Orion
    Apr 30, 2016 at 15:40
  • @JohnOrion: Would you mind sharing that as an answer?
    – randers
    Apr 30, 2016 at 15:41
  • will do ... it will take me a few moments .. going to show some screenshots
    – John Orion
    Apr 30, 2016 at 15:44

2 Answers 2

4

I have this issue too and found that it may be with the program itself. My solution was to use a program available in Ubuntu called gDevilspie.

You will have to set up two rules in the program to hide the main window and contact list. enter image description here

Here is how I set up TeamViewer

enter image description here

enter image description here

here are the settings I used:

For TeamViewer:

application_name equals Computers & Contacts 
window_name      equals Computers & Contacts 

the screen shot shows the actions for that window

For TeamViewer2:

application_name equals TeamViewer 
window_name      equals TeamViewer 

The actions I used for this rule are: close

This for the way my TeamViewer is setup .. this will close the main window and leave it sitting in my tray running.

Now even though it is in the tray running ... If I want to view it I cannot click on the icon and choose Show TeamViewer or it will just open and close again. I have to stop gDevilspie to open / view the program .. just keep that in mind

1

Expanding on what @JohnOrion posted, I have a solution which is more reliable. Instead of always killing TeamViewer's windows, it just closes the two windows at program startup and then stops closing them in the future. Here is what you need to do:

  1. Install devilspie and procmail.

    sudo apt-get install devilspie procmail
    
  2. Write this into ~/.devilspie/TeamViewer.ds:

    (if
        (or
            (and
                (is (application_name) "TeamViewer")
                (is (window_name) "TeamViewer")
            )
            (and
                (is (application_name) "Computers & Contacts")
                (is (window_name) "Computers & Contacts")
            )
        )
        (begin
            (close)
            (spawn_async "~/bin/teamviewer/tvwindow")
        )
    )
    
  3. Create a directory where you want to locate some scripts. I chose ~/bin/teamviewer, but you can choose whatever you like. If you change this directory, make sure you also change it in the script in step 2.

    mkdir -p ~/bin/teamviewer
    
  4. Write these contents to ~/bin/teamviewer/tvwindow (again, change the directory if you want):

    #!/usr/bin/env bash
    
    source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/vars"
    
    lockfile teamviewerstartup.lock
    
    # read remaining windows
    REMAINING_WINDOWS=$(cat "$REMAINING_WINDOWS_FILE")
    REMAINING_WINDOWS_NOW=$(($REMAINING_WINDOWS - 1))
    
    if [ $REMAINING_WINDOWS_NOW -eq 0 ]; then
        # TeamViewer has started up completely, kill devilspie
        kill $(cat "$DEVILSPIE_PID_FILE")
        # Also remove temporary files
        rm -f "$DEVILSPIE_PID_FILE"
        rm -f "$REMAINING_WINDOWS_FILE"
    else
        # One or more windows to go, write the decremented value to the file
        echo -n "$REMAINING_WINDOWS_NOW" > "$REMAINING_WINDOWS_FILE"
    fi
    
    rm -f teamviewerstartup.lock
    
  5. Write these contents to ~/bin/teamviewer/tvminimizedstart (again, change the directory if you want):

    #!/usr/bin/env bash
    
    source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/vars"
    
    nohup devilspie > /dev/null 2>&1 &
    DEVILSPIE_PID=$!
    
    lockfile teamviewerstartup.lock
    
    # Write PID of devilspie process
    echo -n "$DEVILSPIE_PID" > "$DEVILSPIE_PID_FILE"
    # Set remaining to be closed windows to 2
    echo -n "2" > "$REMAINING_WINDOWS_FILE"
    
    rm -f teamviewerstartup.lock
    
    nohup teamviewer >/dev/null 2>&1 &
    
  6. Write these contents to ~/bin/teamviewer/vars (again, change the directory if you want):

    #!/usr/bin/env bash
    
    DEVILSPIE_PID_FILE="$HOME/bin/teamviewer/devilspiepid"
    REMAINING_WINDOWS_FILE="$HOME/bin/teamviewer/remaining-windows"
    
  7. Make them executable.

    chmod +x ~/bin/teamviewer/tvwindow ~/bin/teamviewer/tvminimizedstart ~/bin/teamviewer/vars
    

To use this solution, run the tvminimizedstart script:

~/bin/teamviewer/tvminimizedstart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .