Skip to content
Discussion options

You must be logged in to vote

this script works for me:

set -euo pipefail

CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/caelestia/shell.json"   # change path if needed

IFS=, read -r CURX CURY < <(hyprctl cursorpos | tr -d ' ')

MONITOR="$(
  hyprctl monitors -j | jq -r --argjson x "$CURX" --argjson y "$CURY" '
    .[]
    | select(.x <= $x and ($x < (.x + .width)) and .y <= $y and ($y < (.y + .height)))
    | .name
  ' | head -n1
)"

if [[ -z "${MONITOR:-}" || "$MONITOR" == "null" ]]; then
  echo "Could not determine monitor under cursor." >&2
  exit 1
fi

tmp="$(mktemp)"
jq --arg m "$MONITOR" '
  .bar.excludedScreens |= (
    if (index($m) != null) then map(select(. != $m)) else . + [$m] end
  )
' "$CONFIG" > "$tmp" &&…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AdityaChaudhary3
Comment options

Answer selected by AdityaChaudhary3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants