rulururu

post Rock yourself to sleep

February 25th, 2008

Filed under: Linux, Music — Kai @ 7:00 am

When going to bed I usually listen to some good melotic rock rhythms until falling asleep. Most times my computer is supposed to play music for half an hour and then switch off.
I simply shutdown after thirty minutes:

shutdown -h 30

But what can you do if you just wanna stop the music after half an hour but the pc should keep on working all night. That’s what I asked myself yesterday night. I sorted out the problem by using DCOP which stands for Desktop COmmunication Protocol.

Essentially, DCOP is a “remote control” system, which allows an application or a script to be controlled from outside. I use this software for years for my remote control with LIRC (Linux Infrared Remote Control) to gives impulses to Amarok player.

The model is simple. Each application using DCOP is a client. They communicate to each other through a DCOP server, which functions like a traffic director, dispatching messages/calls to the proper destinations. All clients are peers of each other.

For example you can tell xmms to pause playing music:

dcop xmms player pause

To wait for thirty minutes and then stop Amarok is as simple as the previous example:

sleep 30m; dcop amarok player stop

If you have further interest in DCOP here’s a simple guide howto implement a DCOP interface yourself:
Creating a DCOP Interface

It’s interesting to know that in modern KDE systems, every KDE application supports a basic set of DCOP interfaces, even if the programmer of the application did not explicitly code in such support.

KDE API Reference:
The DCOP Desktop COmmunication Protocol library

1 Comment »

  1. […] couchpotatoes wrote an interesting post today onHere’s a quick excerpt When going to bed I usually listen to some music until falling asleep. Mostly my computer is supposed to play music for half an hour and then switch off. Simply do that: shutdown -h 30 But what can you do if you just wanna stop the music after half an hour but the pc should keep on working all night. That’s what I asked myself yesterday night. I sorted out the problem by using DCOP which stands for Desktop COmmunication Protocol. Essentially, DCOP is a “remote control” system, which allow […]

    Pingback by Rock yourself to sleep — February 25, 2008 @ 8:17 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

ruldrurd
Powered by WordPress, Content and Design by Kai Bellmann
Entries (RSS) and Comments (RSS)