Drop-down or actually show-hide terminal

Originally published at: Drop-down or actually show-hide terminal - Mabox Linux notes

A drop-down terminal can be very handy sometimes. In Mabox, the default terminal emulator is Terminator, which does not have such functionality.

So I added a little wrapper – mabox-terminal – which is binded to the super-Enter key combination.

It’s not actually a drop-down terminal, it’s more of a show-hide.

There is a Terminator underneath so we have all its functionalities available like window splitting: Ctrl-Shift-O (vertically) Ctrl-Shift-E (horizontally). Use Alt-Arrow to move between terminals. F11 – toogle full screen.

This wrapper is a simple bash script – if you want to adapt it to your needs, just copy it to the ~/bin directory and edit it there:

cp /usr/bin/mabox-terminal ~/bin/

Wrapper script:

#!/bin/bash
# "Show-Hide" terminal wrapper for terminator for use with keybind eg. super + enter.
# Depending on actual state it will start, show or hide terminal window.

ID=$(wmctrl -x -l | grep mabox-terminal | awk ‘{print $1}’ | head -n 1)
if [ -z “${ID}” ]; then
TOP=$(wmctrl -d|grep “"|awk ‘{print $8}’|cut -d’,’ -f2)
LEFT=$[$(wmctrl -d|grep "
”|awk ‘{print $4}’|cut -d’x’ -f1)/8]
HEIGHT=$[$(wmctrl -d|grep “*”|awk ‘{print $4}’|cut -d’x’ -f2)/2]
WIDTH=$[${LEFT}*6]
terminator -T mabox-terminal -b --geometry “${WIDTH}x${HEIGHT}+${LEFT}+${TOP}”
else
ID_DEC=$((${ID}))
ACTIVE_WIN_DEC=$(xdotool getactivewindow)
if [ “${ACTIVE_WIN_DEC}” == “${ID_DEC}” ]; then
xdotool windowminimize ${ID_DEC}
else
xdotool windowactivate ${ID_DEC}
fi
fi

Dependencies: wmctrl and xdotool

I haven’t tested that, but it seems that the script can be easily adapted to the use of other terminals and not only in Mabox or OpenBox.

3 Likes

Amazing handy show-hide terminal…better than yakuake in Plasma. You keep doing maboxlinux rocking. :slight_smile:

1 Like

Useful for work, great job. I missed such a solution, and I didn’t like yakuake. :slight_smile:

1 Like

Nice ! It’s good to have this drop-*down possibility without to have to install another terminal.

1 Like

super+grave does not seems to work on my system (french keyboard). How can i change the key combination to use this script (by ex. i would like to bind this drop-down terminal to super+F1) ?

Try CTRL + Grave or Super + Enter (like it was previously binded).

If not works just edit ~/.config/openbox/rc.xml - look for mabox-terminal, something like that:

    <keybind key="C-grave">
      <action name="Execute">
        <command>mabox-terminal</command>
      </action>
    </keybind>

Replace keybind key= value.
Super + F1 should be written as W-F1.

http://openbox.org/wiki/Help:Bindings

You may also install GUI configurator lxhotkey.

1 Like

Thanks. CTRL + grave works well.