9

How do I kill all windows in a workspace if I can't open it?

I read this suggestion. But I can't do it because I cannot switch over to the workspace.

3 Answers3

4

it is working simply use below code

bindsym $mod+Shift+a focus parent,kill

it works for me

Ayyanar
  • 271
4

In this case the trick lies in specifying a window selection for the bound command. As any individual i3 config file (~/.config/i3/config) might be structured very differently, the following example is purely for demonstration. Also, the use of the Ctrl key might be a bad real-world choice due to its proximity to the Shift key.

# Close focused window
bindsym $mod+q kill

# Close all windows on all workspaces (any class string)
bindsym $mod+Shift+q [class=”.*”] kill

# Close all windows on workspace 1 (name stored in $ws1)
bindsym $mod+Ctrl+1 [workspace=$ws1] kill

For further information have a look at the i3 User's Guide.

Furthermore, despite its name the kill command does not actually kill the process but tries to use the WM_DELETE protocol. So depending on the respective behaviour a window might not close after all (most likely for a good reason).

Floyd
  • 88
2

Use i3-input -F <format> -P <prompt>

This is how I use it in my config file:

bindsym $mod+q exec i3-input -F '[workspace=^%s$] kill' -P 'kill workspace?'

Every occurence of %s in the string is replaced by the user input. Check i3-input man page for more details

tsx86
  • 21