Construindo sobre a resposta do @ meuh, eu criei o script em anexo. Aqui estão os recursos:
- Gera cinco terminais dois, cada um à esquerda e à direita, e um no topo
- Os terminais são inicialmente minimizados e ativados se o cursor atingir a borda dentro da altura / largura do terminal, desaparecer se a janela estiver ativa e a borda for atingida novamente
Notas:
- Eu encontrei o comportamento de
behave_screen_edge
estranho às vezes. Parece ignorar muitos casos. Isso é bastante insatisfatório.
- Também não há queda / slide de fantasia em animação. Eu tentei
windowmove
em um loop, mas um loop bash é muito lento, para ter uma boa aparência.
O script:
#!/bin/bash
# spawn drop in terminals
getLastWid() {
sleep 0.4s
wid=$(wmctrl -lp | 'grep' " Terminal " | awk '{print strtonum($1),$0;}' |
'sort' -n | 'tail' -1 | 'sed' -nE 's|^([0-9a-f]+) .*||p')
}
getBorderWidth() {
# https://github.com/jordansissel/xdotool/issues/115
local X Y X0 Y0
eval $(xdotool getwindowgeometry --shell $1 | command grep '[XY]=')
X0=$X
Y0=$Y
xdotool windowmove --relative $1 0 0
eval $(xdotool getwindowgeometry --shell $1)
bw=$((X-X0))
bh=$((Y-Y0))
xdotool windowmove $1 $((X0-bw)) $((Y0-bh))
}
script=$(mktemp)
cat > "$script" <<"EOF"
#!/bin/bash
sw=1920 # screen width
sh=1080 # screen height
ph=35 # panel height (assumed it is at the bottom)
script=$0; pos=$1; wid=$2; bw=$3; bh=$4; firstUse=$5
# test if window is still open, if not close xdotool
if ! wmctrl -lp | 'grep' -q -i "$(echo "obase=16;$wid" | bc)"; then
pkill -i -f "xdotool behave_screen_edge.*$wid"
exit 1
fi
# choose target coordinates, where to move window and also to manually evalute clicks
eval $(xdotool getwindowgeometry --shell $wid) # sets HEIGHT, WIDTH
ww=$((WIDTH+bw/2)) # window width
wh=$((HEIGHT+bh/2+bw/2)) # window height
case $pos in
left1) x=0; y=$((sh-ph-wh-1-wh)) ; ;;
left2) x=0; y=$((sh-ph-wh-1)) ; ;;
top) x=$((sw/2-ww/2)); y=0 ; ;;
right1) x=$((sw-ww)); y=$((sh-ph-wh-1-wh)) ; ;;
right2) x=$((sw-ww)); y=$((sh-ph-wh-1)) ; ;;
esac
# on first use only move windows to their correct positions and hide them
if [ ! -z "$firstUse" ] && [ $firstUse == 1 ]; then
xdotool behave_screen_edge ${pos%*[0-9]} exec "$script" $pos $wid $bw $bh &
xdotool windowminimize $wid windowmove $wid $x $y
exit 0
fi
# evaluate mouse location now and exit if not correct
eval $(xdotool getmouselocation --shell | command grep '[XY]=')
case $pos in
left1|left2) if [ $Y -lt $y ] || [ $Y -ge $((y+HEIGHT)) ]; then exit; fi; ;;
right1|right2) if [ $Y -lt $y ] || [ $Y -ge $((y+HEIGHT)) ]; then exit; fi; ;;
top) if [ $X -lt $x ] || [ $X -ge $((x+WIDTH )) ]; then exit; fi; ;;
esac
#actually move and activate window and hide it, if it already is active
if [ $wid == $(xdotool getactivewindow) ]; then
xdotool windowminimize $wid
else
xdotool windowmove $wid $x $y windowactivate $wid
fi
EOF
chmod u+x "$script"
xfce4-terminal --working-directory="$HOME" & getLastWid && getBorderWidth $wid && "$script" left1 $wid $bw $bh 1
xfce4-terminal --working-directory="$HOME" & getLastWid && "$script" left2 $wid $bw $bh 1
xfce4-terminal --working-directory="$HOME" & getLastWid && "$script" right1 $wid $bw $bh 1
xfce4-terminal --working-directory="$HOME" & getLastWid && "$script" right2 $wid $bw $bh 1
xfce4-terminal --working-directory="$HOME" & getLastWid && "$script" top $wid $bw $bh 1