btw i use nix
1#!/usr/bin/env bash
2
3windows=$(\
4 @wmmsg@ -t get_tree |\
5 jq -r '
6 recurse(.nodes[], .floating_nodes[];.nodes!=null)
7 | select(.name=="__i3_scratch")
8 | recurse(.nodes[], .floating_nodes[];.nodes!=null)
9 | select((.type=="con" or .type=="floating_con") and .name!=null)
10 | "\(.id? | tostring | (" " * (3 - length)) + .) \(.name?)"
11 '
12)
13
14selected=$(echo "$windows" | @dmenu@ "Select window:" | awk '{print $1}')
15
16@wmmsg@ "[con_id="$selected"] focus"