Results 1 to 8 of 8

Thread: How to make Ubuntu play a sound when the lid is opened or closed

  1. #1
    Join Date
    Apr 2007
    Location
    New Zealand
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

    How to make Ubuntu play a sound when the lid is opened or closed

    Hi there.
    Ever wanted Ubuntu to play a sound when the lid is opened? ... It's quite easy.

    You need the aplay program installed, which is by default in Gutsy.

    Find a wav file of your choice (mine is a bodily noise) and place it anywhere on your system.

    As root, edit the file /etc/acpi/lid.sh:
    Right near the top there is the code
    #!/bin/bash
    Put the following code directly beneath it:
    aplay /home/username/common_noise.wav
    Where username is your username, and common_noise.wav is the wav file.

    And thats it, when you open or close the lid, Ubuntu automatically runs the lid.sh script, which you have edited to make aplay play your sound clip.
    Last edited by K.Mandla; November 10th, 2007 at 02:45 PM.
    Brown doesn't suck. And neither does wood. Download Woody. A Metacity theme.
    Note: the rm command deletes stuff! Don't be tricked into running malicious scripts. If in doubt, ask!!

  2. #2
    Join Date
    Sep 2007
    Beans
    725
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    another guy did this howto as well. Yours is way simpler I've used yours. nice job!
    this is my signiture

  3. #3
    Join Date
    Apr 2007
    Location
    New Zealand
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    Awesomeeee

    A funny story if I may:
    My laptop plays a rather long 3 second fart sound when the lid is opened or closed. Normally it's not an issue but the other day I was doing stuff outside & the laptop was at maximum volume.

    Anyway I was on my lunch break, so I went back into work. All of a sudden I realised something. My laptop was closed, set to maximum volume, and no way to mute it. It was going to make a noise soon but of course if I opened the lid it was going to fart.

    So I sneaked into the coffee room where people eat their lunch. I thought nobody was around. I opened the lid and of course the thing was LOUD. I was panicing and trying to log in to mute it. Anyway a whole bunch of people were gathering around while I was frantically trying to log in to mute my farting laptop.

    Eventually I logged in and muted it. I then had to explain to about 20 people including bosses and managers etc that I programmed my laptop to fart. Life can be so difficult sometimes.
    Brown doesn't suck. And neither does wood. Download Woody. A Metacity theme.
    Note: the rm command deletes stuff! Don't be tricked into running malicious scripts. If in doubt, ask!!

  4. #4
    Join Date
    Feb 2007
    Location
    Pittsburgh
    Beans
    203
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    Quote Originally Posted by weblordpepe View Post
    Awesomeeee

    A funny story if I may:
    My laptop plays a rather long 3 second fart sound when the lid is opened or closed. Normally it's not an issue but the other day I was doing stuff outside & the laptop was at maximum volume.

    Anyway I was on my lunch break, so I went back into work. All of a sudden I realised something. My laptop was closed, set to maximum volume, and no way to mute it. It was going to make a noise soon but of course if I opened the lid it was going to fart.

    So I sneaked into the coffee room where people eat their lunch. I thought nobody was around. I opened the lid and of course the thing was LOUD. I was panicing and trying to log in to mute it. Anyway a whole bunch of people were gathering around while I was frantically trying to log in to mute my farting laptop.

    Eventually I logged in and muted it. I then had to explain to about 20 people including bosses and managers etc that I programmed my laptop to fart. Life can be so difficult sometimes.

  5. #5
    Join Date
    Mar 2006
    Location
    Frisco, TX
    Beans
    114
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    Quote Originally Posted by weblordpepe View Post
    Awesomeeee

    A funny story if I may:
    My laptop plays a rather long 3 second fart sound when the lid is opened or closed. Normally it's not an issue but the other day I was doing stuff outside & the laptop was at maximum volume.

    Anyway I was on my lunch break, so I went back into work. All of a sudden I realised something. My laptop was closed, set to maximum volume, and no way to mute it. It was going to make a noise soon but of course if I opened the lid it was going to fart.

    So I sneaked into the coffee room where people eat their lunch. I thought nobody was around. I opened the lid and of course the thing was LOUD. I was panicing and trying to log in to mute it. Anyway a whole bunch of people were gathering around while I was frantically trying to log in to mute my farting laptop.

    Eventually I logged in and muted it. I then had to explain to about 20 people including bosses and managers etc that I programmed my laptop to fart. Life can be so difficult sometimes.
    I must have this for a gag. Buddy is giving me his laptop to throw 7.10 on, this would be GOLD.
    Mine ---Dell Latitude D820 - 8.10 - Core2Duo T7400, 3GB
    G/f's --- Dell Studio 15 - 8.10 - Core2Duo T8400, 4GB, intel GMA Xeleventybillion.

  6. #6
    Join Date
    Apr 2007
    Location
    New Zealand
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    HEHE
    I wonder if you could make a bash script to do it randomly. Or even do it within certain times of the day. Suddenly scripting seems way more fun
    Brown doesn't suck. And neither does wood. Download Woody. A Metacity theme.
    Note: the rm command deletes stuff! Don't be tricked into running malicious scripts. If in doubt, ask!!

  7. #7
    Join Date
    Feb 2007
    Location
    perdita
    Beans
    1,625
    Distro
    Ubuntu

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    Quote Originally Posted by staticvoid View Post
    another guy did this howto as well. Yours is way simpler I've used yours. nice job!
    Yes, that was me!
    Here's my "complicated" one: http://ubuntuforums.org/showthread.php?t=563687

    I found this one while trying to find mine again. ^^

  8. #8
    Join Date
    Jun 2010
    Location
    Kuwait
    Beans
    57
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: How to make Ubuntu play a sound when the lid is opened or closed

    Thanks, I tried to enable system beep. it worked on some servers and on others not. using aplay is much easier than system beep. Thanks a lot

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •