Any way to open windows from the windows bar using a shortcut

Any way to open windows from the windows bar using a shortcut? for example to open the first window on the left Ctrl+1, to open the second window on the left Ctrl+2.

Im using xfce4 at this moment, but if under xfce4 is not possible, is there any other desktop environment that permits this?

Since I have several windows open for the same application, I not searching for sortcuts related to the application but as I say below, to the window.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

With a little script and a small surgery on your system, it can be arranged exactly as you describe.


  1. wmctrl; it possibly needs to be installed.
  2. The script below
  3. xprop, to get the window properties. This is already installed on your system.
  4. Settings changes in xfce panel settings
  5. Additional keyboard shortcuts

How to set up

  • Install wmctrl:

    sudo apt-get install wmctrl
  • Create a directory ~/bin (/home/<yourname>/bin). Copy the script below into an empty file, save it as panel_navigate (no extension) in ~/bin and make it executable.

  • Change panel settings:
    Go to Settings Manager > “Panel” > “Items” (tab) > “Window Buttons” >

    • “Sorting order” > Choose: Timestamp
    • “Window Grouping” > Choose: “Never”
    • Make sure “Show windows from all workspaces or viewports” is unticked

    enter image description here

  • Add Keyboard shortcuts:
    go to Settings Manager > “Keyboard” > “Application Shortcuts”, choose “Add”. Add the command:

    panel_navigate 1

    Set it to the key combination Ctrl+1

    enter image description here

  • Now you can choose:

    • to repeat this procedure to add panel_navigate 2 under Ctrl+2 and so on (until 9)

    (save option) or (if you are not afraid to edit config files manually):

    • you can edit the file:


      in which the keyboard shortcuts (in xfce) are stored. Open the file with mousepad and look for a line like:

      <property name="&lt;Primary&gt;1" type="string" value="panel_navigate 1"/>

      Copy the line, paste it on the next line (insert) and change both occurrences of 1 into 2, so you’ll get:

      <property name="&lt;Primary&gt;1" type="string" value="panel_navigate 1"/>
      <property name="&lt;Primary&gt;2" type="string" value="panel_navigate 2"/>

    and so on..

    Make sure the indent is exactly the same. Repeat the procedure until 9.

Log out and back in and it should work:


enter image description here


enter image description here

And so on…

The script

#!/usr/bin/env python3

import subprocess
import sys

def get_value(command):
    return subprocess.check_output(["/bin/bash", "-c", command]).decode("utf-8").strip()

def run_command(command):
    subprocess.Popen(["/bin/bash", "-c", command])

current_workspace = [l for l in get_value("wmctrl -d").splitlines() if l.split(" ")[2] == "*"][0][0]
wlist_ids = [item.split()[0:4] for item in get_value("wmctrl -l").splitlines()]
relevant = [item for item in wlist_ids if item[1] == current_workspace]
panel = []
for item in relevant:
    data = get_value("xprop -id "+item[0])
    if ("_TYPE_NORMAL" in data, "TYPE_DIALOG" in data).count(True) == 1:
    window = panel[int(sys.argv[1])-1][0]
    run_command("wmctrl -ia "+window)
except IndexError:


The solution is an opportunistic one. It occurred to me that the windowlist, called by the command wmcrl -l, is ordered by the age of the windows. By making the xfce panel do the same (settings), both orders are corresponding perfectly. What the script does is creating a window list, filtering out the “real”, visible windows (with xprop) and switch to a chosen window by the command panel_navigate, with the number of the window (from the left to the right) as an agrument.


I noticed one exception: the IDLE (python interpreter) windows have pid 0 and their properties can not be “researched” by xprop. The windows do not appear in the windowlist and are skipped by the script.


Although the Key combination Ctrl+<number> didn’t raise any errors while testing, it might conflict with some applications. It might be safer to choose (e.g.)

Solution 2

Not sure for the same application, but in Unity you can switch applications with super+number, as for example, super + 1 = first item on the launcher, super + 2 = the second item of the launcher, super + n = the nth item of the launcher. This also helps to open any item placed on the launcher, like if nautilus is the first item of the launcher, super + 1 will open up nautilus file manager.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply