dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

22 lines850 bytesBourne Again Shell (bash)executable
1#!/usr/bin/env bash
2# Clear button of the notifications panel: play the clear animation, then empty
3# dunst's history. The timings follow eww.scss (.notif transitions, 45ms stagger).
4
5DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6EWW=(eww --config "$DIR")
7
8count=$("${EWW[@]}" get notifs 2>/dev/null | python3 -c 'import json,sys; print(len(json.load(sys.stdin)))' 2>/dev/null)
9count=${count:-0}
10
11# 1. entries slide out one after another: the last one starts after (count-1)*45ms
12# and takes 280ms
13"${EWW[@]}" update notifs_clearing=true
14sleep "$(python3 -c "print((max($count, 1) - 1) * 0.045 + 0.30)")"
15
16# 2. the now invisible list folds up
17"${EWW[@]}" update notifs_folded=true
18sleep 0.24
19
20# 3. actually clear, and reset for the next time
21dunstctl history-clear
22"${EWW[@]}" update notifs='[]' notifs_clearing=false notifs_folded=false