Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions cmd_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"log"
"os"
"os/exec"
"regexp"
"time"

aw "github.com/deanishe/awgo"
Expand Down Expand Up @@ -144,18 +145,30 @@ func doEvents() error {
Var("action", "open")

if e.Location != "" {
app := "Google Maps"
if opts.UseAppleMaps {
app = "Apple Maps"
}
re := regexp.MustCompile(`https:\/\/([\w\-])+\.{1}([a-zA-Z]{2,63})([\/\w-]*)*\/?\??([^#\n\r, ]*)?`)
url := re.FindString(e.Location)

if url != "" {
it.NewModifier("cmd").
Subtitle("Open "+url).
Arg(url).
Valid(true).
Icon(icon).
Var("action", "open")
} else {
app := "Google Maps"
if opts.UseAppleMaps {
app = "Apple Maps"
}

icon := ColouredIcon(iconMap, e.Colour)
it.NewModifier("cmd").
Subtitle("Open in "+app).
Arg(mapURL(e.Location)).
Valid(true).
Icon(icon).
Var("CALENDAR_APP", "") // Don't open Maps URLs in CALENDAR_APP
icon := ColouredIcon(iconMap, e.Colour)
it.NewModifier("cmd").
Subtitle("Open in "+app).
Arg(mapURL(e.Location)).
Valid(true).
Icon(icon).
Var("CALENDAR_APP", "") // Don't open Maps URLs in CALENDAR_APP
}
}
}

Expand Down