#!/usr/bin/env bash SCRIPTS=${SCRIPTS:-$HOME/.local/scripts} THIS_FILE=${BASH_SOURCE[0]} THIS=$(basename $THIS_FILE) usage() { cat <: Get monitor data. window
: Get window data. workspace : Get workspace data. utlis : Get utils-launcher data. EOF } # Logging utility function, use in place of echo. log() { logging log --source "$THIS_FILE" "$@" } ################################################################################ # MAIN ################################################################################ # Setup logging file and label. source "$SCRIPTS/hypr/logging" setup-logging "$THIS" if [[ ! ${#@} -ge 2 ]]; then log --error "Unexpected argument count: ${#@}, expected at least: 2" usage && exit 1 fi mode="$1" # Remove single quotes from the arg. arg="${2//\'/}" if [[ $mode == "monitor" ]]; then hyprctl monitors -j | jq -C ".[] | select(.id == $arg)" elif [[ $mode == "window" ]]; then hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\")" elif [[ $mode == "workspace" ]]; then hyprctl workspaces -j | jq -C ".[] | select(.id == $arg)" elif [[ $mode == "utils" ]]; then config="${3//\'/}" if [[ ! -f $config ]]; then log --error "No utility-launcher config found: $config" exit 1 fi desc=$(jq -C ".[] | select(.name == \"$arg\") | .description" $config) exec=$(jq -C ".[] | select(.name == \"$arg\") | .exec" $config) echo -e "\n${desc[@]}\n\n" echo -e "\e[31mEXEC:\e[0m $exec\n" else log --error "Unexpected mode: $mode" usage && exit 1 fi