diff --git a/docs/WHATSNEW b/docs/WHATSNEW index 9d607f6e..e2854083 100644 --- a/docs/WHATSNEW +++ b/docs/WHATSNEW @@ -7,14 +7,15 @@ CHANGES TO REMIND the location and a longer description. The intention is to make Remind <-> iCal conversions preserve as much information as possible. -- NEW FEATURE: rem2html, rem2pdf: Add support for the "Url:" info - string that turns reminders into hyper-links. For example, consider - this reminder: +- NEW FEATURE: rem2html, rem2pdf, tkremind: Add support for the "Url:" + info string that turns reminders into hyper-links. For example, + consider this reminder: REM 15 INFO "Url: https://foo.example" MSG Foo The text "Foo" will be made into a link to "https://foo.example" - by rem2html and rem2pdf. + by rem2html and rem2pdf. If you middle-click it in tkremind, it + will open the URL. - NEW FEATURE: remind: Add the triginfo() built-in function so a reminder body can refer to INFO data. Add the %<...> substitution filter as a diff --git a/man/tkremind.1.in b/man/tkremind.1.in index cd94f9fc..fbfd6c0b 100644 --- a/man/tkremind.1.in +++ b/man/tkremind.1.in @@ -103,9 +103,10 @@ The sixth control specifies what \fBRemind\fR should do if a reminder falls on a holiday or weekend. Enter the body of the reminder into the \fBSummary:\fR text entry. If -you want, you can enter a location and longer description in the -\fBLocation:\fR and \fBDescription:\fR boxes. If you enter anything -here, they will be added as \fBINFO\fR items to the reminder. +you want, you can enter a location, a URL, and and longer description +in the \fBLocation:\fR, \fBURL:\fR and \fBDescription:\fR boxes. If +you enter anything here, they will be added as \fBINFO\fR items to the +reminder. To add the reminder to the reminder file, click \fBAdd to reminder file\fR. To close the dialog without adding the reminder to the file, click @@ -186,6 +187,11 @@ If a reminder has location or description \fBINFO\fR items, then hovering over the reminder will pop up a window containing the location and/or description information. +.SH HYPERLINKS + +If a reminder has a "Url:" INFO string set, then middle-clicking +will open the URL using \fBxdg-open\fR. + .SH ERRORS If there are any errors in your reminder file, the "Queue..." button diff --git a/scripts/tkremind.in b/scripts/tkremind.in index 22277cd8..06bfbdeb 100644 --- a/scripts/tkremind.in +++ b/scripts/tkremind.in @@ -585,6 +585,7 @@ proc CreateCalFrame { w dayNames } { -highlightthickness 0 frame $w.f$f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0 $w.t$f tag bind TAGGED "EditTaggedReminder $w.t$f" + $w.t$f tag bind REM "OpenUrl $w.t$f" $w.t$f tag bind REM "FireEditor $w.t$f" pack $w.l$f -in $w.f$f -side top -expand 0 -fill x pack $w.t$f -in $w.f$f -side top -expand 1 -fill both @@ -635,6 +636,7 @@ proc ConfigureCalFrame { w firstDay numDays } { $w.t$i tag delete $t } $w.t$i tag bind TAGGED "EditTaggedReminder $w.t$i" + $w.t$i tag bind REM "OpenUrl $w.t$i" $w.t$i tag bind REM "FireEditor $w.t$i" $w.t$i configure -state disabled -takefocus 0 } @@ -656,6 +658,7 @@ proc ConfigureCalFrame { w firstDay numDays } { $w.t$i tag delete $t } $w.t$i tag bind TAGGED "EditTaggedReminder $w.t$i" + $w.t$i tag bind REM "OpenUrl $w.t$i" $w.t$i tag bind REM "FireEditor $w.t$i" $w.t$i configure -state disabled -takefocus 0 } @@ -686,6 +689,7 @@ proc ConfigureCalFrame { w firstDay numDays } { $w.t$i tag delete $t } $w.t$i tag bind TAGGED "EditTaggedReminder $w.t$i" + $w.t$i tag bind REM "OpenUrl $w.t$i" $w.t$i tag bind REM "FireEditor $w.t$i" $w.t$i configure -state disabled -takefocus 0 } @@ -1925,24 +1929,31 @@ proc CreateModifyDialog {w day firstDay args} { grid $w.msglab -row 0 -column 0 -in $w.msg -sticky e grid $w.entry -row 0 -column 1 -in $w.msg -sticky nsew - # LOCATION and DESCRIPTION + # LOCATION, DESCRIPTION and URL label $w.loclab -text "Location: " entry $w.location balloon_add_help $w.location "Enter the location, if any" grid $w.loclab -row 1 -column 0 -in $w.msg -sticky e grid $w.location -row 1 -column 1 -in $w.msg -sticky nsew + label $w.urllab -text "URL: " + entry $w.url + balloon_add_help $w.url "Enter the URL, if any" + grid $w.urllab -row 2 -column 0 -in $w.msg -sticky e + grid $w.url -row 2 -column 1 -in $w.msg -sticky nsew + label $w.desclab -text "Description: " text $w.description -width 80 -height 5 balloon_add_help $w.description "Enter a detailed description, if any" - grid $w.desclab -row 2 -column 0 -in $w.msg -sticky e - grid $w.description -row 2 -column 1 -in $w.msg -sticky nsew + grid $w.desclab -row 3 -column 0 -in $w.msg -sticky e + grid $w.description -row 3 -column 1 -in $w.msg -sticky nsew grid columnconfigure $w.msg 0 -weight 0 grid columnconfigure $w.msg 1 -weight 1 grid rowconfigure $w.msg 0 -weight 0 grid rowconfigure $w.msg 1 -weight 0 - grid rowconfigure $w.msg 2 -weight 1 + grid rowconfigure $w.msg 2 -weight 0 + grid rowconfigure $w.msg 3 -weight 1 # BUTTONS set nbut 0 foreach but $args { @@ -2309,6 +2320,11 @@ proc CreateReminder {w} { set description "Description: $description" append rem " INFO [RemQuotedString $description]" } + set url [string trim [$w.url get]] + if {$url != ""} { + set url "Url: $url" + append rem " INFO [RemQuotedString $url]" + } # Check it out! global Remind set f [open "|$Remind -arq -e - 2>@1" r+] @@ -3524,6 +3540,9 @@ proc ReadTaggedOptions { tag date } { if {[dict exists $info location]} { lappend ans -entry-location [dict get $info location] } + if {[dict exists $info url]} { + lappend ans -entry-url [dict get $info url] + } if {[dict exists $info description]} { lappend ans -txtentry-description [dict get $info description] } @@ -3659,6 +3678,29 @@ proc EditableLeave { w } { $w tag configure $tag -underline 0 } +proc OpenUrl { w } { + global SynToObj Balloon + set tags [$w tag names current] + set index [lsearch -glob $tags "__syn__*"] + if {$index < 0} { + return + } + set syntag [lindex $tags $index] + if {![info exists SynToObj($syntag)]} { + return + } + set obj $SynToObj($syntag) + if {![dict exists $obj info]} { + return + } + set info [dict get $obj info] + if {![dict exists $info url]} { + return + } + set url [dict get $info url] + exec xdg-open "$url" +} + proc details_enter { w } { global SynToObj Balloon set tags [$w tag names current] @@ -3673,7 +3715,7 @@ proc details_enter { w } { set obj $SynToObj($syntag) set lines {} if {![dict exists $obj info]} { - return; + return } set info [dict get $obj info] set llen 0 @@ -3683,6 +3725,9 @@ proc details_enter { w } { if {[dict exists $info description]} { lappend lines [list "Description:" [dict get $info description]] } + if {[dict exists $info url]} { + lappend lines [list "URL:" "Middle-click to open [dict get $info url]"] + } if {[llength $lines] < 1} { return; }