21

Here is a quesion that has been bugging me. You know how you can set up a program to run on start up right? Well, how can i tell it to start minimized, like you would do in windows?

TeamViewer starts open, but I need it minimized, and Tray-it just doesn't seem as elegant of a way to do it.

1

8 Answers 8

22

You can use a tool called devilspie Install devilspie.

This tool can take actions as soon as programs are started, like sending to workspaces, pinning, and also minimizing. A tutorial is here.

  • To install it from the command-line run:

sudo apt-get install devilspie.

  • To configure it to minimize Teamviewer everytime it is executed:

    mkdir ~/.devilspie
    

Create a file called ~/.devilspie/teamviewer.ds and paste the following lines:

(if  
(is (application_name) "Teamviewer")  
(begin (minimize) )  
)  

If you'd like a gui for easier configuration you should take note of gdevilspie Install gdevilspie

(if GDevilspie not starting try patched one).

1
  • 1
    This works, but when I restore the minimised window it draws incorrectly - the background of the TeamViewer window becomes a copy of whatever is underneath it and some text is not visible, e.g. i.imgur.com/0p6yR.png (I've obscured text in the three text boxes). Other wine apps don't do this (Notepad++, Picasa).
    – misterben
    Feb 14, 2011 at 18:50
5

I stumbled across this post with the very same issue of TeamViewer not starting minimized when set up for automatic launch during Ubuntu system startup.
The method described by @MJB on Jan 27 at 16:02 worked perfectly for me (I'm running Ubuntu 10.10 32bit, all updates installed up to this date, with teamviewer_linux_x32_v6.0.9224.deb).
I do not experience the glitches described by @misterben on Feb 14 at 18:50.
I installed GDevilspie via Ubuntu Software Center, ran it, created a new rule and set up GDevilspie to show the following code in the "Raw" tab:

( if 
( begin 
( is ( application_name ) "Teamviewer" )
( is ( window_name ) "TeamViewer" )
) 
( begin 
( minimize )
( println "match" )
)
)

The devilspie daemon is set to start up automatically during system start and teamviewer is set to start automatically via System --> Preferences --> Startup Applications (click Add, command: teamviewer).

It would be great if the developers of TeamViewer would integrate a start minimized switch for linux though...

Thanks MJB! :)

4

Minimizing a program depends on the program if it supports that or not. It also depends if the program has an option in the gui or via command line. For example vlc has an option in preferences that gives the chance to start it minimized. But it also has an option in command line to start it minimized (like parameters). The option to minimize also changes depending of the program. Some programs might be program -min other might be program -systray, etc.. Verify that Teamviewer for example has an option for this in the gui options. If the program has a command line minimize parameter just add it to the start up manager.

1
  • Teamviewer uses Wine to support running on Linux. As the Windows versions don't accept any command line parameters, neither does the Linux version. Also, if one does minimize it to the tray, it will use the Wine icon, unless provided with another by whatever tool is used. Aug 14, 2013 at 5:53
2

I'm also minimizing Teamviewer to the tray on startup, but I'm using KDocker.

sudo apt-get install kdocker

My startup script is one line:

kdocker -n Teamviewer -i /opt/teamviewer/teamviewer/7/desktop/teamviewer.png -d 40 /usr/bin/teamviewer7 &
  • -n is the name of the window
  • -i is the icon file
  • -d is a 40 second limit, after which kdocker will give up if it can't find a matching window
1
  • Worked for me whee alltray didn't – seems able to "dock" any app, great! Despite of its name, it's not a KDE app :) Note however the syntax has changed, according to the man page -d has a different purpose now (disable session management), -n is no longer listed even (your syntax however is still shown with kdocker -h, but -d definitely wasn't matching that in my experience). Just start without any parameters, and it lets you pick the window.
    – Izzy
    Mar 5, 2020 at 23:19
1

Devilspie didn't work in my system for some reason. Eventually, I found a substitute (not so elegant).I installed wmctrl:

sudo apt-get install wmctrl

Using wmctrl -l found the names of the windows, I wanted to close on startup. After that, put those command into script (create new empty file and name it .<...>.sh. Dot at the beginning of the name to hide it):

wmctrl -c <Window_1>
wmctrl -c <Window_2>
wmctrl -c <Window_3>

Finally, added this file to the startup applications couple of seconds after the targets.


Note, that this command closes windows. To start program minimized, on different workspace ets, find appropriate options in the program manual.

2
  • Unless you make it "smartly" wait for the window, success will depend on the time between the appearance of the window and the command to minimize. As said, better make it smartly wait for the window, else it won't work when your system is occupied (and thus slower). Also, there is a risk of name clashes, since you don't use the window id, but (part of) the name as an identifier. see askubuntu.com/a/663288/72216 Jan 2, 2016 at 12:55
  • I agree with you. I've even posted my version of the script there. I still use this one for the teamviewer though.
    – Sergey
    Aug 16, 2016 at 17:31
0

Since Teamviewer 8.0.20931 there is automatically minimize to system tray function. But in Gnome classic it will create Wine System Tray and I do not know, how to minimize it. I tried the script (saved as ~/.devilspie/wine.ds):

( if 
( begin 
( is ( application_name ) "Wine" )
( is ( window_name ) "Wine System Tray" )
) 
( begin 
( minimize )
( println "match" )
)
)

... but it did not work

With new Teamviewer 8.0.20931 for Linux even log in onto Linux login screen works - when no user is not logged in yet. But after some time when you log in and out twice or so - you cannot connect to Teamviewer. You need to have remote access over command line to do restart to computer - then it works again.

0

2017 working solution!

I am coming from Manjaro (XFCE) edition, but since this is cross-linux solution with devilspie, so this is the complete solution on starting team viewer minimized:

  1. Open terminal

  2. Install devilspie package:

    apt-get install devilspie
    
  3. Create home folder:

    mkdir ~/.devilspie
    
  4. Create the following script (use any editor you want instead of nano):

    nano ~/.devilspie/teamviewer.ds
    
  5. Paste the following script and save file (for nano - CTRL+x, then Y, Then ENTER):

    ( if
    ( begin
    ( is (application_name) "Teamviewer")
    ( is (window_name) "TeamViewer")
    )
    ( begin (close) )
    )
    
    1. From the devilspie perspective all steps are done, but "Computers & Contacts" side window will still be shown on each startup. To hide it, open the:

TeamViewer --> Extras --> Options --> Advanced --> "Show advanced options" --> "Show Computers & Contacts on startup" (It's under "Advanced settings for Computers and Contacts section) and uncheck it.

Steps are for TeamViewer 12. In further versions they might be different.

NOTE:

Using (minimize) instead of (close) in devilspie script brought me "TeamViewer not ready. Please check your connection" error and without team viewer service restart it did not work.

0

in the new version the program already has an icon in the tray, but two main windows of the program appear at startup. So I'm using this script

#! /bin/sh

/opt/teamviewer/tv_bin/TeamViewer &
sleep 10
TV_WIN_ID=$(xdotool search --name TeamViewer)
TV_WIN_ID2=$(xdotool search --name 'Компьютеры и контакты')

if [ -n "$TV_WIN_ID" ] ; then
 sleep 1
 xdotool windowactivate $TV_WIN_ID
 xdotool key Alt+F4  
else
 exit 1
fi
if [ -n "$TV_WIN_ID2" ] ; then
 sleep 1
 xdotool windowactivate $TV_WIN_ID2
 xdotool key Alt+F4  
 else
exit 1
fi

You must log in to answer this question.

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