The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

application switcher?

asked 2013-03-02 16:35:59 +0000

thuswa gravatar image

I find my self lost among all workspaces and application windows. Is there an application switcher that can be used with i3? Or is there a way to get something similar. All I want is a list of the active application widows which I can tab through to switch to the window i want to go to next.



edit retag flag offensive close merge delete


awesome question!

bruno.braga gravatar imagebruno.braga ( 2013-03-04 14:02:11 +0000 )edit

6 answers

Sort by ยป oldest newest most voted

answered 2013-03-02 17:40:52 +0000

lkraav gravatar image

Not sure if this isn't a duplicate of my question:

Anyway, the i3-py solution there works great for me.

edit flag offensive delete link more

answered 2013-03-04 02:25:12 +0000

Mario Sandler gravatar image
echo -ne "i3-ipc\x0\x0\x0\x0\x4\x0\x0\x0" | 
    socat STDIO UNIX-CLIENT:`i3 --get-socketpath` | 
    tail -c +15 |
    sed -e 's/"id":/\n"id":/g' | 
    sed -ne 's/.*"name":"\([^"]\+\)".*"window":\([0-9]\+\).*/\1 \2/p' |
    dmenu -i -l 7 -b |
    sed -ne 's/.* \([0-9]*\)/[id=\1] focus/p' |
    (read cmd; i3-msg "$cmd")
edit flag offensive delete link more


neat... but neither this nor the simpleswitcher can grab a window from scratchpad... (not sure how should be the behaviour though)... they are in the list, but nothing happens.

bruno.braga gravatar imagebruno.braga ( 2013-03-04 14:03:19 +0000 )edit

Parsing JSON in shell is really fugly and fragile. I recommend not using this solution (or any other shell solution).

Michael gravatar imageMichael ( 2013-03-05 10:37:28 +0000 )edit

yes that one was a joke. i'm currently using this

Mario Sandler gravatar imageMario Sandler ( 2013-03-13 13:31:14 +0000 )edit

answered 2015-06-08 21:50:51 +0000

chilicuil gravatar image

I reworked Rasi solution to avoid python and bash, it behaves exactly the same but with less dependencies (dmenu and sh)

edit flag offensive delete link more

answered 2014-05-10 17:54:45 +0000

sml gravatar image

updated 2014-05-10 17:56:39 +0000

I'm using a ruby script, with this map:

bindsym $mod+g exec ~/.i3/window-jump

The advantages of this script are that it only requires dmenu, finds windows in the scratch space, and focuses by unique ID rather than title.

require 'json'

# recursively walk tree to find all containers
# return an array of names followed by [id]
def get_containers tree
    containers = []
    # try to return only useful containers
    if (tree['nodes']+tree['floating_nodes']).empty? && tree['type'] == 2 &&
        !(tree['name'] =~ /^i3bar for output/)
        containers << tree['name'] + " [#{tree['id']}]"
    (tree['nodes'] + tree['floating_nodes']).each do |node|
        containers += get_containers(node)

IO.popen(['dmenu', '-i', '-p', 'window jump'], 'r+') do |dmenu|
    dmenu.puts(get_containers(JSON.load(`i3-msg -t get_tree`)))
    id =\[|\]/).last
    exec "i3-msg [con_id=#{id}] focus"
edit flag offensive delete link more

answered 2013-03-02 16:39:38 +0000

Rasi gravatar image
#source ~/.config/teiler/config
DMENU_OPTS="-fn "Source\Code\Pro-12" -nb #000000 -nf #a0a0a0 -sb #0c73c2 -sf #ffffff -l 18 -p $(basename $0)"

# Present a menu with all windows
TITLE="$(i3-msg -t get_tree | python -mjson.tool | sed -n -e 's/^ \{35\}[ ]\+\"name\": \"\(.*\)\", $/\1/p' | sed '/^#[a-F0-9]\{6\}$/d' | dmenu $DMENU_OPTS)"

if [ -z "$TITLE" ] ; then
   exit 1

# Escape some characters to prevent i3 to interpret them as a pattern
# "(" and ")" replaced with "\(" and "\)"
TITLE="$(echo "$TITLE" | sed 's/\([()]\)/\\\1/g')"

# Focus window
i3-msg "[title=\"$TITLE\"] focus"
edit flag offensive delete link more


thanks for your reply. I'll maybe try that approach as well in the near future.

thuswa gravatar imagethuswa ( 2013-03-02 22:18:50 +0000 )edit

answered 2013-03-02 16:39:05 +0000

badboy_ gravatar image

I use quickswitch (or the original one in python:

There is also a more fancy version: simpleswitcher

edit flag offensive delete link more


thanks for that one, I settled with it works as expected.

thuswa gravatar imagethuswa ( 2013-03-02 22:17:34 +0000 )edit

quickswitch works well, but does anyone know how to enlarge its font?

oldos2er gravatar imageoldos2er ( 2013-12-10 20:02:51 +0000 )edit

@oldos2er: It simply uses dmenu, with the python version you can specify the command using the `-d` (or `--dmenu`) switch to, my ruby version has the command hardcoded in the source.

badboy_ gravatar imagebadboy_ ( 2013-12-16 10:29:04 +0000 )edit

Question Tools



Asked: 2013-03-02 16:35:59 +0000

Seen: 3,406 times

Last updated: Jun 08