#!/bin/bash # Open spotify_player in Ghostty, or focus existing window if [[ "$(uname)" == "Darwin" ]]; then if aerospace list-windows --all | grep -q 'Music.*Ghostty\|Ghostty.*Music'; then aerospace workspace 7 else aerospace workspace 7 open -na Ghostty --args --title="Music" -e /etc/profiles/per-user/rayandrew/bin/spotify_player fi else # Linux (i3/sway) if command -v swaymsg &>/dev/null; then if swaymsg -t get_tree | grep -q '"name": "Music"'; then swaymsg workspace 7 else swaymsg workspace 7 ghostty --title="Music" -e spotify_player & fi elif command -v i3-msg &>/dev/null; then if i3-msg -t get_tree | grep -q '"name": "Music"'; then i3-msg workspace 7 else i3-msg workspace 7 ghostty --title="Music" -e spotify_player & fi fi fi