#!/bin/bash # Query the current xmonad configuration for packages to install # usage: .query_pkgs "Official"|"AUR" query='.[].success | objects | .root.tree | ..|.left?.data, ..|.right?.data, .data? | select(. != null) | .fulfillment | select(. != null) | add | select(. != null)' jq_type () { echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq } raw=$(xmonad --deps | jq "$query") jq_type "$raw" "$1"