I would like a drop down terminal which drops down when I move the mouse to the top (or bottom, left, right), similar to how the panel can be configured to auto-hide and only drop down or pop up if the mouse hovers to the border where it is.

Currently I only found a method using shortcuts e.g. F12 to bind to e.g. xfce4-terminal --drop-down.

I'm using XFCE 4.12, but I'm not particularly fixed to XFCE or xfce4-terminal, so if some other desktop or terminal supports this, it would also help.


You can do something like this with xdotool. For example,

xdotool behave_screen_edge top search --name mywindowname windowactivate

will continuously monitor mouse movement and when at the top of the screen it will search for a window named mywindowname and cause it to be visible, depending on your window manager.

| improve this answer | |

Building on top of @meuh's answer I came up with the attached script. Here are the features:

  • Spawns five terminals two each left and right and one on the top
  • Terminals are initially minimized and set active if cursor hits border inside the terminal height / width, disappears if window is active and border hit again


  • I found the behavior of behave_screen_edge weird at times. It seems to ignore many cases. This is quite unsatisfactory.
  • Also there is no fancy drop/slide in animation. I tried windowmove in a loop, but a bash loop is too slow, to look good.

The script:

# 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]+) .*|\1|p')
getBorderWidth() {
    # https://github.com/jordansissel/xdotool/issues/115
    local X Y X0 Y0
    eval $(xdotool getwindowgeometry --shell $1 | command grep '[XY]=')
    xdotool windowmove --relative $1 0 0
    eval $(xdotool getwindowgeometry --shell $1)
    xdotool windowmove $1 $((X0-bw)) $((Y0-bh))

cat > "$script" <<"EOF"

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

# 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))    ; ;;

# 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

# 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; ;;

#actually move and activate window and hide it, if it already is active
if [ $wid == $(xdotool getactivewindow) ]; then
    xdotool windowminimize $wid
    xdotool windowmove $wid $x $y windowactivate $wid
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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.