Mar 7, 2011


First of all I'd like to apologize for the recent inactivity. I promise that I'll keep updating this blog as often as time allows.
Now, here is a simple function for extracting archives depending on their file type.
I did not write this function myself and all credit goes to Vincent, Milomouse.

# extract archive with preferred options:
function extr {
if [[ -f $1 ]]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*.xz) unxz -vk $1 ;;
*.lzma) unlzma -vk $1 ;;
*) print "'$1' cannot be extracted via extr()" ;;
print "'$1' is not a valid file"

Add the following to your .zshrc to be able to use the function:
(Don't forget to replace '.zsh' and 'funcs' with your own dir/filename)
# source external configuration files:
for i in ${ZDOTDIR}/funcs; do
. $i || { print "$i: cannnot source file" }

All done! Whenever you wish to extract an archive just type "extr /path/to/archive" without the quotes ofcourse.

Feb 21, 2011


Ratpoison doesn't always handle windows/frames/applications the way I want it to. One example is mplayer playing files with a lower resolution than the actual screen which results in transparent borders around the player. To fix this i wrote a quick and dirty script in zsh that uses ratpoisons built in tmpwm-command to launch mplayer in another window manager.
The script is written with my folder hierarchy in mind so you might want to change the affected lines or you could add something like:
# Choose folder that contains videofolders
echo -e "vidfolder:\\n"
PS3='viddir: '
And then replace the "~/media/video/" with $VIDDIR

The following script is nowhere near perfect so feel free to post improvments

## details: play mplayer videos in tmpwm
## depend: ratpoison + ls + mplayer

# Choose temporary WM. Must be a valid and installed WM
echo -e "Enter tmpwm of choice:\\n"
PS3='wm: '
read WM

# Select video folder from a list
echo -e "FOLDERS:\\n"
PS3='Select a folder: '
"; select FOLDER in `ls ~/media/video`
"; cd ~/media/video/$FOLDER

# Break, otherwise endless loop
done; IFS=${OLD_IFS}

# Select a file in $FOLDER to play
echo -e "FILES:\\n"
PS3='Select a file: '
# Opens the selected file in Mplayer under $WM and kills the temporary wm when mplayer exits
select FILE in `ls ~/media/video/$FOLDER`
`ratpoison -c "tmpwm $WM" & mplayer -fs ~/media/video/$FOLDER/$FILE && killall $WM`

# Break, otherwise endless loop

exit 0

Feb 16, 2011


I discovered ratmenu a while back and have been using it ever since.
Here's the script i use to launch it:


ratmenu -font 6x12 -fg "#444" -align center -style dreary \
"ratpoisonrc" "ratpoison -c 'exec urxvt -e vim $HOME/.ratpoisonrc'" \
"ncmpcpp" "ratpoison -c 'exec urxvt -e ncmpcpp'" \
"mail" "ratpoison -c 'exec urxvt -e mutt'" \
"color" "ratpoison -c 'exec zenity --color-selection'" \
"top" "ratpoison -c 'echo $(top -b -n 1 | head -n 24)'" \
"battery" "ratpoison -c 'echo $(cat /proc/acpi/battery/BAT0/state)'" \
"dmesg" "ratpoison -c 'echo $(dmesg | tail)'" \

As this is a shell script it can be written on a single line or in multiple lines as above. If you decide to write it in multiple lines don't forget to separate them with backslashes so that the script is read by the shell as a single line. No backslash on the last line.
The first line is, of course, the shebang. The next line runs ratmenu with the fixed-medium-semicondensed font. I have the menu set up with gray text on a black background.
Lines 3 -9:
> Opens my ratpoison configuration file in vim for quick editing.
> Launches ncmpcpp (music player) in a terminal
> Launches mutt (mail client) in a terminal
> Uses zenity to display a colorpicker. I use this when editing my .Xdefaults and such.
> Pipes top (system information summary) to the ratpoison message area
> Pipes battery information to the ratpoison message area
> Prints the message buffer of the kernel in the ratpoison message area

Feb 13, 2011

karnal pernic

I got my very first kernel panic today due to a failing harddrive. Luckily it did only hold my /home and I always keep backups so it was no biggie but I thought I'd share the info anyways.

Feb 10, 2011

Rodents be gone

I've been using the ratpoison wm for a while now. Thought I'd share a screen and my .ratpoisonrc.

# -- $HOME/.ratpoisonrc -- #

# Unmanaged windows
#unmanage Nitrogen

# Borders, fonts, padding, etc
set padding 0 13 0 0 # 13 px gap on top to make room for conky piped to dzen2
set border 1
set barborder 1
set barpadding 0 0
set bargravity ne
set inputwidth 400
set wingravity c
set transgravity se
set maxsizegravity c
set font fixed-6
set winfmt %n %s %ti

# Set the ctrl-t key to something easier
definekey top Insert readkey root
definekey root Insert link less

# Color
set fgcolor #876CBE
set bgcolor #090909

# Name frames
set winname class
# title
# name
# Keybindings
bind Delete exec xlock
bind F11 exec jumanji
bind F10 exec pcmanfm
bind C exec urxvt -e tmux
bind c exec urxvt
bind Print exec import -window root ~/media/pics/scrot/$(date +%Y_%m_%d-%H%M).png
bind R restart
bind l windows
bind n curframe
bind q remove
bind t title
bind u undo
bind y redo
bind x info
bind o only
definekey top M-a exchangeleft
definekey top M-s exchangedown
definekey top M-w exchangeup
definekey top M-d exchangeright

# Numpad numbers work to select window
bind KP_0 select 0
bind KP_1 select 1
bind KP_2 select 2
bind KP_3 select 3
bind KP_4 select 4
bind KP_5 select 5
bind KP_6 select 6
bind KP_7 select 7
bind KP_8 select 8
bind KP_9 select 9

# Switch between workspaces
definekey top F1 rpws1
definekey top F2 rpws2
definekey top F3 rpws3
definekey top F4 rpws4
exec rpws init 4 -k

Apr 28, 2010


Laserjesus på språng.

Apr 24, 2010