i3wm: Close all windows on a workspace

Something I have been looking for very long. Finally I was instructed.

In my i3wm config, I have the following keychain section,

bindsym $mod+n mode "focused"

mode "focused" 
{
[...snip...]
        # Exit to the default mode
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

In there, add the line bindsym q exec i3-input -F '[workspace=%s] kill' -P 'Kill workspace: ', mode "default"

The intended behaviour: Mod+n triggers the “focused” mode, wherein “q” key triggers the dialogue to name the workspace where all windows would be killed.

Nice stuff, i3wm developers, and simple enough so that I should have figured it out on my own.

Leave a Reply

Your email address will not be published. Required fields are marked *