Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Place this in your ```~/.bash_aliases``` file.
zi() {
if [[ ! -z $1 ]]; then
steps=$1;
SIZE=`grep 'FontName' ~/.config/Terminal/terminalrc | cut -d' ' -f 2`
NEWSIZE=$((SIZE + steps))
REGEXPR='s/FontName.*/FontName=Monospace '$NEWSIZE'/g'
sed -i "$REGEXPR" ~/.config/Terminal/terminalrc
else
echo "Usage: zi [zoom steps]";
fi;
}
zo() {
if [[ ! -z $1 ]]; then
steps=$1;
SIZE=`grep 'FontName' ~/.config/Terminal/terminalrc | cut -d' ' -f 2`
NEWSIZE=$((SIZE - steps))
REGEXPR='s/FontName.*/FontName=Monospace '$NEWSIZE'/g'
sed -i "$REGEXPR" ~/.config/Terminal/terminalrc
else
echo "Usage: zi [zoom steps]";
fi;
}
z() {
if [[ ! -z $1 ]]; then
SIZE=$1;
REGEXPR='s/FontName.*/FontName=Monospace '$SIZE'/g'
sed -i "$REGEXPR" ~/.config/Terminal/terminalrc
else
echo "Usage: z [font size]"
fi;
}
@bbolker

This comment has been minimized.

Copy link

bbolker commented Jan 6, 2016

A slight tweak to the underlying code that allows for the font name to be something other than Monospace ... (with a fixed step of -2 in this case, but that's obviously easy to adapt)

#!/bin/bash
CONFIG=~/.config/xfce4/terminal/terminalrc
SIZE=`grep 'FontName' $CONFIG | awk '{print $NF}'`
NEWSIZE=$((SIZE - 2))
## echo "old size $SIZE, new size $NEWSIZE"
REGEXPR='s/FontName\(.*\)'$SIZE'$/FontName\1'$NEWSIZE'/g'
sed -i "$REGEXPR" $CONFIG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.