Make image viewer user-configurable
MODIFY
config/config.go
config/config.go
@@ -56,6 +56,7 @@ var (
ShowUpdateNotifications: true,
IndicateChannelAccessRestriction: false,
ShowBottomBar: true,
+ ImageViewer: "feh",
}
)
@@ -133,6 +134,12 @@ type Config struct {
// ShowBottomBar decides whether an informational line is shown at the
// bottom of cordless or not.
ShowBottomBar bool
+
+ // The image viewer to open when the user uses the "view attached images"
+ // shortcut. This program will be passed a list of 1 or more image links
+ // as if it were called from the command line, so the selected program
+ // must be capable of opening image links.
+ ImageViewer string
}
// Account has a name and a token. The name is just for the users recognition.

MODIFY
shortcuts/shortcuts.go
shortcuts/shortcuts.go
@@ -31,7 +31,7 @@ var (
chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone))
DeleteSelectedMessage = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message",
chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone))
- ViewSelectedMessageImages = addShortcut("view_selected_message_images", "Open selected message's attached images in feh",
+ ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached images",
chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone))
ExpandSelectionToLeft = addShortcut("expand_selection_word_to_left", "Expand selection word to left",

MODIFY
ui/window.go
ui/window.go
@@ -392,7 +392,7 @@ func NewWindow(doRestart chan bool, app *tview.Application, session *discordgo.S
links = append(links, file.URL)
}
if len(links) > 0 {
- cmd := exec.Command("feh", links...)
+ cmd := exec.Command(config.Current.ImageViewer, links...)
err := cmd.Start()
if err != nil {
window.ShowErrorDialog(err.Error())

Make image viewer user-configurable