diff --git a/eww/scripts/unused/notification-daemon.py b/eww/scripts/unused/notification-daemon.py deleted file mode 100644 index 7cf6c9d..0000000 --- a/eww/scripts/unused/notification-daemon.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python - -# Original Script by vimjoyer, modified by retrozinndev -# Licensed under the MIT License, as in vimjoyer's repository and also in retrozinndev's Hyprland Dots. -# This script watches for notifications to display as a popup in eww. - -import threading -import time -import dbus -import dbus.service -import subprocess -import os -import sys -from dbus.mainloop.glib import DBusGMainLoop -from gi.repository import GLib - -class Notification: - def __init__(self, app_name, summary, body, icon, replaces_id): - self.app_name = app_name - self.summary = summary - self.body = body - self.icon = icon - self.replaces_id = replaces_id - -notifications = [] -notification_timeout = 8 # In seconds - -def remove_popup_notification(notification): - time.sleep(notification_timeout) - notifications.remove(notification) - reload_output() - -def add_popup_notification(notification): - notifications.insert(0, notification) - reload_output() - timer_thread = threading.Thread(target=remove_popup_notification, args=(notification,)) - timer_thread.start() - -def reload_output(): - lastItem_notifications = len(notifications) - 1 - output = "" - - os.popen(". /etc/profile; eww open floating-notifications >> /dev/null") - - for item in notifications: - if item is not notifications[lastItem_notifications]: - output = output + f"{{ \"applicationName\": \"{item.app_name}\", \"image\": \"{item.icon}\", \"summary\": \"{item.summary}\", \"body\": \"{item.body}\", \"id\": {item.replaces_id} }}, " - - else: - output = "["+ output + f"{{ \"applicationName\": \"{item.app_name}\", \"image\": \"{item.icon}\", \"summary\": \"{item.summary}\", \"body\": \"{item.body}\", \"id\": {item.replaces_id} }} ]" - - - # Check if notifications(var) is empty - if not notifications: - output = "[]" - os.popen(". /etc/profile; eww close floating-notifications >> /dev/null") - - print(f"{output}", flush=True) - - -class NotificationServer(dbus.service.Object): - def __init__(self): - bus_name = dbus.service.BusName("org.freedesktop.Notifications", bus=dbus.SessionBus()) - dbus.service.Object.__init__(self, bus_name, "/org/freedesktop/Notifications") - - @dbus.service.method("org.freedesktop.Notifications", in_signature="susssasa{ss}i", out_signature="u") - def Notify(self, app_name, replaces_id, icon, summary, body, actions, hints, timeout): - add_popup_notification(Notification(app_name, summary, body, icon, replaces_id)) - return 0 - - @dbus.service.method("org.freedesktop.Notifications", out_signature="ssss") - def GetServerInformation(self): - return ("Custom Notification Server", "ExampleNS", "1.0", "1.2") - - -DBusGMainLoop(set_as_default=True) - -if __name__ == "__main__": - server = NotificationServer() - mainloop = GLib.MainLoop() - mainloop.run() diff --git a/eww/variables.yuck b/eww/variables.yuck index 4d42713..cc037bb 100644 --- a/eww/variables.yuck +++ b/eww/variables.yuck @@ -32,6 +32,10 @@ ; Polls +(defpoll day_name :interval "2s" +`date +"%A"`) +(defpoll month_name :interval "2s" +`date +"%B"`) (defpoll hostname :initial "GNU/Linux" :interval "24h" `cat /etc/hostname`) diff --git a/eww/widgets/bar/clock.yuck b/eww/widgets/bar/clock.yuck index c196bb1..3790f9a 100644 --- a/eww/widgets/bar/clock.yuck +++ b/eww/widgets/bar/clock.yuck @@ -1,6 +1,6 @@ (defwidget clock [] (box :class "clock" - :tooltip { formattime(EWW_TIME, "%A, %B %d") } + :tooltip { day_name + ", " + month_name + formattime(EWW_TIME, " %d") } (eventbox :onclick "sh scripts/eww-window.sh toggle calendar-window" :class '${ window_state_calendar-window == "open" ? "cal-open" : "" } button' @@ -10,7 +10,7 @@ (label :text "󰸗" :class "icon") - (label :text "${ formattime(EWW_TIME, "%A") }") + (label :text "${day_name}") (revealer :reveal { window_state_calendar-window == "closed" } :transition "slideright" diff --git a/eww/widgets/bar/hardware.yuck b/eww/widgets/bar/hardware.yuck index 85aad13..5b5a923 100644 --- a/eww/widgets/bar/hardware.yuck +++ b/eww/widgets/bar/hardware.yuck @@ -6,10 +6,12 @@ :space-evenly false (box :class "cpu" :visible { cpu == "" || cpu ? true : false } + :tooltip { "CPU: " + arraylength(EWW_CPU?.cores) + " Threads" } (label :text " ${ round(EWW_CPU?.avg, 0) }%") ) (box :class "memory" :visible { memory == "" || memory ? true : false } + :tooltip { "Total Memory: " + round(EWW_RAM?.total_mem / 1000000000, 1) + " GiB(s)" } (label :text " ${ round(EWW_RAM?.used_mem_perc, 0) }%") ) ) diff --git a/eww/widgets/bar/media.yuck b/eww/widgets/bar/media.yuck index 0eb08fe..c8a33eb 100644 --- a/eww/widgets/bar/media.yuck +++ b/eww/widgets/bar/media.yuck @@ -45,6 +45,7 @@ (button :class "url" :onclick "wl-copy '${json_media.url}'" :tooltip "Copy link to Clipboard" + :visible { json_media != "" && json_media.url != "null" } "󰌷") (button :class "previous" :onclick "playerctl previous --player=${json_media.player}" diff --git a/eww/widgets/big-media.yuck b/eww/widgets/big-media.yuck index c48ee83..02b11de 100644 --- a/eww/widgets/big-media.yuck +++ b/eww/widgets/big-media.yuck @@ -1,9 +1,9 @@ (defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style ?visible ] - (box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }" - :style "${ show-album-bg ? 'background-image: url(\"${json_media.artUrl}\");' : '' } ${style}" - :visible { visible == "" ? true : "${ visible ? true : false }" } - :space-evenly false - :orientation "vertical" + (box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }" + :style "${ show-album-bg ? "background-image: url(\"${ json_media.artUrl =~ "^(http(.*)://(.*))$" ? json_media.artUrl : "${ "${ json_media.artUrl =~ "^(file://(.*))$" ? '' : 'file://' }" + json_media.artUrl }" }\")" : "" }; ${style}" + :visible { visible == false ? false : true } + :space-evenly false + :orientation "vertical" (box :orientation "horizontal" :space-evenly false @@ -12,32 +12,28 @@ (box :class "album-image" :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}'));" + :style "background-image: url('${ json_media.artUrl =~ "^(http(.*)://(.*))$" ? json_media.artUrl : "${ "${ json_media.artUrl =~ "^(file://(.*))$" ? '' : 'file://' }" + json_media.artUrl }" }');" :valign "center" - :visible { show-album-image ? true : false }) + :visible { json_media.artUrl == "null" || !show-album-image ? false : true }) (box :orientation "vertical" :space-evenly false :class "right" - :hexpand true :valign "center" (box :class "media-info" :space-evenly false - :halign "fill" :orientation "vertical" (label :class "title" :text "${json_media.title}" :xalign 0 - :wrap false - :hexpand true + :limit-width 40 :show-truncated true) (label :class "artist" :text "${json_media.artist}" :xalign 0 - :wrap false - :hexpand true + :limit-width 40 :show-truncated true) ) diff --git a/eww/windows/bar.yuck b/eww/windows/bar.yuck index 09c082f..c1e1193 100644 --- a/eww/windows/bar.yuck +++ b/eww/windows/bar.yuck @@ -50,6 +50,7 @@ :prepend-new false :class "systray" ) + (hardware) (audio) (battery) (network) diff --git a/eww/windows/calendar-window.yuck b/eww/windows/calendar-window.yuck index fecc66b..54a5d77 100644 --- a/eww/windows/calendar-window.yuck +++ b/eww/windows/calendar-window.yuck @@ -13,7 +13,7 @@ :text { formattime(EWW_TIME, "%H:%M") }) (label :class "date" - :text { formattime(EWW_TIME, "%B %d, %Y") }) + :text { month_name + formattime(EWW_TIME, " %d, %Y") }) (calendar :class "month-calendar" :show-details true :show-heading true diff --git a/eww/windows/control-center.yuck b/eww/windows/control-center.yuck index 4fdb2e5..807cdd1 100644 --- a/eww/windows/control-center.yuck +++ b/eww/windows/control-center.yuck @@ -12,14 +12,18 @@ :exclusive false :namespace "eww-cc" - (box :class "cc" - :orientation "vertical" - :space-evenly false + (box :orientation "horizontal" + (eventbox + (box :class "cc" + :orientation "vertical" + :space-evenly false + (top-bar) (tiles) (revealer :reveal { window_state_floating-media != "open" } :transition "slideup" :duration "380ms" + (big-media :show-album-bg true :show-album-image true :visible { json_media == "" || (json_media.title == "null" @@ -29,10 +33,13 @@ (box :class "bottom button-row" :halign "end" :space-evenly false + (button :class "clear-all" :onclick "sh scripts/notification-clear.sh" :visible { arraylength(json_notification_history["history"]) > 0 } "󰎟 Clear") ) + ) ) + ) ) diff --git a/eww/windows/floating-media.yuck b/eww/windows/floating-media.yuck index 0563287..371cb50 100644 --- a/eww/windows/floating-media.yuck +++ b/eww/windows/floating-media.yuck @@ -1,7 +1,7 @@ (defwindow floating-media [] :monitor 0 :geometry (geometry :anchor "top center" - :width "450px") + :width "460px") :exclusive false :stacking "fg" :focusable false @@ -13,7 +13,7 @@ && json_media.artist == "null") ? false : true } (big-media :show-album-bg true - :album-image-size 124 + :album-image-size 128 :show-album-image true :style "margin: 16px; margin-top: 0; box-shadow: 0 5px 6px 1px rgba(0, 0, 0, .6),