Igo*_*bia 4 linux window-managers focus keyboard-shortcuts console-application
我正在配置xbindkeys来使用快捷方式更改窗口焦点。例如,我设法创建了一个快捷方式来专注于一个应用程序窗口,比如说一个终结器窗口:
wmctrl -xa terminator
Run Code Online (Sandbox Code Playgroud)
不幸的是,它总是聚焦在相同的终结器窗口上,使我无法在终结器窗口中循环。
您能否建议我将命令集中在终结器窗口上,如果再次按下,将在所有终结器窗口中循环显示吗?
更新2013年3月30日
我修改了此脚本 http://lars.st0ne.at/blog/switch%20between%20windows%20within%20the%20same%20application, 以使脚本
script.sh NAME
Run Code Online (Sandbox Code Playgroud)
关注NAME应用程序,或者在NAME的所有窗口中循环浏览(如果某个窗口已经聚焦),但是无法正常工作。
这是脚本
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}')
# 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
Run Code Online (Sandbox Code Playgroud)
该脚本确实专注于应用程序的窗口,并在它们之间循环,直到到达窗口为止,我猜这是最后一个创建的窗口。那时,骑车不再起作用。
如果没有窗口具有焦点,我在脚本中发现了问题。
可以尝试以下修改后的脚本:
#!/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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1317 次 |
最近记录: |