eww: refactor and improved experience with media widgets
This commit is contained in:
@@ -9,3 +9,6 @@
|
||||
(include "windows/volume-control.yuck")
|
||||
(include "windows/volume-popup.yuck")
|
||||
(include "windows/floating-media.yuck")
|
||||
|
||||
; Widgets
|
||||
(include "widgets/big-media.yuck")
|
||||
|
||||
@@ -103,7 +103,7 @@ class PlayerManager:
|
||||
else:
|
||||
self.clear_output()
|
||||
|
||||
de on_metadata_changed(self, player, metadata, _=None):
|
||||
def on_metadata_changed(self, player, metadata, _=None):
|
||||
logger.debug(f"Metadata changed for player {player.props.player_name}")
|
||||
player_name = player.props.player_name
|
||||
artist = player.get_artist()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# initial notification history
|
||||
json_initial_history=$(makoctl history | jq -c '.data[]' | sed 's/\\[n]/\\n/g')
|
||||
json_initial_history=$(makoctl history | jq -c '.data[]' | sed -e 's/\\[n]/\\n/g' -e 's/&/&/g')
|
||||
echo $json_initial_history
|
||||
|
||||
while true; do
|
||||
@@ -9,7 +9,7 @@ while true; do
|
||||
sleep .2
|
||||
|
||||
# frequently updated history variable
|
||||
json_history=$(makoctl history | jq -c '.data[]' | sed 's/\\[n]/\\n/g')
|
||||
json_history=$(makoctl history | jq -c '.data[]' | sed -e 's/\\[n]/\\n/g' -e 's/&/&/g')
|
||||
|
||||
if ! [[ "$json_initial_history" == "$json_history" ]]; then
|
||||
json_initial_history="$json_history"
|
||||
|
||||
@@ -16,7 +16,7 @@ box.button-row {
|
||||
$bg-color: darken($color: $foreground, $amount: 25);
|
||||
|
||||
& > button {
|
||||
background: rgba($bg-color, .7);
|
||||
background: rgba($bg-color, .8);
|
||||
border-radius: 1px;
|
||||
margin: 0 1px;
|
||||
|
||||
@@ -31,7 +31,7 @@ box.button-row {
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba($bg-color, 1);
|
||||
background: $bg-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ box.vertical.button-row {
|
||||
$bg-color: darken($color: $foreground, $amount: 25);
|
||||
|
||||
& > button {
|
||||
background: rgba($bg-color, .7);
|
||||
background: rgba($bg-color, .8);
|
||||
border-radius: 2px;
|
||||
margin: 1px 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ box.vertical.button-row {
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba($bg-color, 1);
|
||||
background: $bg-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,4 +201,5 @@ tooltip {
|
||||
box-shadow: inset 0 0 0 100px rgba($background, .55);
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
(defwidget media []
|
||||
(eventbox :onhover "${EWW_CMD} update media_reveal_controls=true"
|
||||
:onhoverlost "${EWW_CMD} update media_reveal_controls=false"
|
||||
:visible { json_media.title == "null" && json_media.artist == "null" ?
|
||||
false
|
||||
:
|
||||
"${ active_window.class =~ json_media.player || active_window.title =~ json_media.title ? false : true }"
|
||||
}
|
||||
:visible { json_media == "" ||
|
||||
(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"
|
||||
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
(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 }
|
||||
(defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style-background-color ?visible ]
|
||||
(box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }"
|
||||
:style "${ show-album-bg ? 'background-image: image(url(\"${json_media.artUrl}\"))' : '' } ${
|
||||
style-background-color != '' ? 'background-color: ${style-background-color}' : '' }"
|
||||
:visible { visible ? true : false}
|
||||
:space-evenly false
|
||||
:orientation "vertical"
|
||||
|
||||
(box :orientation "horizontal"
|
||||
:space-evenly false
|
||||
:class "media"
|
||||
:space-evenly false
|
||||
:class "media"
|
||||
|
||||
(box :class "album-image"
|
||||
:width 98
|
||||
:height 87
|
||||
:width { album-image-size != "" ? album-image-size : 98 }
|
||||
:height { album-image-size != "" ? "${album-image-size - 11}" : 87 }
|
||||
:style "background-image: image(url('${json_media.artUrl}'));"
|
||||
:valign "center")
|
||||
:valign "center"
|
||||
:visible { show-album-image ? true : false })
|
||||
|
||||
(box :orientation "vertical"
|
||||
:space-evenly false
|
||||
:class "right"
|
||||
:hexpand true
|
||||
:valign "center"
|
||||
|
||||
(box :class "media-info"
|
||||
:space-evenly false
|
||||
@@ -45,8 +45,8 @@
|
||||
(label :class "summary"
|
||||
:text "${summary}"
|
||||
:xalign 0
|
||||
:show-truncated true
|
||||
:halign "start")
|
||||
:halign "start"
|
||||
:show-truncated true)
|
||||
|
||||
(label :class "body"
|
||||
:markup "${body}"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(include "widgets/control-center/top-bar.yuck")
|
||||
(include "widgets/control-center/notifications.yuck")
|
||||
(include "widgets/control-center/big-media.yuck")
|
||||
(include "widgets/control-center/notification.yuck")
|
||||
(include "widgets/control-center/toggles.yuck")
|
||||
|
||||
@@ -17,7 +16,9 @@
|
||||
:space-evenly false
|
||||
(top-bar)
|
||||
(toggles)
|
||||
(big-media :album-background true)
|
||||
(big-media :show-album-bg true
|
||||
:show-album-image true
|
||||
:visible { json_media != "" ? true : false })
|
||||
(notifications)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
(defwindow floating-media []
|
||||
:monitor 0
|
||||
:geometry (geometry :anchor "top center"
|
||||
:width "350px")
|
||||
:width "420px")
|
||||
:exclusive false
|
||||
:stacking "overlay"
|
||||
:stacking "fg"
|
||||
:focusable false
|
||||
:namespace "eww-media"
|
||||
(box :class "floating-media"
|
||||
:orientation "vertical"
|
||||
:space-evenly false
|
||||
:style "box-shadow: 0 5px 6px 1px rgb(0, 0, 0);"
|
||||
(big-media :album-background true
|
||||
:player-info true)
|
||||
(big-media :show-album-bg true
|
||||
:album-image-size 124
|
||||
:show-album-image true)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user