[Haskell] ANN: mute-unmute-0.2.0.0

Krzysztof Skrzętnicki gtener at gmail.com
Fri Aug 27 19:17:21 EDT 2010


*
Hello!

I'm pleased to announce a small utility program I wrote recently. Today I
pushed version 0.2.0.0 of mute-unmute to Hackage, from with you can
cabal-install it right now (following the usual 'update' step). What it
does? It's simple: it will mute the sound when you lock your screen and
unmute it back again when you unlock it.

Why anyone would need such program? Well, this is a little bit
more complicated.

I work in "open space" kind of office. It can get quite noisy there. I often
sit with headphones on, but when I walk away from my desk I put them down
and lock my screen. Here comes uncomfortable moment: when I remove my
headphones suddenly people around me who doesn't use their headphones now
start to hear the music I listen to. And they don't always like it, so I
manually mute the sound to make happy.

But now, instead of doing this task by hand I have a program do it for me
:-)

Unfortunately this kind of programs tend to be pretty much platform
specific. Current version supports the recent versions of Gnome and KDE, but
needs ALSA. It's quite common setup, but if you happen to have a different
one you can easily hack the code (it's very straightforward) and send me
patches. Patches are always welcome. The source repo is on Github and
released versions are on Hackage:

Github:
 http://github.com/Tener/mute-unmute <http://github.com/Tener/mute-unmute#>
Hackage:
http://hackage.haskell.org/package/mute-unmute

Example use:

~/ mute-unmute # first session, it will ask for configuration options
mute-unmute: Creating config directory...
mute-unmute: Mute config is missing...
Mute sound card and press RETURN

mute-unmute: Unmute config is missing...
Unmute sound card and press RETURN

mute-unmute: Session: UnixAbstract {addrPath = "/tmp/dbus-1tB1AEUcgg",
addrGuid = Just "19ec85e3778816ad38a77bbf0000003f"}
mute-unmute: Connected
mute-unmute: Handler added: [MatchType Signal,MatchInterface
"org.gnome.ScreenSaver",MatchMember "ActiveChanged",MatchPath
"/org/gnome/ScreenSaver"]
mute-unmute: Handler added: [MatchType Signal,MatchInterface
"org.freedesktop.ScreenSaver",MatchMember "ActiveChanged",MatchPath
"/ScreenSaver"]
^C

~/ mute-unmute # remembers previous options which can be changed by calling
with --store switch
mute-unmute: Session: UnixAbstract {addrPath = "/tmp/dbus-1tB1AEUcgg",
addrGuid = Just "19ec85e3778816ad38a77bbf0000003f"}
mute-unmute: Connected
mute-unmute: Handler added: [MatchType Signal,MatchInterface
"org.gnome.ScreenSaver",MatchMember "ActiveChanged",MatchPath
"/org/gnome/ScreenSaver"]
mute-unmute: Handler added: [MatchType Signal,MatchInterface
"org.freedesktop.ScreenSaver",MatchMember "ActiveChanged",MatchPath
"/ScreenSaver"]
mute-unmute: Message {mType = Signal, mFlags = [NoReplyExpected], mSerial =
31, mPath = Just "/org/gnome/ScreenSaver", mInterface = Just
"org.gnome.ScreenSaver", mMember = Just "ActiveChanged", mErrorName =
Nothing, mReplySerial = Nothing, mDestination = Nothing, mSender = Just
":1.19", mBody = [Variant (True) {- b -}]}
mute-unmute: Lock screen
mute-unmute: Message {mType = Signal, mFlags = [NoReplyExpected], mSerial =
32, mPath = Just "/org/gnome/ScreenSaver", mInterface = Just
"org.gnome.ScreenSaver", mMember = Just "ActiveChanged", mErrorName =
Nothing, mReplySerial = Nothing, mDestination = Nothing, mSender = Just
":1.19", mBody = [Variant (False) {- b -}]}
mute-unmute: Unlock screen
^C


*
You can get usage information with --help switch:

*~/ mute-unmute --help
*mute-unmute
         --store         ask for mute and unmute configurations
         --store-mute    ask for mute configuration
         --store-unmute  ask for unmute configuration
 -d      --daemon        wait for screensaver state changes
 -h, -?  --help          show help

There isn't much more I can say. I hope you find the program at least
educational (as a simple example of DBus usage) if not useful.

Best regards,
Krzysztof Skrzętnicki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell/attachments/20100827/ec7a6e9c/attachment.html


More information about the Haskell mailing list