From fd59eaa7d80facbd23c14ad948811d2f247677fc Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Tue, 22 Sep 2020 23:01:19 +0200 Subject: [PATCH] import mabox-terminal terminator wrapper --- bin/mabox-terminal | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/mabox-terminal diff --git a/bin/mabox-terminal b/bin/mabox-terminal new file mode 100755 index 0000000..81b2df4 --- /dev/null +++ b/bin/mabox-terminal @@ -0,0 +1,22 @@ +#!/bin/bash + +# Author: Daniel Napora +# "Show-Hide" terminal wrapper for terminator for use with keybind eg. super + enter. +# Depenging 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}" -x "neofetch;/bin/bash" +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