feat: switch to spot instead of official spotify client

This commit is contained in:
matt1432 2023-08-20 14:26:47 -04:00
parent 74d5373d48
commit 914a6950e3
5 changed files with 25 additions and 24 deletions

View file

@ -1,13 +1,13 @@
(defpoll player :interval "1s" "echo spotify")
(defpoll player :interval "1s" "echo Spot")
(defpoll music_cover :interval "1s" "$EWW_PATH/music.sh cover") ;done
(defvar music_accent "rgb(0,0,0)") ;done
(defvar button_accent "rgb(0,0,0)") ;done
(defvar button_text "rgb(255,255,255)") ;done
(defpoll music_status :interval "1s" "playerctl -p spotify status")
(defpoll title :interval "1s" "playerctl -p spotify metadata title")
(defpoll artist :interval "1s" "playerctl -p spotify metadata artist")
(defpoll music_status :interval "1s" "playerctl -p Spot status")
(defpoll title :interval "1s" "playerctl -p Spot metadata title")
(defpoll artist :interval "1s" "playerctl -p Spot metadata artist")
(defvar button_height "42")
(defpoll shuffle_status :interval "1s" "playerctl -p spotify shuffle")
(defpoll shuffle_status :interval "1s" "playerctl -p Spot shuffle")
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
(defvar song_pos "0")
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
@ -23,7 +23,7 @@
:halign "start"
:valign "start"
:style "color: ${button_accent};"
"${player == 'spotify' ? '' : '爵' }"
"${player == 'Spot' ? '' : '爵' }"
)
(box :class "center"
:orientation "h"
@ -42,7 +42,7 @@
:halign "left"
:style "background-color: ${button_accent};
color: ${button_text};"
:onclick "playerctl -p spotify play-pause"
:onclick "playerctl -p Spot play-pause"
:cursor "pointer"
:onhover "eww update button_height=41"
:onhoverlost "eww update button_height=42"
@ -61,7 +61,7 @@
:spacing 0
(eventbox :valign "end"
:halign "start"
:onclick "playerctl -p spotify previous & $EWW_PATH/music.sh cover"
:onclick "playerctl -p Spot previous & $EWW_PATH/music.sh cover"
:class "previousbutton"
:width 40
:cursor "pointer"
@ -76,7 +76,7 @@
:min 0
:max song_length
:orientation "h"
:onchange "playerctl -p spotify position {}"
:onchange "playerctl -p Spot position {}"
:css "highlight { background-color: ${button_accent}; }
slider { background-color: ${button_accent}; }
trough { background-color: rgba(${button_accent}, 0.4); }"
@ -85,13 +85,13 @@
(box :valign "end"
:halign "end"
(eventbox :onclick "playerctl -p spotify next & $EWW_PATH/music.sh cover"
(eventbox :onclick "playerctl -p Spot next & $EWW_PATH/music.sh cover"
:class "nextbutton"
:width 40
:cursor "pointer"
"󰒭"
)
(eventbox :onclick "playerctl -p spotify shuffle toggle"
(eventbox :onclick "playerctl -p Spot shuffle toggle"
:class "shuffle"
:width 40
:cursor "pointer"

View file

@ -1,19 +1,19 @@
#!/usr/bin/env bash
loop() {
loop_status=$(playerctl -p spotify loop)
loop_status=$(playerctl -p Spot loop)
case $loop_status in
"None" )
playerctl -p spotify loop Playlist
playerctl -p Spot loop Playlist
eww update repeat_icon="󰑖"
;;
"Track" )
playerctl -p spotify loop None
playerctl -p Spot loop None
eww update repeat_icon="󰑗"
;;
"Playlist" )
playerctl -p spotify loop Track
playerctl -p Spot loop Track
eww update repeat_icon="󰑘"
;;
* )
@ -23,7 +23,7 @@ loop() {
}
loop_status() {
loop_status=$(playerctl -p spotify loop)
loop_status=$(playerctl -p Spot loop)
case $loop_status in
"None" )
@ -43,9 +43,9 @@ loop_status() {
get_length() {
if [[ $(eww get get_pos) == "true" ]]; then
eww update song_pos="$(playerctl -p spotify position)"
eww update song_pos="$(playerctl -p Spot position)"
fi
eww update song_length="$(echo "$(playerctl -p spotify metadata mpris:length)/1000000" | bc -l)"
eww update song_length="$(echo "$(playerctl -p Spot metadata mpris:length)/1000000" | bc -l)"
}
get_accents() {
@ -62,7 +62,7 @@ get_accents() {
get_cover() {
existing_file="/tmp/cover.jpg"
new_image_url=$(playerctl -p spotify metadata mpris:artUrl)
new_image_url=$(playerctl -p Spot metadata mpris:artUrl)
existing_hash=$(md5sum "$existing_file" | awk '{print $1}')
# Download the new image only if the hashes are different

View file

@ -14,10 +14,9 @@ function run() {
sleep 0.1
input-emulator mouse button left
fi
echo "cant_run" > "$FILE"
exit 0
}
while IFS='$\n' read -r line; do
[[ $(grep "can_run" "$FILE") != "" ]] && run
[[ $(grep "cant_run" "$FILE") != "" ]] && exit 0
done < <(stdbuf -oL tail -f "$FILE")

View file

@ -46,6 +46,8 @@ exec-once = swayosd
# Change HandleLidSwitch to lock in logind.conf
exec-once = swayidle -w lock $LOCK_PATH/lock.sh
exec-once = spot
# Some default env vars.
env = XCURSOR_SIZE,24
@ -139,6 +141,7 @@ gestures {
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrule = noborder,^(wofi)$
windowrule = workspace special:spot,^(dev.alextren.Spot)$
windowrule = float,^(org.kde.polkit-kde-authentication-agent-1)$
windowrule = size 741 288,^(org.kde.polkit-kde-authentication-agent-1)$
@ -170,6 +173,7 @@ bind = $mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-co
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Q, exec, alacritty
bind = $mainMod, S, togglespecialworkspace, spot
bind = $mainMod, C, killactive,
bind = $mainMod, L, exec, $LOCK_PATH/lock.sh

View file

@ -70,6 +70,7 @@
tutanota-desktop
input-emulator
bc
spot
swayosd
blueberry
libayatana-appindicator
@ -100,9 +101,6 @@
gimp-with-plugins
jdk19_headless
bluez-tools
spotify
#spotifywm # fails to build
spicetify-cli # TODO
vlc
discord
brightnessctl