mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Compare commits
5 Commits
54603090ee
...
62030719bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62030719bb | ||
|
|
985816dc32 | ||
|
|
a131a53132 | ||
|
|
c5e723b6ac | ||
|
|
3fe2b88e65 |
@@ -224,6 +224,14 @@ If this is selected, pop-up reminder boxes will be closed after one minute
|
||||
has elapsed. Otherwise, they remain on your screen forever until you
|
||||
explicitly dismiss them.
|
||||
|
||||
.TP
|
||||
.B Use system notifications when issuing a reminder
|
||||
This option is available only for Tcl/Tk version 9.0 or later, or if
|
||||
you have the \fBnotify-send\fR program installed; it will be greyed
|
||||
out if neither condition is true. If selected, then when a reminder
|
||||
is popped up, it will also be sent to the desktop notification system,
|
||||
causing a notification to appear.
|
||||
|
||||
.TP
|
||||
.B Beep terminal when popping up a reminder
|
||||
If selected, \fBTkRemind\fR beeps the terminal bell when a queued reminder
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# the next line restarts using wish \
|
||||
exec wish "$0" "$@"
|
||||
|
||||
tk appname tkremind
|
||||
|
||||
# We need at least version 8.5 because of {*} list expansion operator
|
||||
if {[catch {package require Tcl 8.5-}]} {
|
||||
puts stderr "This program requires Tcl 8.5 or higher."
|
||||
@@ -30,9 +32,18 @@ set HOME $env(HOME)
|
||||
|
||||
# Check if we have "tk sysnotify"
|
||||
set HAVE_SYSNOTIFY 0
|
||||
set NOTIFY_SEND_PATH ""
|
||||
catch { tk sysnotify } err opt
|
||||
if { [dict get $opt -errorcode] == "TCL WRONGARGS" } {
|
||||
set HAVE_SYSNOTIFY 1
|
||||
} else {
|
||||
set path [split $env(PATH) :]
|
||||
foreach d $path {
|
||||
if { [file executable [file join $d "notify-send"]] } {
|
||||
set NOTIFY_SEND_PATH [file join $d "notify-send"]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc home { f } {
|
||||
@@ -751,7 +762,7 @@ proc CreateCalWindow { dayNames } {
|
||||
# Lets user edit options
|
||||
#***********************************************************************
|
||||
proc EditOptions {} {
|
||||
global Option tmpOpt HAVE_SYSNOTIFY
|
||||
global Option tmpOpt HAVE_SYSNOTIFY NOTIFY_SEND_PATH
|
||||
|
||||
# Make a working copy of current option set
|
||||
foreach name [array names Option] {
|
||||
@@ -788,11 +799,13 @@ proc EditOptions {} {
|
||||
-anchor w -justify left -variable tmpOpt(AutoClose)
|
||||
|
||||
checkbutton $w.sysNotify \
|
||||
-text "Use system notifications when issuing a reminder (Tk >= 9.0)" \
|
||||
-text "Use system notifications when issuing a reminder" \
|
||||
-anchor w -justify left -variable tmpOpt(SysNotify)
|
||||
|
||||
if { ! $HAVE_SYSNOTIFY } {
|
||||
$w.sysNotify configure -state disabled -takefocus 0
|
||||
if { "$NOTIFY_SEND_PATH" == "" } {
|
||||
$w.sysNotify configure -state disabled -takefocus 0
|
||||
}
|
||||
}
|
||||
|
||||
# Ring bell when popping up reminder
|
||||
@@ -2894,7 +2907,7 @@ proc DaemonReadable { file } {
|
||||
# Reads a background reminder from daemon and pops up window.
|
||||
#---------------------------------------------------------------------------
|
||||
proc IssueBackgroundReminder { body time now tag qid } {
|
||||
global BgCounter Option Ignore DaemonFile HAVE_SYSNOTIFY
|
||||
global BgCounter Option Ignore DaemonFile HAVE_SYSNOTIFY NOTIFY_SEND_PATH
|
||||
if {$Option(Deiconify)} {
|
||||
wm deiconify .
|
||||
}
|
||||
@@ -2955,8 +2968,12 @@ proc IssueBackgroundReminder { body time now tag qid } {
|
||||
bell
|
||||
}
|
||||
if {$Option(SysNotify)} {
|
||||
if ($HAVE_SYSNOTIFY) {
|
||||
if {$HAVE_SYSNOTIFY} {
|
||||
tk sysnotify "Reminder for $time" $body
|
||||
} elseif {"$NOTIFY_SEND_PATH" != "" } {
|
||||
catch {
|
||||
exec $NOTIFY_SEND_PATH -a tkremind -i dialog-information "Reminder for $time" "$body"
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$Option(RunCmd) != ""} {
|
||||
|
||||
Reference in New Issue
Block a user