Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # A slightly more efficient version of espanso_move.sh which utilises xwininfo.
- WINDOW_TITLE="espanso"
- # Function to check if the window exists and return window information
- get_window_info() { xwininfo -name "$WINDOW_TITLE" 2> /dev/null; }
- while true; do
- # Get window information using the function
- WINDOW_INFO=$(get_window_info)
- if [ -n "$WINDOW_INFO" ]; then
- WINDOW_ID=$(echo "$WINDOW_INFO" | awk '/Window id:/ {print $4}')
- wmctrl -i -r "$WINDOW_ID" -e 0,0,0,-1,-1 # gravity, coordinates, resize
- echo "Window '$WINDOW_TITLE' moved."
- # Wait until the window closes
- while [ -n "$(get_window_info)" ]; do sleep 1; done
- echo "Window '$WINDOW_TITLE' closed or minimized. Waiting for it to reappear."
- fi
- sleep 0.5 # Control polling frequency
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement