import mabox-terminal terminator wrapper

master
Daniel Napora 2020-09-22 23:01:19 +02:00
parent 80acd45dc7
commit fd59eaa7d8
1 changed files with 22 additions and 0 deletions

22
bin/mabox-terminal 100755
View File

@ -0,0 +1,22 @@
#!/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 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