Description: System tray application that can be kicked by dbus and will switch CaptureDevice to enabled or disabled state. The primary goals of this software is doing the following: -- Show microphone capturing state (uses alsa notifications) -- Switch microphone capturing state by hotkey (only dbus messages are supported)
This is my first simple application on Python. It was developed for Skype meetings to be sure when microphone is enabled and when it isn't.
To use it you need PyQt4 and pyalsa installed using dbus is currently optional. If you can't find pyalsa in your package repository, try to install it via "easy_install pyalsa". easy_install is a part of setuptools (or python-distribute) package. When the application is launched it puts microphone icon into the system tray. If capture device is disabled, red crossing circle will be added. CaptureDeviceTray utility uses pyalsa library (http://www.alsa-project.org) for checking status of alsa capturing device and receiving notifications. So this utility can be used just to show your capturing device state. Also you can change the state of selected device via dbus calls to the CaptureDeviceTray.
Sample dbus calls to switch capture state: -- Via CaptureDeviceTray utility qdbus org.kde.capturedevice /CaptureDevice org.kde.CaptureDevice.SwitchState -- Via kmix: qdbus org.kde.kmix /Mixer0 org.kde.KMix.setRecordSource Capture:0 [True|False] -- Via amixer command-line: amixer sset Capture,0 capture [cap|nocap]
To set up capture device name in CaptureDeviceTray, place the device name to CaptureDevice.conf. Only one device could be specified for now. To know your name, open kmix and find the capture channel you need. I have two capture channels: "Capture" and "Capture 2". To use "Capture" put the "Capture:0" line into config to use the second one, use "Capture:1" etc. 'amixer scontrols' output could be helpful
To use the CaptureDeviceTray unpack the archive somewhere you like. I'm using ~/programs/. Then start the application via krunner using full path. If you run it via krunner it will be started again at login automatically. Then you could use context menu to check does it work. Then try dbus commands listed above.
To bind hotkey for switch you can use Custom Shortcuts in KDE System Settings -> Shortcuts and Guestures. To add new shortcut click Edit -> New -> Global Shortcut -> DBus command. In trigger tab set your hotkey, in Action tab set the following: Remote application: org.kde.capturedevice Remote object: /CaptureDevice Function: org.kde.CaptureDevice.SwitchState Arguments: leave this field empty Try Call button to check.
Have a lot of fun!Last changelog:
0.1 - Initial revision. 0.2 - Don't require kmix. Listen ALSA notifications via pyalsa. 0.3 - Switch state on click action.
Cool idea; I can't count the times I was having mic issues where this would have come in handy. Do you know how well it interacts with PulseAudio?
I can't help but wonder though, wouldn't something like this be better implemented as a Plasma widget? Given you made it dependent on KDE, it just seems logical. :)
Ratings & Comments
1 Comment
Cool idea; I can't count the times I was having mic issues where this would have come in handy. Do you know how well it interacts with PulseAudio? I can't help but wonder though, wouldn't something like this be better implemented as a Plasma widget? Given you made it dependent on KDE, it just seems logical. :)