iso-profiles/mabox-en/desktop-overlay/etc/skel/bin/mabox-terminal

23 lines
794 B
Bash
Executable File

#!/bin/bash
# Author: Daniel Napora <napcok@gmail.com>
# "Show-Hide" terminal wrapper for terminator for use with keybind eg. super + enter.
# Depenging on actual state it 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