Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Well i was just thinking of having an app or a feature which enables you to play music even the laptop lid is shut close. what i want is that the screen should be locked ie no one should be able to do any other thing and at the same time my music should be contiued to play; virtually turning my lid-turned down laptop into a musical jukebox, ie a musical screen saver of sorts. Can anyone help me in achieving this? Any hints?

share|improve this question
    
you when the laptop lid is closed you want: 1. all processes killed, 2. music player started. or do you want 1. xlock started 2. music player started, or do you want 1. all x applications killed 2. xlock started 3. music player started. you need to be more clear about what exactly you need! –  Janus Troelsen Jan 18 '13 at 12:49
    
I want music player started and xlock started –  MKJ Jan 18 '13 at 19:01

1 Answer 1

You could try putting this in a file, marking it executable, and referencing it in your xinit or rc.local:

#!/bin/sh
while true
do grep -v open /proc/acpi/button/lid/LID0/state
  if [ $? ]; then
    killall mplayer
  else
    pidof mplayer; if [ $? ]; then screen -d -m "sh -c 'mplayer -loop 0 -novideo /usr/share/example-content/Ubuntu_Free_Culture_Showcase/*' "; xlock; fi
  fi
  sleep 1
done

It's pretty straightforward, ask me if you have questions. Obviously it will only work problem-free if you do not use mplayer while using it.

share|improve this answer
    
I opened a music file in vlc media player and then closed the lid of my laptop. But after sometime it stopped playing . –  MKJ Jan 20 '13 at 4:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.