eww: add floating media popup on bar media click

This commit is contained in:
retrozinndev
2024-12-20 15:46:04 -03:00
parent b0d61250e8
commit 5bc04e4dff
13 changed files with 224 additions and 163 deletions
+7 -3
View File
@@ -1,6 +1,10 @@
(defwidget cc-toggle []
(button :onclick "sh scripts/eww-window.sh toggle control-center"
:class "control-center-toggle ${ window_state_control-center == "open" ? "open" : "closed" }"
{ notification_modes =~ "dnd" ? "󰂠" : "󰂚"})
(eventbox :onclick "sh scripts/eww-window.sh toggle control-center"
:onrightclick "makoctl mode -t dnd"
:class "control-center-toggle ${ window_state_control-center == "open" ? "open" : "closed" }"
(box :class "button"
{ notification_modes =~ "dnd" ? "󰂠" : "󰂚"}
)
)
)
+14 -12
View File
@@ -10,26 +10,28 @@
"${ active_window.class =~ json_media.player || active_window.title =~ json_media.title ? false : true }"
}
:onclick "sh scripts/eww-window.sh toggle floating-media"
:class "mediaplayer-eventbox"
(box :class "mediaplayer ${ media_reveal_controls && window_state_floating-media == "closed" ? 'revealed' : '' }"
:space-evenly false
(box :class "media"
:space-evenly false
:tooltip "${json_media.title} - ${json_media.artist}"
(eventbox :class "media"
:tooltip "${json_media.title} - ${json_media.artist}"
(label :class "player"
:text { json_media.player == "spotify" ? " " : "󰎇 " })
(box :space-evenly false
(label :class "player"
:text { json_media.player == "spotify" ? " " : "󰎇 " })
(label :class "media-title"
:text "${json_media.title}"
:limit-width 40)
(label :class "media-title"
:text "${json_media.title}"
:limit-width 40)
(box :class "separator")
(box :class "separator")
(label :class "media-artist"
:text "${json_media.artist}"
:limit-width 25)
(label :class "media-artist"
:text "${json_media.artist}"
:limit-width 25)
)
)
(revealer :class "media-controls-revealer"
:reveal { media_reveal_controls ? "${ window_state_floating-media == 'closed' ? true : false }" : false }
+78 -50
View File
@@ -1,58 +1,86 @@
(defwidget big-media [ album_background ]
(box :orientation "horizontal"
:space-evenly false
:class "big-media ${ album_background == true ? 'album-bg' : '' }"
:style { album_background == true ? "background-image: image(url('${json_media.artUrl}'))" : "" }
(defwidget big-media [ album-background ?player-info ]
(box :class "big-media ${ album-background == true ? 'album-bg' : '' }"
:style { album-background == true ? "background-image: image(url('${json_media.artUrl}'))" : "" }
:visible { json_media.title != "null" && json_media.artist != "null" ? true : false }
:space-evenly false
:orientation "vertical"
(box :class "album-image"
:width 98
:height 87
:style "background-image: image(url('${json_media.artUrl}'));"
:valign "center")
(box :orientation "horizontal"
:space-evenly false
:class "media"
(box :orientation "vertical"
(box :class "album-image"
:width 98
:height 87
:style "background-image: image(url('${json_media.artUrl}'));"
:valign "center")
(box :orientation "vertical"
:space-evenly false
:class "right"
:hexpand true
(box :class "media-info"
:space-evenly false
:class "right"
:hexpand true
:halign "fill"
:orientation "vertical"
(box :class "media-info"
:space-evenly false
:halign "fill"
:orientation "vertical"
(label :class "title"
:text "${json_media.title}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
(label :class "artist"
:text "${json_media.artist}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
)
(box :class "controls button-row"
:orientation "horizontal"
:space-evenly false
:halign "start"
(button :class "shuffle"
:onclick "playerctl --player=${json_media.player} shuffle Toggle"
"󰒝")
(button :class "previous"
:onclick "playerctl --player=${json_media.player} previous"
"󰒮")
(button :class "play-pause"
:onclick "playerctl --player=${json_media.player} play-pause"
{ json_media.status == "playing" ? "󰏤" : "󰐊" })
(button :class "next"
:onclick "playerctl --player=${json_media.player} next"
"󰒭")
)
(label :class "title"
:text "${json_media.title}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
(label :class "artist"
:text "${json_media.artist}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
)
(box :class "controls"
:orientation "horizontal"
:space-evenly false
:halign "start"
(box :class "button-row"
:orientation "horizontal"
:space-evenly false
:halign "start"
:visible { json_media.url != "null" ? true : false }
(button :class "url"
:onclick "wl-copy '${json_media.url}'"
:style "padding-right: 13px;"
:tooltip "Copy link to Clipboard"
"󰌷")
)
(box :class "button-row"
:orientation "horizontal"
:space-evenly false
:halign "start"
(button :class "shuffle"
:onclick "playerctl --player=${json_media.player} shuffle Toggle"
:tooltip "Toggle shuffle"
"󰒝")
(button :class "previous"
:onclick "playerctl --player=${json_media.player} previous"
:tooltip "Previous"
"󰒮")
(button :class "play-pause"
:onclick "playerctl --player=${json_media.player} play-pause"
:tooltip { json_media.status == "playing" ? "Pause" : "Play" }
{ json_media.status == "playing" ? "󰏤" : "󰐊" })
(button :class "next"
:onclick "playerctl --player=${json_media.player} next"
:tooltip "Next"
"󰒭")
)
)
)
)
)
)
@@ -21,8 +21,7 @@
:image "${notification.app-icon.data}"
:summary "${notification.summary.data}"
:body "${notification.body.data}"
;:onclickclose "dunstctl history-rm ${notification.id.data}" ; needs fix
:onclick "makoctl invoke -n ${notification.id.data}"
:onclick "makoctl invoke -n ${notification.id.data} view"
:icon "${notification.app-name.data}"
)
)