Quake like terminal emulator(not quite what you think)

Everyone who has used the GNU/Linux terminal knows it is a force to be reckoned with. However, it’s a pain to have to launch a terminal emulator wait for a it to load, and then have to keep Alt-Tabbing to it. That's why quake like terminal emulators exists. For those of you who don't know what a quake like terminal is, let's clear it up first. Quake is a popular first person shooter created by id software. In the game, there is a terminal that is accessible by hitting the ~ key. It is used for editing settings and variables(like changing the gravity variable so you can jump 20-30 feet high or jump & never come down by setting it to zero…) and cheats.

So basically what we want is to pop up a terminal at a press of a button & when we press the same button again, hide the terminal. Now, there are many terminal emulators are developed to just do that. Tilda and YaKuake to name a few. I was using Tilda until a few days when I decided to trim the fat from my system. Now tilda isn't very heavy on resources or anything but installing 2 terminal emulator excluding xterm seemed like a waste, so just for the heck of it I removed Tilda. As my other terminal I was using xfce4's terminal emulator Terminal. So I decided to get the same functionality with the Terminal.

So here's what I did.
I installed wmctrl utility that controls windows from command line & then wrote a little script, & saved it to ~/scripts/terminal.sh

#! /bin/bash
#title of the window you want to show/hide
TITLE="Terminal"
#application name
APP=terminal

#List all applications
if [ “`wmctrl -l | grep -c “$TITLE”`” = “0” ]
then
#start the application if it is not already running
$APP &
else
#if the application is running, determine if we should show or hide the window
if [ “`xwininfo -int -id $(xdotool getactivewindow) | grep 'Window id' | grep -c “$TITLE”`” = “0” ]
then
# show the window
wmctrl -R “$TITLE”
else
# hide the window
wmctrl -r “$TITLE” -b add,hidden
fi
fi;

& then in openbox's configuration which is located at ~/.config/openbox/rc.xml I added this in the keyboard section.

So now whenever I press the Menu key(the one that pops up right click menu), the script gets executed. Which the Terminal is not running then it runs Terminal, if it is runnning it decides if it has focus or not & then acts accordingly.

So that's what I did. This way you can get quake like functionality in the terminal emulator of your choice. If you want to use any other terminal you just need to change the variable TITLE and APP in the script. So, for example if you want to use sakura terminal, do TITLE=”sakura” & APP=sakura & you're all set.