
Media-Detect
Source (link to git-repo or to original if based on someone elses unmodified work):
*******
The "Manifesto"
Media-Detect is a script designed to make your multimedia shortcuts more powerful and easier to configure. It is intended for use with LinEAK, but can be called by any shortcuts or applications you like - such as khotkeys - or executed from the command line.
LinEAK is a program that enables the multimedia keys on specialty keyboards, such as the Logitech iTouch (my particular model). I use LinEAK, but have been frustrated by its lack of flexibility. Each button can only be configured to do one thing. If you configure the fast-forward button to skip to the next song in XMMS, that's all it will do. It won't skip to the next DVD chapter in xine if you happen to have that program open instead.
I wanted my keys to do more. I decided to scratch this itch and write myself a handy script that decides what each key does based on which app is currently open. Specifically, it takes parameters that have been passed to it and converts them into commands that your multimedia applications can use.
Now, instead of calling the app directly, LinEAK calls the script. Media-Detect then decides which multimedia application is open and provides the correct command. XMMS fast-forwards and rewinds, as does xine, KsCD, and any other application that can accept DCOP or command line calls. My buttons work the way I want them to, no matter what I happen to be doing. Life is good again.
0.55 - Minor feature and bugfix release
FEATURES
* Enhanced Feature: Added mute/unmute to Volume control. Now you can mute just the channel used by the open application.
* Menu system: Added ability to exit the menu from anywhere in it.
BUGFIXES
* Media-Detect: Locking files for alternate commands weren't application-specific. Fixed.
* Menu system: Every time you canceled from one menu to the previous menu, it would generate a new instance of the previous menu instead of gracefully exiting from the current menu loop. This could slow the menu down if you were editing or adding multiple applications. Fixed by implementing a proper canceling mechanism from each menu.
0.54 - Feature and bugfix release
FEATURES
* New Feature: Volume control module. You can now use Media-Detect to control the mixer and channel number of your choice. For instance, if your television tuner card and program use the AUX channel on your second mixer, you can configure Media-Detect to adjust the volume up and down on *that* channel and mixer while your television program is running. If no configured applications are running, you can set a default mixer and channel to adjust (usually the master volume on your first mixer). This feature requires aumix.
* New Feature: DCOP Applications. Some multimedia applications can use DCOP, the built-in KDE interface that allows programs like Media-Detect to control them via scripted commands. Media-Detect can now use this interface. While this was possible before by including the entire DCOP command in the configuration for each command, now Media-Detect can search DCOP, which is useful for programs which register a different name with DCOP every time they start, such as KMplayer.
BUGFIXES
* Menu system: I knew a logic bug would be found with the previous release, and one was. If you edited two applications in a row without restarting the menu, it would garble the view under certain circumstances. Fixed.
* Menu system: A bug prevented new applications from accepting Alternates when they were first created. Fixed.
* Command line menu: Sometimes cancel options wouldn't display properly. Fixed.
Ratings & Comments
11 Comments
really nice, I enjoy using it :) Thanks for that wonderful script Why not joining lineak and develop it there, cuz a script will always be a script
Actually, that's already happened. But some people like using khotkeys or other tools, so I continue to support both.
I'd like to install your program on my Gentoo Do you plan to provide an .ebuild file for it?
Media-Detect shouldn't need an .ebuild file to install in Gentoo. As long as you have a working (and reasonably up-to-date) bash installed, the scripts work exactly as they are right out of the tarball. There's nothing to be compiled or built. Just place the scripts in a directory on your path (or run the install script, which will do the same thing), and they should work. Let me know if you have any problems.
Media-Detect! It is a great piece of software, and an excellent idea! Let me please make a suggestion: would it be possible to integrate it into Lineak, so it becomes part of the same code and therefore it is not necessary to have both a Lineakd configurator and a Media-Detect configurator? This would also probably ease a clean extension of the Keyboard KDE control module?
Funny you should mention that... I'm currently in negotiations with the head developer to get Media-Detect integrated into lineak. It will probably be a little while before this functionality is part of that program, but it will happen (and believe me, I look forward to it). Ideally, all the buttons on a keyboard will be configurable from a single, easy-to-use location, and you won't need a program like mine to make the keyboard respond intelligently, because that will just be a feature of the keyboard control module in KDE, like you mention. But I have no idea how soon that will occur. I'm no programmer, and I wrote Media-Detect to scratch an itch. I don't have even the vaguest notion how complicated it might be to duplicate this script's features in lineak or in the keyboard module, so I'm just assuming at the moment it is VERY complicated, and basing my time estimates on that. Does anyone from the KDE team want to help me with this? I'd love to be proven wrong. :)
I've managed to get my Microsoft Multimedia natural keyboard special buttons working in KDE 3.2.1 with the Khotplug module in the KDE control center. So no need for lineak any more. In case this is any use to anyone I followed the instructions here: http://www.linuxformat.co.uk/modules.php?op=modload&name=phpBB_14&file=index&action=viewtopic&topic=8460&forum=16&3 The keys are then configurable from the khotkeys module.
At this point, I'm using khotkeys in conjunction with Media-Detect. I prefer the simple means of laying out application priority in Media-Detect. Basically, khotkeys rocks at turning the keys on, but doesn't make it easy to change what the keys do based on which applications are open. I know it's theoretically possible, but with every application you add it becomes ridiculously more complex. I prefer being able to simply assign which apps have higher priority.
...frequent updates today. Every time I thought I had the package right, I realized LATER that I'd missed something (grabbed the wrong readme, wrong build of the script, etc...) Oy, what a day...
Warning! I just found a bug in the editor that wipes out all but the default Xmms configuration if you delete any configurations at all. I will try to fix it shortly, but in the meantime only delete configurations manually. Adding new configurations is unaffected, and works normally.
Problem solved in latest build.