Change cursor and couple of other settings in window managers like fluxbox and fvwm (except gnome and KDE)

First off, get cursor theme from here. You can download the one of your choice. Now create a directory \”~/.icons\” if it does not exist. Extract the file you just downloaded in this directory. [If you are using GNome then you could have dropped the tar file itself in the Desktop properties window and selected the theme from there. I have since the days of RH9 not used KDE and so am not sure how to do this in KDE, sorry guys.]

Ok, now the interesting part, to get the cursor theme working in your window manager, for that matter any window manager.

The resources in X windows are controlled and decorated by the RESOURCE_MANAGER (for the deeply interested in the internals of X Window, if the name is not appropriate, please excuse me and leave a comment and I will definitely correct it 🙂

So, we want to define our cursor for the X window itself and not depending on the window manager. So, we will create a \”~/.Xdefaults\” file for the same. Here is the content of the file:

Xcursor.theme: ComixCursors-Orange-Small-Slim

Here all the extracter files with the directory called cursors is located in ~/.icons/ComixCursors-Orange-Small-Slim and I want to use the cursors in that directory as my default cursor. Also note that the cursors are named according to the standards, so you do not need to select anything. Good to go now.

Wait, the cursors still do not work. 🙁

Oh well, we need to tell the xrdm, the manager to manage the resources of our changes. So let do it.

xrdb -merge ~/.Xdefaults

We could use, xrdb -load ~/.Xdefaults as well, but that is used to override settings rather than merge them and thus will avoid this for the time being.

Now, lets restart the WM alone and see the cursors in use. If the settings are for other windows like the XTerm or any other terminal or for emacs or so on, you do not need to anything other than invoking the client again, but for cursors, please re-start the window manager.

So, there are actually so many things that you can do with the xrdb that I can keep writing about it, but then there are already so many articles available on the net, why not just refer you to them.

Good Ref:

https://engineering.purdue.edu/ECN/Support/KB/Docs/UsingTheXdefaultsFil

http://fluxbox-wiki.org/index.php?title=Howto_setup_Xdefaults

Example: http://fluxbox-wiki.org/index.php?title=Howto_setup_Xdefaults

http://dotfiles.org/.Xdefaults

http://docs.hp.com/en/B1171-90076/ch05s03.html

http://wiki.archlinux.org/index.php/Xdefaults#Default_settings

http://www.tummy.com/journals/entries/jafo_20050120_180533

Break Free and let firefox remember all the passwords even the ones that are not saved by default

Here we go against one more security policy of most of the sites like Bank and paypal and so on. These sites do not allow Firefox or any other browser to save the password. This is using some tags in the html/code of the page that would mark the field as not completeable or savable. So, what do you do?

I am on a home computer to which no one has access so why not save the password!! Let do it. There are couple of hacks that have been found to make firefox remember all the passwords. Here are a few of them (but Linux is not covered in any of them).

Tweak Firefox’s Password Saver Without An Extension

Make Firefox Remember Passwords without a Bookmarklet

But if you are planning to do any of this, then make sure that you secure the saved passwords too. Here\’s how to do it:

Geek to Live: Secure your saved passwords in Firefox

Now for the Linux part, you have to follow the same trick as mentioned in the links above. So, you need to first locate the file \”nsLoginManager.js\”

The file in Linux is not part of the firefox package so its not easy to find it by looking at the contents of the firefox package, as you will not find it there. You need to run the below command to look at the contents of the xulrunner rpm by using the following command:

rpm -ql xulrunner|grep nsLogin

Once that is done you can simply follow the suggested approach in the links above that is search for the function \”

1
_isAutocompleteDisabled" and then change the return true in the if condition to return false and you are done.

Search & replace with find & ed

\"Computer
Image via Wikipedia

function sr() {

declare pattern replacement name usage
declare -i pvar=0 rvar=0 tvar=0

usage=\'usage: sr [-t ] [-n name] [-p pattern] [-r replacement] [-- ] [dir1 dir2 ...]\'

# cf. http://bsdpants.blogspot.com/2007/02/option-ize-your-shell-scripts.html

while [[ \"${1:0:1}\" == \'-\' ]] ; do

[[ \"${1}\" == \'--\' ]] && { shift; break; } # -- marks end of options

[[ ${#1} -ne 2 ]] && { echo \"${usage}\"; return 1; }

case \"${1:1:1}\" in
\'n\') name=\"${2}\"
shift 2 ;;
\'p\') pattern=\"${2}\"
pvar=1
shift 2 ;;
\'r\') replacement=\"${2}\"
rvar=1
shift 2 ;;
\'t\') tvar=1
shift ;;
*) echo \"${usage}\"
return 1 ;;
esac

done

if [[ $pvar -eq 0 ]] || [[ $rvar -eq 0 ]]; then
echo \'Both options -p and -r must be specified!\'
echo \"${usage}\"
return 1
fi

while read -d $\'\' fpath; do

if [[ -z \"$(/usr/bin/egrep -I -m1 \'^.\' \"${fpath}\")\" ]]; then # skip binary files
echo \"Binary file: ${fpath}\"
continue
fi

if [[ $tvar -eq 0 ]]; then # perform an actual search & replace

cat <<-EOF | /bin/ed -s \"${fpath}\"
H
g/${pattern}/s/${pattern}/${replacement}/g
wq
EOF

else # only simulate a search & replace and print the result to stdout

printf \"nn33[1m%s33[mnnn\" \"${fpath}\" # print the current file path

# delete all lines that do not contain a pattern match: v/...
# add a final trailing new line in case all lines got deleted: $a...
# do the matching: g/${pattern}/...
# insert \'#: \' at the beginning of each line: g/./s/(...

cat <<-EOF | /bin/ed -s \"${fpath}\"
H
v/${pattern}/d
$a

.
g/${pattern}/s/${pattern}/$(printf \"33[32m${replacement}33[m\")/g
g/./s/(.*)/#: 1/g
,p
EOF

fi

done < <(/usr/bin/find -x \"${@}\" -type f -name \"*${name}\" -not -empty -print0)

}

man ed | less -p \'REGULAR EXPRESSIONS\'

# test mode
sr -t -p hello -r world -n \".txt\" /path/to/dir | less -r

# actual search & replace without previous backup
sr -p hello -r world -n \".txt\" /path/to/dir

# backslash-escape the / character
sr -t -p \'/usr/local\' -r \'/opt/local\' /path/to/file

URL: http://snippets.dzone.com/posts/show/10695

\"Reblog