summaryrefslogtreecommitdiff
path: root/togglespot.sh
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-12-28 18:58:56 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-12-28 18:58:56 +0800
commitf266ccaa4afd3843cfe30da3d2018ecc928e3738 (patch)
tree46c46551771d6065dea4a28678aa6e97f1d7b79c /togglespot.sh
parentec01aa7e155a97a4e7d13c189af7f44e2e49787d (diff)
init: toggle spot
Diffstat (limited to 'togglespot.sh')
-rwxr-xr-xtogglespot.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/togglespot.sh b/togglespot.sh
new file mode 100755
index 0000000..c713de5
--- /dev/null
+++ b/togglespot.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+workspace=$(hyprctl clients -j | jq -r '.[] | select(.class == "Spotify") | .workspace.name')
+
+if [ -z $workspace ]; then
+ hyprctl dispatch exec [workspace +0, noinitialfocus] LD_PRELOAD=/usr/lib/spotify-adblock.so spotify
+ workspace=7
+fi
+
+
+if [ $workspace -eq 7 ]; then
+ hyprctl --batch 'dispatch setfloating class:Spotify; dispatch movetoworkspace +0, class:Spotify'
+else
+ hyprctl --batch 'dispatch settiled class:Spotify; dispatch movetoworkspacesilent 7, class:Spotify'
+fi