Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 97-109-107/75865f024bf02365da74 to your computer and use it in GitHub Desktop.
Save 97-109-107/75865f024bf02365da74 to your computer and use it in GitHub Desktop.
#!/bin/bash
i3-msg -t get_workspaces | jq -r 'map(select(.focused))[0].rect["width","height"]'
i3-msg -t get_workspaces | jq -r 'map(select(.focused))[0].output'
@max-phase
Copy link

thanks a lot for the inspiration!

if you want to have auto-completion as well, put this into your i3 config:

# with auto-complete via dmenu (needs jq for JSON processing)
bindsym $mod+t exec --no-startup-id bash -c 'ws="$(i3-msg -t get_workspaces  | jq -r '\''.[] .name | @text '\'' | dmenu)" && i3-msg workspace "${ws}"'
bindsym $mod+Shift+t exec --no-startup-id bash -c 'ws="$(i3-msg -t get_workspaces  | jq -r '\''.[] .name | @text '\'' | dmenu)" && i3-msg move container to workspace "${ws}"'
bindsym $mod+Shift+Ctrl+t exec --no-startup-id bash -c 'ws="$(i3-msg -t get_workspaces  | jq -r '\''.[] .name | @text '\'' | dmenu)" && i3-msg rename workspace to "${ws}"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment