マウスがデスクトップ上部の境界線をクリックすると、端末を下に引きます。

マウスがデスクトップ上部の境界線をクリックすると、端末を下に引きます。

マウスを上(または下、左、右)に動かすときは、ドロップダウンターミナルが必要です。これは、自動非表示パネルを設定し、マウスオーバー時にのみドロップダウンするか、パネルがある境界までドロップダウンするように設定するのと似ています。

今までちょうど1つ見つけました。方法たとえば、ショートカットを使用して、F12たとえばxfce4-terminal --drop-down

XFCE 4.12を使用していますが、XFCEやXFCEに特に固定されているわけではないxfce4-terminalので、他のデスクトップや端末でこの機能をサポートすると便利です。

答え1

を使用すると、このようなことができますxdotool。例えば、

xdotool behave_screen_edge top search --name mywindowname windowactivate

マウスの動きは継続的に監視され、画面の上部で次の名前のウィンドウを検索します。私のウィンドウ名ウィンドウマネージャによって表示されるようにします。

答え2

@meuhさんの回答に基づいて添付されたスクリプトを思いつきました。その機能は次のとおりです。

  • 両側に2つずつ、上部に1つずつ合計5つの端末を生成します。
  • カーソルが端末の高さ/幅内の境界線に触れると、端末は最初に最小化され、アクティブに設定され、ウィンドウがアクティブになり、境界に再び触れると端末が消えます。

メモ:

  • behave_screen_edge私は時々その行動が奇妙だと思います。無視される状況が多いようです。これは非常に不満足です。
  • アニメーションにも素晴らしいドロップ/スライドはありません。ループを試してみましたが、windowmovebashループが遅すぎてビューにも適していません。

スクリプト:

#!/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]+) .*|\1|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

関連情報