dotfiles/de/home/.config/eww/modules/home/notes.yuck
2025-07-19 11:00:08 -07:00

38 lines
1.1 KiB
Text

(defpoll notes_list :initial '{"notes":[{"date":"1752630492","filepath":""}]}'
:interval "3600s"
'scripts/home/notes')
(defvar reveal_notes false)
(defwidget notes_revealer []
(revealer-on-press
:revealvar reveal_notes
:revealvar-name "reveal_notes"
:width 300
(button
:width 300
:class "revealer-title"
"Notes ${reveal_notes ? '' : ''}")
(notes :json {jq(notes_list,'.notes')})))
(defwidget notes [json]
(box
:class "notes"
:orientation "v"
:halign "baseline"
; :width 300
:height 150
:space-evenly true
(for note in json
(button :onclick "kate -n '${note.filepath}'"
(box
:orientation "v"
(label
:xalign 0
:wrap false
:truncate true
:text "󰎞 ${replace(note.filepath,"${get_env("HOME")}/Documents/Notes/",'')}")
(label
:xalign 0.5
:class "timestamp"
:text " ${formattime("${note.date}","%F %R")}"))))
))