是否可以在 Openbox 中设置键绑定以在应用程序内打开的窗口之间切换?就像在 gnome 3 中使用 alt + [Tab 上方的键] 一样。
答案1
我用wmctrl实现了这个功能。
openbox的rc.xml中相关部分:
<keybind key="A-space">
<action name="execute">
<execute>wmctrl-switch-by-application</execute>
</action>
</keybind>
下面是 wmctrl-switch-by-application 中的代码:
# taken from https://unix.stackexchange.com/questions/26546/can-you-switch-between-windows-within-an-application-in-openbox
# taken from: http://www.st0ne.at/?q=node/58
# get id of the focused window
active_win_id=$(xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}')
# get window manager class of current window
win_class=$(wmctrl -x -l | grep $active_win_id | awk '{print $2 " " $3}' )
# get list of all windows matching with the class above
win_list=$(wmctrl -x -l | grep -- "$win_class" | awk '{print $1}' )
# get next window to focus on
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 [ -z "$switch_to" ];then
switch_to=$(echo $win_list | awk '{print $1}')
fi
# switch to window
wmctrl -i -a $switch_to
答案2
您可以在所有桌面的窗口之间切换,甚至包括桌面本身和面板,如开箱行动页面,但似乎无法在同一应用程序的窗口之间切换。
答案3
您可以通过按 Alt 和 Tab 键在任何打开的窗口或应用程序之间切换。即使有两个打开的同一程序的窗口。