Wednesday, January 31, 2007

Replacing xscreensaver with gnome-screensaver in Xfce

By default, xfce screensaver requires xscreensaver. You have the _option_ to remove xscreensaver using the following command (as privileged):

apt-get remove xscreensaver



To install the gnome-screensaver use the following command (as privileged):

apt-get install gnome-screensaver



To auto-start the gnome-screensaver, add it as an Autostarted Application:

Xfce menu > Settings > Autostarted Applications

The command for starting the gnome-screensaver daemon is:

gnome-screensaver



To be able to use the action button "Lock screen" to start gnome-screensaver immediately and lock your screen, modify the file /usr/bin/xflock4:

#xscreensaver-command -lock || xlock $*
gnome-screensaver-command --lock exit 0



Note that the original xscreensaver command is now commented. Backup the original copy of xflock4 (as privileged):

cp /usr/bin/xflock4 /usr/bin/xflock4.orig



Hope that helps.

If you have questions, post them at:
http://www.linuxquestions.org/questions/showthread.php?t=458516
and leave a comment.

Thursday, January 25, 2007

File renaming in BASH via string handling

#!/bin/bash

#remove spaces
for i in *.wma; do
mv "$i" `echo $i | tr ' ' '_'`;
done

#remove uppercase
for i in *.[Ww][Mm][Aa]; do
mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`;
done

#convert file names
for i in *.wma; do
mv "$i" "`basename "$i" .wma`.mp3";
done

#rename test1a, test2a, test3a
#to t1a, t2a, t3a
for i in test*a; do
substring1=${i:0:1}
substring2=${i:4:1}
mv $i $substring1$substring2'a'
done;