Compare commits
4 commits
c5e9e5f351
...
bce5209fe1
Author | SHA1 | Date | |
---|---|---|---|
|
bce5209fe1 | ||
|
129d6fa881 | ||
|
63c1da3f34 | ||
|
13f8a8707c |
7 changed files with 110 additions and 101 deletions
|
@ -1,11 +1,18 @@
|
||||||
.notifications-container {
|
.notification {
|
||||||
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;
|
||||||
|
@ -22,5 +29,17 @@
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
(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")
|
||||||
|
|
||||||
(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-binary "~/.cargo/bin/end-rs")
|
||||||
|
(defvar end-notifications '')
|
||||||
|
(defvar end-histories '')
|
||||||
|
(defvar end-replies '')
|
||||||
|
(defvar end-reply-text '')
|
||||||
|
|
||||||
(defwidget notification [notif]
|
(defwidget notification[notification]
|
||||||
(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
|
||||||
(image
|
(box
|
||||||
:path "/usr/share/icons/Qogir-ubuntu/scalable/apps/spotify.svg"
|
:class "${notification.app_icon ?: "" != "" ? "notification-app-icon" : ""}"
|
||||||
:image-width 24
|
:style "background-image: url('${notification.app_icon}');"
|
||||||
:image-height 24)
|
)
|
||||||
(label
|
(label
|
||||||
:text "${notif.app_name}"
|
:text "${notification.application}"
|
||||||
:halign "start"
|
:halign "start"
|
||||||
:hexpand true)
|
:hexpand true)
|
||||||
(button :onclick "dbus-send --session --dest=org.freedesktop.Notifications --type=method_call /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification uint32:${notif.id}"
|
(button :onclick "${end-binary} close ${notification.id}"
|
||||||
(image
|
(image
|
||||||
:path "${close_icon}"
|
:path "${close_icon}"
|
||||||
:image-width 24
|
:image-width 24
|
||||||
|
@ -26,8 +30,8 @@
|
||||||
)
|
)
|
||||||
(box :orientation "h" :space-evenly false :spacing 8
|
(box :orientation "h" :space-evenly false :spacing 8
|
||||||
(box
|
(box
|
||||||
:class "${notif.app_icon != "" ? "notification-icon" : ""}"
|
:class "${notification.icon != "" ? "notification-icon" : ""}"
|
||||||
:style "background-image: url('${notif.app_icon}');"
|
:style "background-image: url('${notification.icon}');"
|
||||||
)
|
)
|
||||||
(box
|
(box
|
||||||
:class "notification-text-container"
|
:class "notification-text-container"
|
||||||
|
@ -36,13 +40,26 @@
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
(label
|
(label
|
||||||
:class "notification-summary"
|
:class "notification-summary"
|
||||||
:text "${notif.summary}"
|
:text "${notification.summary}"
|
||||||
:halign "start")
|
:halign "start")
|
||||||
(label
|
(label
|
||||||
:text "${notif.body}"
|
:text "${notification.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}))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -57,14 +74,5 @@
|
||||||
:stacking "overlay"
|
:stacking "overlay"
|
||||||
:focusable false
|
:focusable false
|
||||||
:exclusive true
|
:exclusive true
|
||||||
(box
|
(literal :content end-notifications)
|
||||||
:class "notifications-container"
|
|
||||||
:orientation "v"
|
|
||||||
:halign "end"
|
|
||||||
:valign "end"
|
|
||||||
:spacing 6
|
|
||||||
(for notif in {jq(notifications, '[.[] | select(.dismissed == false)]')}
|
|
||||||
(notification :notif "${notif}")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
#!/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()
|
|
|
@ -80,11 +80,6 @@ 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
|
||||||
|
|
|
@ -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 = mako
|
exec-once = ~/.cargo/bin/end-rs daemon
|
||||||
exec-once = wallpaperctl daemon
|
exec-once = wallpaperctl daemon
|
||||||
exec-once = swayosd-server
|
exec-once = swayosd-server
|
||||||
exec-once = udiskie
|
exec-once = udiskie
|
||||||
|
|
42
misc/end-rs/config.toml
Normal file
42
misc/end-rs/config.toml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
### 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
1
sync
|
@ -57,6 +57,7 @@ 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/"),
|
||||||
|
|
Loading…
Reference in a new issue