Sunday, May 10, 2009

Ubuntu How to: hibernation confirmation message(message before hibernate)


1. Open gconf-editor. Go to Apps->gnome-power-manager->lock
uncheck hibernate. This will inhibit powermanager to lock your screen right after you click the hibernate button.


2.made a copy of /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux as /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linuxa

3.Edited /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux as

#!/bin/sh
getXuser() {
user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
if [ x"$user" = x"" ]; then
user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
fi
if [ x"$user" != x"" ]; then
userhome=`getent passwd $user | cut -d: -f6`
export XAUTHORITY=$userhome/.Xauthority
else
export XAUTHORITY=""
fi
}

for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
pid=`pgrep -u "MY USERNAME" gnome-screensav`
DBUS=`grep -z DBUS_SESSION_BUS_ADDRESS /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
###HERE RUN ANY PROGRAM WHICH WILL DISPLAY YOUR MESSAGE ###

(
echo "0" ; sleep 1
echo "# 10 Sec to Hibernate" ;
echo "10" ; sleep 1
echo "# 9 Sec to Hibernate" ;
echo "20" ; sleep 1
echo "# 8 Sec to Hibernate" ;
echo "30" ; sleep 1
echo "# 7 Sec to Hibernate" ;
echo "40" ; sleep 1
echo "# 6 Sec to Hibernate" ;
echo "50" ; sleep 1
echo "# 5 Sec to Hibernate" ;
echo "60" ; sleep 1
echo "# 4 Sec to Hibernate" ;
echo "70" ; sleep 1
echo "# 3 Sec to Hibernate" ;
echo "80" ; sleep 1
echo "# 2 Sec to Hibernate" ;
echo "90" ; sleep 1
echo "# 1 Sec to Hibernate" ;
echo "100" ; sleep 1
) |
zenity --progress \
--title="Hibernate" \
--auto-close \




if [ "$?" = 0 ] ; then
sh /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linuxa & sudo -u "MY USERNAME" gnome-screensaver-command --lock


fi



fi
done


I hope this would help anyone faces the same trouble as me.You have to replace "MY USERNAME" to your current login user name.This will give a 10sec countdown to hibernate before it does with the option of cancel button.It also locks the screen when it resumes from hibernate..

Saturday, January 10, 2009

USB ADSL modem in linux..(conexant and more...)

Thanks to these nice people it is really easy now.I used it and it works really well..
Im a newbee to Linux and it was a nightmare when I tried to get connected to internet through my access runner ADSL modem.I tried everything..Even things at sourceforge.net.& at the end I found this.. UbuDSL – configure your USB ADSL modem and connection easier than ever!

So here's the link.Have fun linux users..

http://www.ubudsl.com/en/start.php

Google