GNU/Linux >> Linux の 問題 >  >> Linux

wmcrtl を使用して同じアプリケーションのウィンドウを切り替える

どのウィンドウにもフォーカスがない場合、スクリプトに問題があることがわかりました。

次の変更されたスクリプトを試していただけますか:

#!/bin/bash
win_class=$1 # 'terminator' # $1

# get list of all windows matching with the class above
win_list=$(wmctrl -x -l | grep -i $win_class | awk '{print $1}' )

# get id of the focused window
active_win_id=$(xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}')
if [ "$active_win_id" == "0" ]; then
    active_win_id=""
fi

# get next window to focus on, removing id active
switch_to=$(echo $win_list | sed s/.*$active_win_id// | awk '{print $1}')

# if the current window is the last in the list ... take the first one
if [ "$switch_to" == '' ];then
   switch_to=$(echo $win_list | awk '{print $1}')
fi

# switch to window
wmctrl -i -a $switch_to

Linux
  1. Bashの完了が代替案を循環することは可能ですか?

  2. Windowsで管理者ユーザーを無効にする

  3. Linuxでcpを使用するときに「同じファイルです」という警告メッセージを回避するにはどうすればよいですか?

  1. Linuxでprocファイルシステムを使用してトラブルシューティングする

  2. 最後にWindowsを使用したのはいつですか。

  3. 同じコンピュータ上の 2 つの異なる OS 間でファイルを共有することはできますか?

  1. Sshを介して複数のサーバーで同じスクリプトを実行しますか?

  2. WindowsとUbuntuの両方を同時に実行しますか?

  3. Linux Mint Mate で Windows キーでキーボード ショートカットを使用する