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

How to check which workspace is currently focused from skript

asked 2015-10-25 19:20:49 +0000

kyra gravatar image

Is it possible to check which workspace is currently focused and using this information in a bash script? I did some google research but didn't come up with anything useful ..

edit retag flag offensive close merge delete



You may wanna read this:

Airblader gravatar imageAirblader ( 2015-10-25 20:53:21 +0000 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-25 19:39:54 +0000

Anon1234 gravatar image

Depends on what tool you can use for parsing json. With python you can do this oneliner:

$ focused_ws=$(i3-msg -t get_workspaces | python -c 'import json,sys;ws=json.load(sys.stdin);print(list(filter(lambda x: x["focused"], ws))[0]["name"])')
$ echo $focused_ws 
1: main
edit flag offensive delete link more


exactly what I was looking for works like a charm! Thanks!

kyra gravatar imagekyra ( 2015-10-28 10:19:11 +0000 )edit

Question Tools

1 follower


Asked: 2015-10-25 19:20:49 +0000

Seen: 55 times

Last updated: Oct 25