Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to set up a keybinding in Openbox for switching between open windows within an application? Just like you can in gnome 3 with alt + [key above Tab] .

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

I have implemented this function by using wmctrl.

The relevant part in rc.xml of openbox:

<keybind key="A-space">
  <action name="execute">
    <execute>wmctrl-switch-by-application</execute>
  </action>
</keybind>

below is the code in wmctrl-switch-by-application:

# 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 [ "$switch_to" == '' ];then
   switch_to=$(echo $win_list | awk '{print $1}')
fi

# switch to window
wmctrl -i -a $switch_to
share|improve this answer
add comment

You can switch among windows of all desktops, or even include the desktop itself and panels, as described in the Openbox Actions page, but there seem to be no way to switch among windows of the same application.

share|improve this answer
add comment

You can switch between any open window or application by pressing alt and tab. Even if there are two open windows of the same program.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.