kirocker Syndicate content

warning: Creating default object from empty value in /www/htdocs/w0065fc9/milianw/modules/taxonomy/taxonomy.pages.inc on line 33.

» Patching Kirocker Music Display for volume control via mouse scrolling

Fri, 03/28/2008 - 16:32

Kirocker is such a great application, it’s a pity the developer Sébastien Laoût has given up on it and is using Windows now!

Usually I only use the kicker applet, the full screen window is nice for parties though. But I didn’t like the way the applet handles scroll events: It seeks (if possible). Since I rarely seek when listening to music I’d rather have the behaviour of the Amarok tray icon: volume control!

I had a look inside the sources and found this part in src/coverdisplay.cpp:

  1. void CoverDisplay::wheelEvent(QWheelEvent *event)
  2. {
  3. if (areControlsShown()) {
  4. if (event->orientation() == Qt::Vertical) {
  5. PlayerInformation *infos = PlayerInformation::instance();
  6. if (infos->canSeek()) {
  7. int deltaSeconds = 10 * (event->delta() > 0 ? 1 : -1);
  8. m_infos->seekRelative(deltaSeconds);
  9. }
  10. } else {
  11. if (event->delta() > 0)
  12. AmarokApi::volumeUp();
  13. else
  14. AmarokApi::volumeDown();
  15. }
  16. }
  17. }

As you can see it already supports volume control via scrolling! The thing is I’ve disable four-way scrolling for my MX1000. Thus I’ve simply swapped the if statements and now I’m really happy with Kirocker. Here’s the updated snippet:

  1. void CoverDisplay::wheelEvent(QWheelEvent *event)
  2. {
  3. if (areControlsShown()) {
  4. if (event->orientation() == Qt::Vertical) {
  5. if (event->delta() > 0)
  6. AmarokApi::volumeUp();
  7. else
  8. AmarokApi::volumeDown();
  9. } else {
  10. PlayerInformation *infos = PlayerInformation::instance();
  11. if (infos->canSeek()) {
  12. int deltaSeconds = 10 * (event->delta() > 0 ? 1 : -1);
  13. m_infos->seekRelative(deltaSeconds);
  14. }
  15. }
  16. }
  17. }

Replace the old code, compile Kirocker, install it. Then restart kicker (killall kicker; sleep 1; kicker;) and Kirocker should accept scroll events in the way the Amarok tray icon does!