Skip to content

Python program to check if left mouse button pressed, if yes then reboot.

Notifications You must be signed in to change notification settings

robertio/Is_mouse_button_pressed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Is_mouse_button_pressed?

Cheap and simple solution to power off your linux box when usb left mouse button pressed.

http://mousebuttonshutdown.blogspot.hu/2015/02/cheap-and-simple-solution-to-power-off.html

Python program to check if left mouse button pressed, if yes then power off. This is for embeded linux systems, without onboard buttons or keyboard, but you wants to shutdown with proper way. Cheap and simple solution: use an usb mouse button to power off your linux box.

Connect a mouse to your linux box. If /dev/input/mouse is exist then run this program and when left mosue button pressed program will issue "poweroff" linux command.

Prerequsites:

1. Install Python.

apt-get install python

2. Download the python program.

cd /usr/local/bin
wget --no-check-certificate https://raw.githubusercontent.com/robertio/Is_mouse_button_pressed/master/mouse_pressed.py
wget --no-check-certificate https://raw.githubusercontent.com/robertio/Is_mouse_button_pressed/master/midmousebutt.sh
chmod 755 mouse_pressed.py midmousebutt.sh 

3. Download shell script allow to run when system statup.

cd /etc/init.d
wget --no-check-certificate https://raw.githubusercontent.com/robertio/Is_mouse_button_pressed/master/mouse_pressed.sh
chmod 755 mouse_pressed.sh
update-rc.d mouse_pressed.sh defaults

4. Start first time manually

/etc/init.d/mouse_pressed.sh status         # first time will report error - 'casue not running.
/etc/init.d/mouse_pressed.sh start        # or reboot

If LEFT mouse button pressed - shut down system

If RIGHT mouse button pressed - Reboots system

If MIDDLE mouse button pressed - run a midmousebutt.sh script in /usr/local/bin directory (actually plays music)

About

Python program to check if left mouse button pressed, if yes then reboot.

http://mousebuttonshutdown.blogspot.hu/2015/02/cheap-and-simple-solution-to-power-off.html

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published