シェルスクリプトのウィンドウの最小化と上昇

シェルスクリプトのウィンドウの最小化と上昇

GUIを使用してLinuxシステムでインターネット速度を確認するスクリプトを実行しようとしています。端末ウィンドウを閉じてクエリが完了すると、ウィンドウは応答を提供します。今は窓を下げることはできますが、上げることはできません。

    #!/bin/bash
    xdotool getactivewindow windowminimize
    #xdotool set_window --name speedy
    #xdotool set_window --icon-name speedy
    speedtest-cli --simple

    if [ $? -eq 0 ]
    then
    #xdotool windowactivate speedy
    xdotool windowfocus  #speedy
    xdotool key "F11"
    fi

    exec $SHELL

ベストアンサー1

xdotoolすべてのタスクのウィンドウIDを知る必要があります。これを正しく使用してgetactivewindowコマンドのウィンドウを取得しますが、windowminimize名前を設定するにはこの操作も実行する必要があります。だから

xdotool getactivewindow set_window --name speedy

ラインを最小化する前に。

searchその後、それを使用して後でアクティブにしたときに見つけることができます。

xdotool search --name speedy windowactivate

マンページのセクションを参照してください。ウィンドウスタックそして命令体系すべてがどのように機能するかを説明します。

フルスクリプト:

#!/bin/bash
# rename the window for finding it again later
xdotool getactivewindow set_window --name speedy
xdotool search --name speedy windowminimize

speedtest-cli --simple

if [ $? -eq 0 ]
then
  xdotool search --name speedy windowactivate
  xdotool key "F11"
fi

おすすめ記事