How can I automatically set my status to Busy when Empathy starts?
So I can make Empathy log me in on boot, but how do I make my initial status Busy?
Solution 1:
After some searching, I found an app that communicates with Empathy via dbus. I pulled some code from that and created a script that will set your status.
Setting it up is pretty easy:
Download the script here (github page).
It requires some python libraries that are in the repos (and might be installed by default):
sudo apt-get install python-dbus python-notify
Then to set it to start on login, run Startup Applications, click Add, and fill in the fields like this:
- Name: Custom -- Start Empathy Busy
- Command: /usr/bin/python /path/to/empathy_set_status.py dnd
- Comment: Start empathy and set status to busy (do no disturb).
The command field includes what status to set. If you don't want busy (dnd), then you can use one of these values: available, dnd, away, xa, hidden, offline.
Now when you log in, the script it should run empathy, wait a bit, and then set your status. You should see a notification when it tries to set your status.
I don't check that the status is set correctly, so I just have a wait time to hope that empathy will be ready to let us change the status. Adjust your time if it's not working. Increase the value of EMPATHY_STARTUP_SECONDS
until it works when you login. If you need to enter a password to unlock your keychain for your IM login, the delay will have to be long enough for Empathy to start up, for you to enter your password, and for Empathy to log into your accounts.
Solution 2:
There is a bug about the inability to use something other than 'available' as the default status in Empathy. However, if you're willing to consider a different program, Pidgin does let you set a different initial status.
Solution 3:
Empathy does not allow this directly. However, you could try the following.
In summary, you can record the mouse motion events where you would normally click the Me Menu and choose the "Busy" status. Alternatively you can navigate to the same Me Menu entry via the Keyboard shortcut F10 and the arrow keys. You could then replay these events on logon through a Start Up Application entry.
This can be down through an application called "cnee". However, the version in Maverick & Natty does not work. If you compile from source, it does work though.
Download the latest source code from here.
cd ~/Downloads
tar -xvf xnee-cvs-20110508.tar.gz
cd xnee-cvs-20110508
sudo apt-get install build-essential
./configure --disable-gnome-applet --disable-gui
make
sudo make install
If configure complains about a missing library/or libraries, install the library reported to be missing:
sudo apt-get install lib<name of library>-dev
Then record the mouse events by running the following (after the count-down) and moving your mouse to the Me Menu and clicking the Busy status, followed by the 'h' keyboard key to stop recording
cnee --record -o ~/changebusy.xnr --mouse --time 5 --stop-key h
Alternatively record keyboard events by choosing the keyboard short cut F10 + LEFT ARROW + LEFT ARROW + DOWN ARROW (twice) + ENTER + h
cnee --record -o ~/changebusy.xnr --keyboard --time 5 --stop-key h
Create a Startup Application with the command
sh -c "sleep 10 && cnee --replay -f ~/changebusy.xnr"
Solution 4:
Note that this won't work for irc accounts(maybe others?). Put a try/except block at the end of the script to fix this:
try:
simple_presence.SetPresence(status, _STATUSES.get(status))
except dbus.exceptions.DBusException:
print(status + ' is not supported by ' + valid_account)