#!/usr/bin/env bash set -e # FIX: Fix args not set error, to be able to use this option. #set -o nounset set -o pipefail THIS_FILE=${BASH_SOURCE[0]} # Allows script name to be set when called from a parent script or defaults to filename. THIS=${THIS:-$(basename "$THIS_FILE")} usage() { cat </dev/null 2>&1 fi } # Setup logging file and label source "$SCRIPTS/hypr/logging" setup-logging "/tmp/$THIS.log" "$THIS" export LOG_ENABLE_DRY_RUN="$dry_run_flag" if [[ $active_workspace_flag == "1" ]]; then # Set addresses to active workspace windows. id=$(hyprctl activeworkspace -j | jq -r '.id') log "Fetching addresses for active workspace: $id" addresses+=("$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $id) | .address")") elif [[ $all_flag == "1" ]]; then # Set addresses to all window addresses. addresses+=("$(hyprctl clients -j | jq -r ".[] | .address")") elif [[ $class_flag == "1" ]]; then # Set addresses to all windows containing the passed in classes. for c in ${args[@]}; do _select_addresses .class $c done elif [[ $special_flag == "1" ]]; then # Set addresses to all windows in the passed in special workspaces. get_special_addresses elif [[ -n $args ]]; then # If no modes selected, then assume there were addresses passed in # as args. addresses=$args fi # If no addresses at this point, then read from stdin, which allows addresses # to be piped in. if [[ ${#addresses} == 0 ]]; then log "No window addresses supplied, reading from stdin..." read -r addresses log "Addresses: ${addresses[@]}" fi for address in ${addresses[@]}; do close $address done