File tree Expand file tree Collapse file tree 5 files changed +18
-2
lines changed
Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ work:
123123 # cross-platform notifications
124124 notification :
125125 enabled : true
126+ urgent : true # persistent notification with alert sound (platform-dependent)
126127 title : work finished 🎉
127128 message : time to take a break
128129 icon : ~/my/icon.png
Original file line number Diff line number Diff line change @@ -163,7 +163,13 @@ func sendNotification(notification config.Notification) {
163163 icon = notification .Icon
164164 }
165165
166- err := beeep .Notify (notification .Title , notification .Message , icon )
166+ var err error
167+ if notification .Urgent {
168+ err = beeep .Alert (notification .Title , notification .Message , icon )
169+ } else {
170+ err = beeep .Notify (notification .Title , notification .Message , icon )
171+ }
172+
167173 if err != nil {
168174 log .Println ("failed to send notification:" , err )
169175 }
@@ -204,7 +210,6 @@ func printSummary() {
204210 fmt .Println (" Total:" , totalWorkDuration + totalBreakDuration )
205211 }
206212
207- // progress bar
208213 totalDuration := totalWorkDuration + totalBreakDuration
209214 workRatio := float64 (totalWorkDuration .Milliseconds ()) / float64 (totalDuration .Milliseconds ())
210215
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ const (
2525
2626type Notification struct {
2727 Enabled bool
28+ Urgent bool
2829 Title string
2930 Message string
3031 Icon string
6768 "title" : "work session" ,
6869 "notification" : map [string ]any {
6970 "enabled" : true ,
71+ "urgent" : false ,
7072 "title" : "work finished 🎉" ,
7173 "message" : "time to take a break!" ,
7274 },
7678 "title" : "break session" ,
7779 "notification" : map [string ]any {
7880 "enabled" : true ,
81+ "urgent" : false ,
7982 "title" : "break over 😴" ,
8083 "message" : "back to work!" ,
8184 },
Original file line number Diff line number Diff line change 9191 "description" : " Enable desktop notifications" ,
9292 "default" : true
9393 },
94+ "urgent" : {
95+ "type" : " boolean" ,
96+ "description" : " Mark notification as urgent" ,
97+ "default" : false
98+ },
9499 "title" : {
95100 "type" : " string" ,
96101 "description" : " Notification title text" ,
Original file line number Diff line number Diff line change 1414 title : work session
1515 notification :
1616 enabled : true
17+ urgent : false
1718 title : work finished 🎉
1819 message : time to take a break
1920 # icon: ~/path/to/icon.png
2526 title : break session
2627 notification :
2728 enabled : true
29+ urgent : false
2830 title : break over 😴
2931 message : back to work!
3032 # icon: C:\Users\path\to\your\icon.png
You can’t perform that action at this time.
0 commit comments