2023-08-20 14:26:47 -04:00
|
|
|
(defpoll player :interval "1s" "echo Spot")
|
2023-08-16 23:31:04 -04:00
|
|
|
(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
|
2023-08-20 14:26:47 -04:00
|
|
|
(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")
|
2023-08-17 22:53:55 -04:00
|
|
|
(defvar button_height "42")
|
2023-08-20 14:26:47 -04:00
|
|
|
(defpoll shuffle_status :interval "1s" "playerctl -p Spot shuffle")
|
2023-08-17 22:53:55 -04:00
|
|
|
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
|
2023-08-17 23:58:40 -04:00
|
|
|
(defvar song_pos "0")
|
|
|
|
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
|
2023-08-19 17:30:59 -04:00
|
|
|
(defvar get_pos "true")
|
2023-08-16 23:31:04 -04:00
|
|
|
|
|
|
|
(defwidget playerinfo []
|
|
|
|
(centerbox :class "playerinfo"
|
|
|
|
:style "background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 30%, ${music_accent}), url(\"${music_cover}\");
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;"
|
|
|
|
:orientation "v"
|
|
|
|
(box :class "top"
|
|
|
|
:halign "start"
|
|
|
|
:valign "start"
|
|
|
|
:style "color: ${button_accent};"
|
2023-08-20 14:26:47 -04:00
|
|
|
"${player == 'Spot' ? '' : '爵' }"
|
2023-08-16 23:31:04 -04:00
|
|
|
)
|
|
|
|
(box :class "center"
|
|
|
|
:orientation "h"
|
|
|
|
:space-evenly false
|
|
|
|
(box :class "metadata"
|
|
|
|
:orientation "v"
|
|
|
|
:halign "start"
|
|
|
|
:valign "center"
|
|
|
|
:hexpand true
|
|
|
|
(label :limit-width 25 :halign "start" :text title :class "title")
|
|
|
|
(label :limit-width 25 :halign "start" :text artist :class "artist")
|
|
|
|
)
|
|
|
|
(centerbox :orientation "v"
|
|
|
|
(label)
|
|
|
|
(eventbox :class "pausebutton ${music_status == 'Playing' ? 'playing' : 'paused'}"
|
2023-08-17 22:53:55 -04:00
|
|
|
:halign "left"
|
2023-08-16 23:31:04 -04:00
|
|
|
:style "background-color: ${button_accent};
|
2023-08-17 22:53:55 -04:00
|
|
|
color: ${button_text};"
|
2023-08-20 14:26:47 -04:00
|
|
|
:onclick "playerctl -p Spot play-pause"
|
2023-08-16 23:31:04 -04:00
|
|
|
:cursor "pointer"
|
2023-08-17 22:53:55 -04:00
|
|
|
:onhover "eww update button_height=41"
|
|
|
|
:onhoverlost "eww update button_height=42"
|
2023-08-16 23:31:04 -04:00
|
|
|
|
2023-08-17 22:53:55 -04:00
|
|
|
(label :text "${music_status == 'Playing' ? ' ' : ''}"
|
|
|
|
:width button_height
|
|
|
|
:height button_height
|
2023-08-16 23:31:04 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(label)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(box :class "bottom"
|
|
|
|
:style "color: ${button_accent};"
|
2023-08-17 23:58:40 -04:00
|
|
|
:space-evenly false
|
|
|
|
:spacing 0
|
2023-08-16 23:31:04 -04:00
|
|
|
(eventbox :valign "end"
|
|
|
|
:halign "start"
|
2023-08-20 14:26:47 -04:00
|
|
|
:onclick "playerctl -p Spot previous & $EWW_PATH/music.sh cover"
|
2023-08-16 23:31:04 -04:00
|
|
|
:class "previousbutton"
|
2023-08-17 22:53:55 -04:00
|
|
|
:width 40
|
2023-08-16 23:31:04 -04:00
|
|
|
:cursor "pointer"
|
|
|
|
""
|
|
|
|
)
|
2023-08-17 23:58:40 -04:00
|
|
|
(eventbox :cursor "pointer"
|
|
|
|
:class "song-pos"
|
|
|
|
:hexpand true
|
2023-08-19 17:30:59 -04:00
|
|
|
:onhover "eww update get_pos=false"
|
|
|
|
:onhoverlost "eww update get_pos=true"
|
2023-08-17 23:58:40 -04:00
|
|
|
(scale :value song_pos
|
|
|
|
:min 0
|
|
|
|
:max song_length
|
|
|
|
:orientation "h"
|
2023-08-20 14:26:47 -04:00
|
|
|
:onchange "playerctl -p Spot position {}"
|
2023-08-17 23:58:40 -04:00
|
|
|
:css "highlight { background-color: ${button_accent}; }
|
|
|
|
slider { background-color: ${button_accent}; }
|
|
|
|
trough { background-color: rgba(${button_accent}, 0.4); }"
|
|
|
|
)
|
|
|
|
)
|
2023-08-17 22:53:55 -04:00
|
|
|
(box :valign "end"
|
|
|
|
:halign "end"
|
|
|
|
|
2023-08-20 14:26:47 -04:00
|
|
|
(eventbox :onclick "playerctl -p Spot next & $EWW_PATH/music.sh cover"
|
2023-08-17 22:53:55 -04:00
|
|
|
:class "nextbutton"
|
|
|
|
:width 40
|
|
|
|
:cursor "pointer"
|
|
|
|
""
|
|
|
|
)
|
2023-08-20 14:26:47 -04:00
|
|
|
(eventbox :onclick "playerctl -p Spot shuffle toggle"
|
2023-08-17 22:53:55 -04:00
|
|
|
:class "shuffle"
|
|
|
|
:width 40
|
|
|
|
:cursor "pointer"
|
|
|
|
"${shuffle_status == 'On' ? '' : ''}"
|
|
|
|
)
|
|
|
|
(eventbox :onclick "$EWW_PATH/music.sh loop"
|
|
|
|
:class "repeat"
|
|
|
|
:width 40
|
|
|
|
:cursor "pointer"
|
|
|
|
"${repeat_icon}"
|
|
|
|
)
|
2023-08-16 23:31:04 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(defwindow playerinfo
|
|
|
|
:monitor 0
|
|
|
|
:stacking "overlay"
|
|
|
|
:exclusive "ignore"
|
|
|
|
:focusable "false"
|
|
|
|
:geometry (geometry :x "800px"
|
|
|
|
:y "10px"
|
|
|
|
:width "0px"
|
|
|
|
:height "0px"
|
2023-08-17 22:53:55 -04:00
|
|
|
:anchor "top left"
|
2023-08-16 23:31:04 -04:00
|
|
|
)
|
|
|
|
(playerinfo)
|
|
|
|
)
|
|
|
|
|
|
|
|
|