diff --git a/eww/eww.yuck b/eww/eww.yuck index 3737ebb..66fb1ac 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -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") diff --git a/eww/scripts/mediaplayer.py b/eww/scripts/mediaplayer.py index 336e689..6415442 100755 --- a/eww/scripts/mediaplayer.py +++ b/eww/scripts/mediaplayer.py @@ -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() diff --git a/eww/scripts/notification-handler.sh b/eww/scripts/notification-handler.sh index 5e3768d..1c22d0a 100644 --- a/eww/scripts/notification-handler.sh +++ b/eww/scripts/notification-handler.sh @@ -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" diff --git a/eww/styles/general.scss b/eww/styles/general.scss index 8d42843..4e16a9b 100644 --- a/eww/styles/general.scss +++ b/eww/styles/general.scss @@ -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; } + } diff --git a/eww/widgets/bar/media.yuck b/eww/widgets/bar/media.yuck index b99ba44..1fbd194 100644 --- a/eww/widgets/bar/media.yuck +++ b/eww/widgets/bar/media.yuck @@ -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" diff --git a/eww/widgets/control-center/big-media.yuck b/eww/widgets/big-media.yuck similarity index 75% rename from eww/widgets/control-center/big-media.yuck rename to eww/widgets/big-media.yuck index 2801da7..5f1ae3b 100644 --- a/eww/widgets/control-center/big-media.yuck +++ b/eww/widgets/big-media.yuck @@ -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 diff --git a/eww/widgets/control-center/notification.yuck b/eww/widgets/control-center/notification.yuck index 84a2bb6..bcfae80 100644 --- a/eww/widgets/control-center/notification.yuck +++ b/eww/widgets/control-center/notification.yuck @@ -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}" diff --git a/eww/windows/control-center.yuck b/eww/windows/control-center.yuck index 2c393f0..1ade9bf 100644 --- a/eww/windows/control-center.yuck +++ b/eww/windows/control-center.yuck @@ -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) ) ) diff --git a/eww/windows/floating-media.yuck b/eww/windows/floating-media.yuck index 1d6f984..af9a2d8 100644 --- a/eww/windows/floating-media.yuck +++ b/eww/windows/floating-media.yuck @@ -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) ) )