#!/bin/bash # Define your targets TARGET_CLASS="kitty" TARGET_TAG="compiler" COMMAND_TO_SEND="!-2" WINDOW_ADDR=$(hyprctl clients -j | jq -r '.[] | select(.tags[]? == "compiler" and .class == "kitty") | .address') if [ -z "$WINDOW_ADDR" ] || [ "$WINDOW_ADDR" == "null" ]; then notify-send "Target Error" "No window found with tag $TARGET_TAG" exit 1 fi # Focus the window # hyprctl dispatch focuswindow address:$WINDOW_ADDR echo $WINDOW_ADDR hyprctl dispatch sendshortcut CTRL ,UP, address:"$WINDOW_ADDR" # hyprctl dispatch sendshortcut ,Return, address:"$WINDOW_ADDR" # Send the command using wtype (Wayland's xdotool alternative) # This types the command and presses Enter sleep 0.1 # Small delay to ensure focus has shifted