#!/usr/bin/env bash set -e set -o nounset set -o pipefail THIS_FILE=${BASH_SOURCE[0]} LOG_LABEL=$(basename "$THIS_FILE") # Allows script name to be set when called from a parent script or defaults to filename. THIS=${THIS:-$LOG_LABEL} usage() { cat </dev/null 2>&1 fi } ################################################################################ # MAIN ################################################################################ # Setup logging file and label source "$SCRIPTS/hypr/logging" setup-logging "$LOG_LABEL" 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 else # If no modes selected, then assume there were addresses passed in # as args. addresses=("$args") fi if [[ ${#addresses} == 0 ]]; then log --warning "No windows found." exit 0 fi for address in ${addresses[@]}; do close $address done