quake terminal improvements

master
Daniel Napora 2021-01-20 18:49:37 +01:00
parent 98412b3541
commit a3a6616f61
1 changed files with 29 additions and 2 deletions

View File

@ -4,13 +4,22 @@
# "Show-Hide" terminal wrapper for terminator for use with keybind eg. super + enter. # "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. # 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) GEOMETRY_FILE="$HOME/.config/mabox/.quake-term"
NAME="quake-term"
__run() {
ID=$(wmctrl -x -l | grep ${NAME} | awk '{print $1}' | head -n 1)
if [ -z "${ID}" ]; then if [ -z "${ID}" ]; then
if [ -f "$GEOMETRY_FILE" ]; then
POS=$(head -n 1 $GEOMETRY_FILE)
terminator -T ${NAME} -b --geometry "$POS"
else
TOP=$(wmctrl -d|grep "*"|awk '{print $8}'|cut -d',' -f2) TOP=$(wmctrl -d|grep "*"|awk '{print $8}'|cut -d',' -f2)
LEFT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)/8] LEFT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)/8]
HEIGHT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)/2] HEIGHT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)/2]
WIDTH=$[${LEFT}*6] WIDTH=$[${LEFT}*6]
terminator -T mabox-terminal -b --geometry "${WIDTH}x${HEIGHT}+${LEFT}+${TOP}" terminator -T ${NAME} -b --geometry "${WIDTH}x${HEIGHT}+${LEFT}+${TOP}"
fi
else else
ID_DEC=$((${ID})) ID_DEC=$((${ID}))
ACTIVE_WIN_DEC=$(xdotool getactivewindow) ACTIVE_WIN_DEC=$(xdotool getactivewindow)
@ -20,3 +29,21 @@ else
xdotool windowactivate ${ID_DEC} xdotool windowactivate ${ID_DEC}
fi fi
fi fi
}
__save() {
eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
echo "${WIDTH}x${HEIGHT}+${X}+${Y}" >> $GEOMETRY_FILE
}
__reset() {
rm -f $GEOMETRY_FILE
}
case "$1" in
save) __save;;
reset) __reset;;
*) __run;;
esac
exit 0