eww: add new features and fix issues

This commit is contained in:
retrozinndev
2024-12-07 16:43:37 -03:00
parent adf8b7d9ba
commit e9258d04e4
26 changed files with 882 additions and 207 deletions
@@ -0,0 +1,65 @@
(deflisten json_media_data :initial "{}"
`python ./scripts/mediaplayer.py`)
(defwidget mediaplayer [ album_background ]
(box :orientation "horizontal"
:space-evenly false
:class "mediaplayer ${ album_background == true ? 'mediaplayer-album-bg' : '' }"
:style { album_background == true ? "background-image: image(url('${json_media_data.artUrl}'))" : "" }
:visible { json_media_data.title != "null" && json_media_data.artist != "null" ? true : false }
(box :class "album-image"
:width 98
:height 87
:style "background-image: image(url('${json_media_data.artUrl}'));"
:valign "center")
(box :orientation "vertical"
:space-evenly false
:class "right"
:halign "fill"
(box :class "media-info"
:space-evenly false
:halign "fill"
:orientation "vertical"
(label :class "title"
:text "${json_media_data.title}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
(label :class "artist"
:text "${json_media_data.artist}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
)
(box :class "media-controls button-row"
:orientation "horizontal"
:space-evenly false
:halign "start"
(button :class "shuffle"
:onclick "playerctl --player=${json_media_data.player} shuffle Toggle"
"󰒝")
(button :class "previous"
:onclick "playerctl --player=${json_media_data.player} previous"
"󰒮")
(button :class "play-pause"
:onclick "playerctl --player=${json_media_data.player} play-pause"
{ json_media_data.status == "playing" ? "󰏤" : "󰐊" })
(button :class "next"
:onclick "playerctl --player=${json_media_data.player} next"
"󰒭")
(button :class "repeat"
:onclick "" ; todo
"󰑖")
)
)
)
)
@@ -0,0 +1,61 @@
(defwidget notification [ ?application_name ?icon_path summary body ?image ?onclick ]
(eventbox :onclick "${onclick}"
(box :class "notification"
:orientation "vertical"
:height 96
:space-evenly false
(box :class "top"
:orientation "horizontal"
:space-evenly false
(box :class "app-info"
:space-evenly false
:halign "start"
:hexpand true
:vexpand false
(image :class "app-icon"
:path "${icon_path}"
:visible { icon_path != "" ? true : false }
:image-width 32
:image-height 32)
(label :class "app-name"
:text "${application_name}")
)
(box :space-evenly false
(button :class "close"
:onclick "${onclick}"
"󰅖")
)
)
(box :class "content"
:space-evenly false
(box :class "image"
:width 96
:height 96
:visible { image != "" ? true : false }
:style { image != "" ? "background-image: image(url('${image}'));" : "" }
)
(box :class "text"
:orientation "vertical"
:space-evenly false
(label :class "summary"
:text "${summary}"
:xalign 0
:show-truncated true
:halign "start")
(label :class "body"
:markup "${body}"
:xalign 0
:show-truncated false
:wrap true)
)
)
)
)
)
@@ -0,0 +1,55 @@
(include "widgets/control-center/notification.yuck")
(deflisten json_notification_history :initial "{[]}"
`python ./scripts/notification-watcher.py`)
(defwidget notifications []
(box :class "cc-notifications"
:space-evenly false
:orientation "vertical"
(scroll :class "vertical-scroll"
:hscroll false
:vscroll true
:height 400 ; Adjust according to your screen size
:vexpand true
(box :class "notifications"
:orientation "vertical"
:space-evenly false
(for notification in json_notification_history
(notification :application_name "${notification.applicationName}"
:image "${notification.image}"
:summary "${notification.summary}"
:body "${notification.body}")
)
(box :class "empty-notifications"
:visible { json_notification_history[0] == "null" ? true : false }
:style "margin-top: 150px;"
:space-evenly false
:orientation "vertical"
:halign "center"
(label :class "bell-icon"
:text "󱇦"
:style "font-size: 96px")
(label :text "You're done!"
:style "margin-left: 12px;")
)
)
)
(box :class "bottom button-row"
:halign "end"
:space-evenly false
(button :class "do-not-disturb"
"󰒲")
(button :class "clear-all"
:onclick "dunstctl history-clear"
"Clear all ")
)
)
)
+32 -5
View File
@@ -1,10 +1,37 @@
(defpoll uptime_info :interval "25s"
`echo "$(cat /etc/hostname), Uptime: $( uptime -p | sed -e 's/^up //')"`)
(deflisten hostname :initial "GNU/Linux"
`cat /etc/hostname`)
(defpoll uptime_info :interval "50s"
`uptime -p | sed -e 's/^up //'`)
(defwidget quickactions []
(box :orientation "horizontal"
(label :xalign 0
:text "${uptime_info}")
(box :class "quickactions"
:orientation "horizontal"
(box :class "left"
:orientation "vertical"
:halign "start"
(label :xalign 0
:text " ${hostname}"
:class "hostname")
(label :xalign 0
:text " ${uptime_info}"
:class "uptime")
)
(box :orientation "horizontal"
:class "button-row"
:space-evenly false
:halign "end"
(button :class "lock"
:onclick "hyprctl dispatch exec hyprlock"
"󰌾")
(button :class "powermenu"
:onclick "eww close-all; eww open powermenu"
"󰗽")
)
)
)
@@ -0,0 +1,37 @@
(defwidget toggle-grid []
(box :class "toggle-grid"
(grid-toggle :class "network"
:icon "󰈀"
:header "Network"
:active true ; This sets if toggle is enabled or not, put condition check here
:body "Connected" ; Generally put state here
:visible true
:max-width 128
:max-height 48
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
)
)
(defwidget grid-toggle [ class onclick active ?icon header body visible max-width max-height ]
(eventbox :visible "${visible}"
:onclick "${onclick}"
:class "${class} ${ active ? 'active' : '' }"
(box :class "toggle"
:space-evenly false
:orientation "horizontal"
(label :class "icon"
:visible { icon != "" ? true : false }
:valign "center"
"${icon}")
(box :orientation "vertical"
(label :class "header"
"${header}")
(label :class "body"
"${body}")
)
)
)
)