/ de-omarchy / bin / omarchy-launch-spotify
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
16 lines · 607 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

# omarchy:summary=Launch Spotify or start its installer when missing.

set -e

WINDOW_ADDRESS=$(hyprctl clients -j | jq -r '.[]|select((.class|test("\\bspotify\\b";"i")) or (.title|test("\\bspotify\\b";"i")))|.address' | head -n1)

if [[ -n $WINDOW_ADDRESS ]]; then
  hyprctl dispatch "hl.dsp.focus({ window = \"address:$WINDOW_ADDRESS\" })" >/dev/null 2>&1 || hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
elif [[ -x /usr/bin/spotify ]]; then
  exec setsid uwsm-app -- /usr/bin/spotify
else
  exec omarchy-launch-floating-terminal-with-presentation omarchy-install-service-spotify
fi