If you have configured many Thunderbird’s mail filters and you don’t want them to be applied when you are away from your computer, maybe because (like me) you want to have all the messages in the standard Inbox when you are reading them on the smartphone, you could try to suspend Thunderbird when screensaver is active.
A simple script, and crontab, could be enough …
Create file /usr/local/bin/sync_thunderbird_with_screensaver.sh e inside it paste the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/sh # # Davide Airaghi # Simple tool to suspend/resume Mozilla Thunderbird # when the screen is locked/unlocked # LANG=en export LANG XCMD=$(which xscreensaver-command 2>/dev/null) TDISPLAY=$(ps eax|grep thunderbird|grep -v grep|sed -es/^.*DISPLAY=//|sed -es/\ .*$// | grep : | tail -n1) if [ "$XCMD" != "" ]; then export DISPLAY=$TDISPLAY ISLOCKED=$( ${XCMD} -time 2>/dev/null | grep -i locked ) if [ "$ISLOCKED" != "" ]; then pkill -STOP thunderbird 2>/dev/null >/dev/null else pkill -CONT thunderbird 2>/dev/null >/dev/null fi fi |
Save the file, make it executable and, using crontab, add it to the scheduled tasks.
I have added the following line to my crontab:
1 |
*/2 * * * * /usr/local/bin/sync_thunderbird_with_screensaver.sh 2>/dev/null >/dev/null |
In this way the script checks every 2 minutes if the screensaver is active and suspend/resume Thunderbird when it has to.