diff --git a/cmd/application.go b/cmd/application.go index 31a0ce8..b854427 100644 --- a/cmd/application.go +++ b/cmd/application.go @@ -119,7 +119,9 @@ func (a *application) onPagesInputCapture(event *tcell.EventKey) *tcell.EventKey a.SetFocus(a.messagesList) return nil case a.cfg.Keys.FocusMessageInput: - a.SetFocus(a.messageInput) + if !a.messageInput.GetDisabled() { + a.SetFocus(a.messageInput) + } return nil case a.cfg.Keys.FocusPrevious: a.focusPrevious() diff --git a/cmd/guilds_tree.go b/cmd/guilds_tree.go index 77045a3..a127525 100644 --- a/cmd/guilds_tree.go +++ b/cmd/guilds_tree.go @@ -189,12 +189,17 @@ func (gt *guildsTree) onSelected(node *tview.TreeNode) { app.messagesList.drawMessages(messages) app.messagesList.ScrollToEnd() - hasPerm := channel.Type != discord.DirectMessage && channel.Type != discord.GroupDM && !discordState.HasPermissions(channel.ID, discord.PermissionSendMessages) - app.messageInput.SetDisabled(hasPerm) + hasNoPerm := channel.Type != discord.DirectMessage && channel.Type != discord.GroupDM && !discordState.HasPermissions(channel.ID, discord.PermissionSendMessages) + app.messageInput.SetDisabled(hasNoPerm) + if hasNoPerm { + app.messageInput.SetPlaceholder("You do not have permission to send messages in this channel.") + } else { + app.messageInput.SetPlaceholder("Message...") + app.SetFocus(app.messageInput) + } gt.selectedChannelID = channel.ID gt.selectedGuildID = channel.GuildID - app.SetFocus(app.messageInput) case nil: // Direct messages channels, err := discordState.PrivateChannels() if err != nil { diff --git a/cmd/message_input.go b/cmd/message_input.go index 035a9de..6af4c31 100644 --- a/cmd/message_input.go +++ b/cmd/message_input.go @@ -84,6 +84,11 @@ func newMessageInput(cfg *config.Config) *messageInput { b.BottomLeft, b.BottomRight = b.BottomT, b.BottomT mi.mentionsList.SetBorderSet(b) + mi.TextArea. + SetPlaceholder("Select a channel to start chatting"). + SetPlaceholderStyle(tcell.StyleDefault.Dim(true)). + SetDisabled(true) + return mi }