Linux Mint does not have a definitive way to start applications minimized. Rather it relies on the author of the application to provide switches which does the minification.
Most modern applications have that switch already but it’s a drag to go and look for them. Here we document a number of applications and the switches required to start them minimized if you’re using a Linux Mint desktop. Some mainstream one do not have that switch so we can use X-windows manipulation to achieve the same.
Discord
/usr/share/discord/Discord --start-minimized
Telegram Desktop
Telegram has this already built into the user interface so if you add it as a startup flag, it gets ignored. To find the setting in Telegram, navigate to the hamburger menu top left, Settings / Advanced / System integration / Call Settings / Launch minimized. But for reference, here is the official switch if you’re not launching it via Startup Applications:
/home/user/Software/Telegram/Telegram -- %u -startintray
Slack
/usr/bin/slack %U -u
WhatsApp Desktop and Teams
WhatsApp doesn’t have an official client and Teams is perpetually in beta. Teams for Windows actually has a minimized switch but the Linux version does not. As far as we know WhatsApp Desktop uses Electron and so does Teams, so with a bit of X-windows manipulation one can achieve minification.
Step 1, add WhatsApp and Teams to Startup Applications so that they can actually start up. Once they have started up, we’ll minimize them by script that calls wmctrl
with the -c
switch
Step 2, create this script, call it minify
, and save it anywhere, e.g. Documents/Minify/minify
This script must also be added to startup such as sh /home/user/Documents/Minify/minify
and best to add a startup delay. On my slowish system that meant 30 seconds.
The script works by looking for a substring windows title that contains certain letters and then closes it (which in the case of WhatsApp Desktop and Team means minimizing it). We have to use a substring for WhatsApp because the window title might be (1) WhatsApp
cat minify
#!/bin/bash
# WhatsApp including (1) WhatsApp
i=0 #set "counting var" to 0
while true; do #do as long as I say
i=$(echo $i + 1) #add 1 to i
wmctrl -c "whatsapp" #close window that contains substring "whatsapp"
if [ $? -eq 0 ]; then #if close window command was successful, do:
break #end "while"
else
if (( $i == 40 )) #if "counting var" = x, do:
then
break #end "while"
else
sleep 0.25 #pause "while" for x seconds
fi
fi
done
# Teams
i2=0
while true; do
i2=$(echo $2i + 1)
wmctrl -c "teams"
if [ $? -eq 0 ]; then
break
else
if (( $i2 == 40 ))
then
break
else
sleep 0.25
fi
fi
done
References
- https://docs.microsoft.com/en-us/answers/questions/15211/ubutnu-18044-lts-how-to-start-ms-teams-minimized-t.html
- https://askubuntu.com/questions/1087189/start-whatsdesk-minimized-in-system-tray-on-startup-ubuntu-18-10
- https://microsoftteams.uservoice.com/forums/555103-public/suggestions/39970093-how-to-start-ms-teams-minimized-to-tray-ubutnu-18
- https://microsoftteams.uservoice.com/forums/555103-public/suggestions/39990373-minimize-ms-teams-to-tray-linux
2 thoughts on “How to start WhatsApp, Teams, Slack, Telegram, and Discord Minimized in Linux Mint”
Thank You!
Nice !!!