KDesktopLock is a wrapper-script written in Python for KDE users. It will change Gajim's status to away before locking the screen and set it back online when unlocking in KDE. It can certainly be used for other graphical desktops using a script to lock the screen. You are free to customize it to your needs.
- Download the script and copy it into /usr/local/bin on your Linux machine.
- In order to get it working you have to find the binary kdesktop_lock in your KDE installation. The binary is responsible for locking and unlocking the screen in KDE.
- Rename the kdesktop_lock to kdesktop_lock.kde or any other name you find appropriate.
- Set the KDESKTOP_LOCK_BIN variable (line 33) in kdesktop_lock.py to the full path of the rename KDE kdesktop_lock.kde.
- Link the kdesktop_lock.py from /usr/local/bin to the place kdesktop_lock resides and name it kdesktop_lock.
user@host:/usr/X11R6/bin $ ln -s /usr/local/bin/kdesktop_lock.py kdesktop_lock
- Configure your default away message in the AWAY_STATUS_MSG (line 36) variable.
- You may set the location of gajim-remote in the GAJIM_REMOTE_BIN (line 34) variable, if the whereis command on your system doesn't give the right location.
- Finished. You can simply test it. Go online with Gajim and lock you KDE. Unlock it with you password and you should see the trayicon changing the status from away to online.
KDE receives an upgrade
After updating anything on your system concerning KDE, you have to check the symlink. If the update overwrote everything, just walk through the above mentioned steps again.
How it works
As mentioned above, the script is a wrapper. It catches the call for kdesktop_lock and passes it on to the KDE binary kdesktop_lock. Prior to that, it remembers the status and status messages of all accounts being online. That's the default setting. Then the script executes the original kdesktop_lock binary. After unlocking the KDE screen with your password, the kdesktop_lock binary exits and gives control back to kdesktop_lock.py. It changes the status of Gajim from away to online and sets the saved status messages for all accounts.
The script does only touch accounts with status online. Extended away, busy, away, free for chat, invisible and offline are not touched. They just remain as you set them up.