Compare commits

..

No commits in common. "bce5209fe143059d5ea3f18da0dd2595bd466181" and "c5e9e5f351e50e0c927c9f3da5308b487b3a6c63" have entirely different histories.

7 changed files with 101 additions and 110 deletions

View file

@ -1,18 +1,11 @@
.notification { .notifications-container {
padding: 8px;
.notification {
padding: 6px; padding: 6px;
margin-right: 12px;
margin-bottom: 12px;
background-color: $background; background-color: $background;
border-radius: 20px; border-radius: 20px;
.notification-app-icon {
min-width: 24px;
min-height: 24px;
background-size: cover;
background-position: center center;
}
.notification-icon { .notification-icon {
min-width: 128px; min-width: 128px;
min-height: 128px; min-height: 128px;
@ -29,17 +22,5 @@
font-weight: bold; font-weight: bold;
} }
} }
.notification-buttons {
margin-top: 6px;
.notification-button {
color: $text;
font-size: 0.8em;
padding: 8px;
border-radius: 10px;
margin-right: 12px;
border: 1px solid $text;
}
} }
} }

View file

@ -1,27 +1,23 @@
(defvar close_icon "/usr/share/icons/Qogir-ubuntu-dark/16/actions/window-close.svg") (defvar close_icon "/usr/share/icons/Qogir-ubuntu-dark/16/actions/window-close.svg")
(defvar end-binary "~/.cargo/bin/end-rs") (deflisten notifications :initial '[{"id": 69, "dismissed": false, "app_name": "notify-send", "replaces_id": 0, "app_icon": "/home/gaspard/Images/memes/vroom.png", "summary": "Work period over", "body": "You can take a little nap now.", "actions": [], "hints": {"urgency": 1, "sender-pid": 12406}, "expire_timeout": -1}]' "~/.config/eww/scripts/get-notifications")
(defvar end-notifications '')
(defvar end-histories '')
(defvar end-replies '')
(defvar end-reply-text '')
(defwidget notification[notification] (defwidget notification [notif]
(box (box
:class "notification" :class "notification"
:space-evenly false :space-evenly false
:orientation "v" :orientation "v"
:spacing 6 :spacing 6
(box :orientation "h" :spacing 8 :space-evenly false (box :orientation "h" :spacing 8 :space-evenly false
(box (image
:class "${notification.app_icon ?: "" != "" ? "notification-app-icon" : ""}" :path "/usr/share/icons/Qogir-ubuntu/scalable/apps/spotify.svg"
:style "background-image: url('${notification.app_icon}');" :image-width 24
) :image-height 24)
(label (label
:text "${notification.application}" :text "${notif.app_name}"
:halign "start" :halign "start"
:hexpand true) :hexpand true)
(button :onclick "${end-binary} close ${notification.id}" (button :onclick "dbus-send --session --dest=org.freedesktop.Notifications --type=method_call /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification uint32:${notif.id}"
(image (image
:path "${close_icon}" :path "${close_icon}"
:image-width 24 :image-width 24
@ -30,8 +26,8 @@
) )
(box :orientation "h" :space-evenly false :spacing 8 (box :orientation "h" :space-evenly false :spacing 8
(box (box
:class "${notification.icon != "" ? "notification-icon" : ""}" :class "${notif.app_icon != "" ? "notification-icon" : ""}"
:style "background-image: url('${notification.icon}');" :style "background-image: url('${notif.app_icon}');"
) )
(box (box
:class "notification-text-container" :class "notification-text-container"
@ -40,26 +36,13 @@
:space-evenly false :space-evenly false
(label (label
:class "notification-summary" :class "notification-summary"
:text "${notification.summary}" :text "${notif.summary}"
:halign "start") :halign "start")
(label (label
:text "${notification.body}" :text "${notif.body}"
:wrap true :wrap true
:halign "fill" :halign "fill"
:vexpand true) :vexpand true)
(box
:class "notification-buttons"
:orientation "horizontal"
:space-evenly false
:halign "end"
:vexpand false
(for action in {notification.actions}
(button
:class "notification-button"
:onclick "${end-binary} action ${notification.id} ${action.id}"
:vexpand false
{action.text}))
)
) )
) )
) )
@ -74,5 +57,14 @@
:stacking "overlay" :stacking "overlay"
:focusable false :focusable false
:exclusive true :exclusive true
(literal :content end-notifications) (box
:class "notifications-container"
:orientation "v"
:halign "end"
:valign "end"
:spacing 6
(for notif in {jq(notifications, '[.[] | select(.dismissed == false)]')}
(notification :notif "${notif}")
)
)
) )

View file

@ -0,0 +1,56 @@
#!/usr/bin/env python3
import json
import dbus
from random import randint
from threading import Timer
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
DEFAULT_NOTIF_TIMEOUT = 10 * 1000
notification_history = []
def set_timeout(fn, ms, *args, **kwargs):
t = Timer(ms / 1000, fn, args=args, kwargs=kwargs)
t.start()
return t
def dismiss_notification(notification_id: int):
for notification in notification_history:
if notification["id"] == notification_id:
notification["dismissed"] = True
print(json.dumps(notification_history), flush=True)
def handle_notification(_, message):
keys = ["app_name", "replaces_id", "app_icon", "summary",
"body", "actions", "hints", "expire_timeout"]
args = message.get_args_list()
match message.get_member() :
case "Notify":
notification = dict([(keys[i], args[i]) for i in range(8)])
notification["dismissed"] = False
notification["id"] = randint(0, 8192 * 2)
notification_history.append(notification)
expire_timeout = int(notification["expire_timeout"])
set_timeout(dismiss_notification, expire_timeout if expire_timeout > 0 else DEFAULT_NOTIF_TIMEOUT, notification["id"])
print(json.dumps(notification_history), flush=True)
case "CloseNotification":
dismiss_notification(int(args[0]))
case _:
return
if __name__ == "__main__":
DBusGMainLoop(set_as_default=True)
notification_bus = dbus.SessionBus()
notification_bus.add_match_string("type='method_call',interface='org.freedesktop.Notifications',eavesdrop=true")
notification_bus.add_message_filter(handle_notification)
loop = GLib.MainLoop()
loop.run()

View file

@ -80,6 +80,11 @@ dwindle {
preserve_split = yes # you probably want this preserve_split = yes # you probably want this
} }
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
gestures { gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more # See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = on workspace_swipe = on

View file

@ -2,7 +2,7 @@
exec-once = hyprpm reload -n exec-once = hyprpm reload -n
exec-once = artix-pipewire-launcher restart exec-once = artix-pipewire-launcher restart
exec-once = ~/.cargo/bin/end-rs daemon exec-once = mako
exec-once = wallpaperctl daemon exec-once = wallpaperctl daemon
exec-once = swayosd-server exec-once = swayosd-server
exec-once = udiskie exec-once = udiskie

View file

@ -1,42 +0,0 @@
### Path to the eww binary
eww_binary_path = "/usr/bin/eww"
### Where to find the icons for the notifications
icon_dirs = [
"/usr/share/icons",
"/usr/share/pixmaps",
]
### The theme to use for the icons
icon_theme = "Adwaita"
### The default notification window
### Can be a single string or a vector of strings(for multi-monitor support)
eww_notification_window = "notification_overlay"
### The default notification widget
eww_notification_widget = "notification"
### The variable which contains the literal for the notifications
eww_notification_var = "end-notifications"
### The default history window
eww_history_window = "history-frame"
### The default history widget
eww_history_widget = "end-history"
### The variable which contains the literal for the history
eww_history_var = "end-histories"
### The default reply window
eww_reply_window = "reply-frame"
### The default reply widget
eww_reply_widget = "end-reply"
### The variable which contains the literal for the replies
eww_reply_var = "end-replies"
### The variable which contains content for the reply text
eww_reply_text = "end-reply-text"
### Max notifications to be preserved in history. In case of 0, all notifications will be preserved.
max_notifications = 10
### The orientation of the notifications. Can be either "v" or "h" or "vertical" or "horizontal" (Basically the eww orientation value)
notification_orientation = "v"
### The timeouts for different types of notifications in seconds. A value of 0 means that the notification will never timeout
[timeout]
low = 5
normal = 10
critical = 0

1
sync
View file

@ -57,7 +57,6 @@ synced_files = [
("misc/picom/", "~/.config/picom/"), ("misc/picom/", "~/.config/picom/"),
("misc/runst/", "~/.config/runst/"), ("misc/runst/", "~/.config/runst/"),
("misc/mako/", "~/.config/mako/"), ("misc/mako/", "~/.config/mako/"),
("misc/end-rs/", "~/.config/end-rs/"),
("misc/swayosd/", "~/.config/swayosd/"), ("misc/swayosd/", "~/.config/swayosd/"),
("misc/anyrun/", "~/.config/anyrun/"), ("misc/anyrun/", "~/.config/anyrun/"),
("misc/x11-toggle-gpu/", "~/.local/share/x11-toggle-gpu/"), ("misc/x11-toggle-gpu/", "~/.local/share/x11-toggle-gpu/"),