Dave Heinemann

Toggle Ratpoison's Padding

As mentioned earlier, I've been using the RatPoison window manager, along with Trayer for my tray applets. By telling RatPoison to give give it 26px of space and not manage it directly (see my .ratpoisonrc below), they both work flawlessly together. However, other applications don't play so nicely with them.

The problem seems to lie with applications with unusual fullscreen modes. For example, YouTube's fullscreen videos appear underneath Trayer, obscuring the video controls at the bottom. Some fullscreen Wine games may correctly display above Trayer, but have graphical glitches in its 26px padded area, and do not allow mouse interaction there.

Unable to find a simpler solution, I wrote a small Bash script to toggle both Trayer and RatPoison's padding. When run, it checks to see if Trayer is running; if so, it kills it and removes RatPoison's padding. If not, it resets RatPoison's padding and restarts Trayer. This works quite well, can easily be bound to a RatPoison key combination (I use 'p' (i.e. ctrl+t, p)), and doesn't affect any running tray applets, allowing the padding to be toggled as needed.

.rpPaddingToggle

#!/bin/bash
#Toggle RatPoison's padding
if ps ax | grep -v grep | grep trayer > /dev/null
then
#If Trayer is running, kill it and remove RatPoison's padding.
killall trayer
ratpoison -c "set padding 0 0 0 0"
else
#Otherwise, reset the padding to normal and restart Trayer.
ratpoison -c "set padding 0 0 0 26"
trayer &
fi

.ratpoisonrc

#Trayer
unmanage panel
set padding 0 0 0 26
exec trayer

#Tray apps
exec wicd-gtk
exec xfce4-power-manager
exec volumeicon
exec SpiderOak

#Bindings
bind c exec roxterm
bind b exec firefox
bind i exec xchat
bind e exec thunderbird
bind p exec ~/.rpPaddingToggle.sh
bind P exec keepass

#Use j & k to switch windows, h & l to switch focus
definekey top M-j next
definekey top M-k prev
definekey top M-h focuslast
definekey top M-l focus
Slackware screenshot

#Linux #Slackware