Add Ctrl+R to mark channels or guilds as unread
MODIFY
go.mod
go.mod
@@ -4,7 +4,7 @@ go 1.12
require (
github.com/Bios-Marcel/discordemojimap v1.0.1
- github.com/Bios-Marcel/discordgo v0.21.2-0.20200810175449-28b4ad667cd5
+ github.com/Bios-Marcel/discordgo v0.21.2-0.20200926180115-c14a2a1ca7fc
github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82
github.com/Bios-Marcel/shortnotforlong v1.1.1
github.com/alecthomas/chroma v0.6.6

MODIFY
go.sum
go.sum
@@ -2,6 +2,16 @@ github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPH
github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU=
github.com/Bios-Marcel/discordgo v0.21.2-0.20200810175449-28b4ad667cd5 h1:9Rp5fAYhne7jA3w5iJYvuMAaG3fq2RkE7cC5h+RCnZY=
github.com/Bios-Marcel/discordgo v0.21.2-0.20200810175449-28b4ad667cd5/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174256-9934ab9b36fa h1:wbTc6OMQgAN0z05rQbBe/VPRrsMaAw04esZP/spzc7w=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174256-9934ab9b36fa/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174359-afe98fecdca8 h1:vObbxh1dV77pUWmwwiGG1zyfUYRGbAt43J4JRUu/w6U=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174359-afe98fecdca8/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174700-fafd5d18ceeb h1:YeZPeKtg+D+tRQZ2yAuX4JsEBcxTuQU6cDprkOHYt3c=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926174700-fafd5d18ceeb/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926175114-652bde567c11 h1:PBDVpxic2VMO16KpMWZopmJ+oKfzr7XnsR/zjWEUBk4=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926175114-652bde567c11/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926180115-c14a2a1ca7fc h1:V6PPtbAWZZsQcH3R99vtQ0/4y5LPdBrjTuZIzWXdmBU=
+github.com/Bios-Marcel/discordgo v0.21.2-0.20200926180115-c14a2a1ca7fc/go.mod h1:bLnfQU0j/SejmPozgW5GepmKvd8CrbMIml2I0IZENVE=
github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9bhboosSISmuX2iq03pUsYHzlJN0s+z4fz4E=
github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU=
github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM=

MODIFY
shortcuts/shortcuts.go
shortcuts/shortcuts.go
@@ -17,6 +17,8 @@ var (
globalScope = addScope("global", "Application wide", nil)
multilineTextInput = addScope("multiline_text_input", "Multiline text input", globalScope)
chatview = addScope("chatview", "Chatview", globalScope)
+ guildlist = addScope("guildlist", "Guildlist", globalScope)
+ channeltree = addScope("channeltree", "Channeltree", globalScope)
QuoteSelectedMessage = addShortcut("quote_selected_message", "Quote selected message",
chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone))
@@ -34,7 +36,7 @@ var (
chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone))
DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message",
chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone))
- ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached images",
+ ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files",
chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone))
ChatViewSelectionUp = addShortcut("selection_up", "Move selection up by one",
chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone))
@@ -141,6 +143,12 @@ var (
ToggleBareChat = addShortcut("toggle_bare_chat", "Toggle bare chat",
globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl))
+ GuildListMarkRead = addShortcut("guild_mark_read", "Mark server as read",
+ guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl))
+
+ ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read",
+ channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl))
+
scopes []*Scope
Shortcuts []*Shortcut
)

MODIFY
ui/window.go
ui/window.go
@@ -832,16 +832,13 @@ func NewWindow(doRestart chan bool, app *tview.Application, session *discordgo.S
window.userList.internalTreeView.SetSearchOnTypeEnabled(true)
window.privateList.internalTreeView.SetSearchOnTypeEnabled(true)
} else if config.Current.OnTypeInListBehaviour == config.FocusMessageInputOnTypeInList {
- guildList.SetInputCapture(tviewutil.CreateFocusTextViewOnTypeInputHandler(
- window.app, window.messageInput.internalTextView))
- channelTree.SetInputCapture(tviewutil.CreateFocusTextViewOnTypeInputHandler(
- window.app, window.messageInput.internalTextView))
- window.userList.SetInputCapture(tviewutil.CreateFocusTextViewOnTypeInputHandler(
- window.app, window.messageInput.internalTextView))
- window.privateList.SetInputCapture(tviewutil.CreateFocusTextViewOnTypeInputHandler(
- window.app, window.messageInput.internalTextView))
- window.chatView.internalTextView.SetInputCapture(tviewutil.CreateFocusTextViewOnTypeInputHandler(
- window.app, window.messageInput.internalTextView))
+ focusTextViewOnTypeInputHandler := tviewutil.CreateFocusTextViewOnTypeInputHandler(
+ window.app, window.messageInput.internalTextView)
+ guildList.SetInputCapture(focusTextViewOnTypeInputHandler)
+ channelTree.SetInputCapture(focusTextViewOnTypeInputHandler)
+ window.userList.SetInputCapture(focusTextViewOnTypeInputHandler)
+ window.privateList.SetInputCapture(focusTextViewOnTypeInputHandler)
+ window.chatView.internalTextView.SetInputCapture(focusTextViewOnTypeInputHandler)
}
//Guild Container arrow key navigation. Please end my life.
@@ -866,6 +863,17 @@ func NewWindow(doRestart chan bool, app *tview.Application, session *discordgo.S
return nil
}
+ if shortcuts.GuildListMarkRead.Equals(event) {
+ selectedGuildNode := guildList.GetCurrentNode()
+ if selectedGuildNode != nil {
+ ackError := window.session.GuildMessageAck(selectedGuildNode.GetReference().(string))
+ if ackError != nil {
+ window.ShowErrorDialog(ackError.Error())
+ }
+ }
+ return nil
+ }
+
return event
}
@@ -913,6 +921,20 @@ func NewWindow(doRestart chan bool, app *tview.Application, session *discordgo.S
return nil
}
+ if shortcuts.ChannelTreeMarkRead.Equals(event) {
+ selectedChannelNode := channelTree.GetCurrentNode()
+ if selectedChannelNode != nil {
+ channel, stateError := window.session.State.Channel(selectedChannelNode.GetReference().(string))
+ if stateError == nil && channel.LastMessageID != "" {
+ _, ackError := window.session.ChannelMessageAck(channel.ID, channel.LastMessageID, "")
+ if ackError != nil {
+ window.ShowErrorDialog(ackError.Error())
+ }
+ }
+ }
+ return nil
+ }
+
return event
}

Add Ctrl+R to mark channels or guilds as unread