eww: dashboard(fake) & spotify player
This commit is contained in:
67
eww/Player/eww.yuck
Normal file
67
eww/Player/eww.yuck
Normal file
@@ -0,0 +1,67 @@
|
||||
;; variables
|
||||
(defpoll art :interval "1s" "Player/scripts/player --cover")
|
||||
(defpoll title :interval "1s" "Player/scripts/music-title --status")
|
||||
(defpoll artist :interval "1s" "Player/scripts/player --artist")
|
||||
(defpoll album :interval "1s" "Player/scripts/player --album")
|
||||
(defpoll current-pos :interval "1s" "Player/scripts/player --current-pos")
|
||||
(defpoll length-info :interval "1s" "Player/scripts/player --length-info")
|
||||
(defpoll length :interval "0s" "dbus-send --dest=org.mpris.MediaPlayer2.spotify --print-reply /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata | grep uint | awk '{print $3}'")
|
||||
(defpoll position :interval "1s" "dbus-send --dest=org.mpris.MediaPlayer2.spotify --print-reply /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Position | awk 'FNR==2 {print $3}'")
|
||||
(defpoll trackid :interval "1s" "playerctl -p spotify metadata mpris:trackid")
|
||||
(defpoll current-volume :interval "1s" "Player/scripts/player --current-volume")
|
||||
(defpoll pp-icon :interval "1s" "Player/scripts/music-title --icon")
|
||||
(defpoll shuffle :interval "1s" "playerctl -p spotify shuffle")
|
||||
(deflisten eq-status "tail -F Player/status/eq-status")
|
||||
(deflisten vz-status "tail -F Player/status/vz-status")
|
||||
(deflisten ly-status "tail -F Player/status/ly-status")
|
||||
(defvar hover false)
|
||||
(deflisten cava "Player/scripts/cava")
|
||||
|
||||
;; widgets
|
||||
(defwidget player[]
|
||||
(box :class "player-main-box" :space-evenly "false" :orientation "v" :hexpand "false" :vexpand "false"
|
||||
; (box :class "header-box" :hexpand "false" :vexpand "false" :space-evenly "true"
|
||||
; (box :class "another-header-box" :space-evenly "false"
|
||||
; (label :class "spotify-header-logo" :text " " :halign "center")
|
||||
; (label :class "spotify-header-title" :text "Spotify" :halign "center")
|
||||
; (label :class "spotify-header-player" :text "Player" :halign "center")))
|
||||
(box :class "player-box" :hexpand "false" :vexpand "false" :space-evenly "true"
|
||||
(box :class "player-info-box" :hexpand "false" :vexpand "false" :space-evenly "false" :orientation "v" :spacing 15
|
||||
(label :class "player-info-title" :text " Title: ${title}" :halign "start" :limit-width 30 :tooltip "${title}")
|
||||
(label :class "player-info-artist" :text " Artist: ${artist}" :halign "start" :limit-width 30 :tooltip "${artist}")
|
||||
(label :class "player-info-album" :text " Album: ${album}" :halign "start" :limit-width 30 :tooltip "${album}")
|
||||
(label :class "player-info-length" :text " Length: ${length-info}" :halign "start" :tooltip "${length-info}"))
|
||||
(box :class "player-cover-box" :hexpand "false" :halign "end" :vexpand "false" :space-evenly "false" :style "background-image: url('${art}');"))
|
||||
(box :class "cava-box" :hexpand "false" :vexpand "false"
|
||||
(label :vexpand "false" :hexpand "false" :space-evenly "false"
|
||||
:class "cavabar"
|
||||
:text cava
|
||||
))
|
||||
(eventbox :onhover "eww update hover=true"
|
||||
:onhoverlost "eww update hover=false"
|
||||
:cursor "pointer"
|
||||
:space-evenly "false"
|
||||
(scale :orientation "h" :class "player-music-slider" :min 0 :max length :value position :tooltip current-pos :onchange { hover ? "dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.SetPosition objpath:${trackid} int64:{}" : "" }))
|
||||
(box :class "main-player-control-box" :hexpand "false" :vexpand "false" :space-evenly "false" :orientation "h" :height 70
|
||||
(box :class "player-volume-box" :space-evenly "false" :hexpand "false" :vexpand "false" :spacing 10
|
||||
(label :class "player-volume-icon" :text "")
|
||||
(scale :class "player-volume-slider" :width 140 :min 0 :max 100 :orientation "h" :value current-volume :halign "start" :onchange "Player/scripts/player --volume {}"))
|
||||
(box :class "player-buttons" :space-evenly "false" :hexpand "false" :vexpand "false" :spacing 10
|
||||
(button :class "shuffle-btn ${shuffle == "On" ? "shuffle-btn-on" : "shuffle-btn-off"}" :onclick "Player/scripts/player --shuffle" "")
|
||||
(button :class "previous-btn" :onclick "playerctl -p spotify previous" "")
|
||||
(button :class "player-pp-btn" :onclick "playerctl -p spotify play-pause" "${pp-icon}")
|
||||
(button :class "next-btn" :onclick "playerctl -p spotify next" ""))
|
||||
(box :class "player-length-box" :space-evenly "false" :hexpand "false" :vexpand "false" :halign "end" :width 150
|
||||
(label :class "current-position" :text "${current-pos} ")
|
||||
(label :class "length-of-song" :text "/ ${length-info}"))
|
||||
(box :class "player-control-box-right" :space-evenly "false" :hexpand "false" :vexpand "false" :spacing 15 :halign "end"
|
||||
(button :class "equalizer-btn ${eq-status == "On" ? "equalizer-btn-on" : "equalizer-btn-off"}" :onclick "Player/scripts/equalizer" "")))))
|
||||
|
||||
|
||||
;; windows
|
||||
(defwindow player
|
||||
:windowtype "normal"
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:geometry (geometry :anchor "top center" :y 100 :height 400 :width 680)
|
||||
(player))
|
||||
Reference in New Issue
Block a user