Skip to content

Instantly share code, notes, and snippets.

@pete
Created October 19, 2010 04:02
Show Gist options
  • Select an option

  • Save pete/633579 to your computer and use it in GitHub Desktop.

Select an option

Save pete/633579 to your computer and use it in GitHub Desktop.
# These are the defaults that you're likely to want to change. They can be set
# in your environment as well. It's just shell, so you can do arbitrary things
# here if you want.
ptfontsize=16
ptdim=158x20
ptfg='#FFEDB3'
ptbg='#262C42'
ptbindkey=F23
#!/bin/sh
# Executive summary: guake/tilda/kuake-like terminal using urxvt, wrapped by
# this script.
#
# It's not exactly clean, but it is useful. Basically, it is a wrapper for
# urxvt's kuake Perl script that allows you to have a terminal that pops on and
# off the screen on a keypress. It is somewhat me-specific, but it will
# recognize some environment variables, will try to source ~/.poptermrc, and
# should be easy to modify to make it you-specific (or more general).
#
# There are a small number of pop-down terminals available; I've never been able
# to get most of them to compile, and the one that does work for me, tilda,
# segfaults from time to time, some of the features don't work, and it's a lot
# slower than urxvt. (On the other hand, urxvt sometimes fails to render some
# unicode characters; I don't know which fonts support them, thus the
# add-sundry-fonts loop.)
#
# The reason I wanted this script to begin with is that I like the popdown
# terminal to take up the upper quarter or third of the screen, to take up the
# entire width except that taken up by gkrellm, to have a larger font, and to be
# visually distinct from the other terminals on my screen (which are #fff8e0 on
# #000008). The reason for ~/.poptermrc is that I want to be able to tweak it
# on individual machines. And, lastly, the reason I used tilda for so long is
# that I didn't know this functionality shipped with rxvt-unicode. (Read the
# script that they use to implement it. It's, like, 30 lines or so. I love
# urxvt.)
unset STY
if [ -f "$HOME/.poptermrc" ]; then
source "$HOME/.poptermrc"
fi
bindkey=$ptbindkey
if [ -z "$ptbindkey" ]; then
bindkey=F23
fi
dim=$ptdim
if [ -z "$ptdim" ]; then
dim=158x20
fi
boldweight="$ptboldweight"
if [ -z "$boldweight" ]; then
boldweight="$ptboldweight"
fi
CMD="$@"
if [ -z "$@" ]; then
CMD="screen -D -RR tilda"
fi
fontsize="$ptfontsize"
if [ -z "$ptfontsize" ]; then
fontsize=20
fi
boldsize=`echo "$fontsize 2 + p" | dc`
boldweight="$ptboldweight"
if [ -z "$ptboldweight" ]; then
boldweight=280
fi
if [ -z "$ptfg" ]; then
ptfg='#FFEDB3'
fi
if [ -z "$ptbg" ]; then
ptbg='#262C42'
fi
fnstr="xft:Luxi Mono:pixelsize=$fontsize"
fbstr="xft:Luxi Mono:pixelsize=$boldsize:weight=$boldweight"
for fn in 'Liberation Mono' 'Bitstream Vera Sans Mono' 'Monospace' 'Terminal' \
'Fixed' 'Andale Mono' 'Terminus' 'DejaVu Sans Mono'; do
fnstr="$fnstr,xft:$fn:pixelsize=$fontsize"
fbstr="$fbstr,xft:$fn:pixelsize=$boldsize:weight=$boldweight"
done
exec urxvt \
-pe "kuake<$bindkey>" -b 0 -w 0 -bl \
-geometry "$dim"+0+0 \
-fg "$ptfg" -bg "$ptbg" \
-lsp -1 -letsp -1 \
-title kuake \
-fn "$fnstr" -fb "$fbstr" \
-e $CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment