Add option to disable typing notifications (#63)
This commit is contained in:
parent
c3f30a160f
commit
bf84fc09b2
16
README.md
16
README.md
@ -32,9 +32,13 @@ or compile from source:
|
|||||||
- jump to room - `Alt + Enter`, then `Tab` and `Enter` to navigate and select room
|
- jump to room - `Alt + Enter`, then `Tab` and `Enter` to navigate and select room
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
* `/quit` - Close gomuks
|
* `help` - Is a known command
|
||||||
* `/logout` - Log out, clear caches and go back to the login view
|
* `me <text>` - Send an emote
|
||||||
* `/clearcache` - Clear room state cache and close gomuks
|
* `quit` - Close gomuks
|
||||||
* `/leave` - Leave the current room
|
* `clearcache` - Clear room state and close gomuks
|
||||||
* `/join <room>` - Join the room with the given room ID or alias
|
* `leave` - Leave the current room
|
||||||
* `/panic` - Trigger a test panic
|
* `join <room>` - Join the room with the given room ID or alias
|
||||||
|
* `toggle <rooms/users/baremessages/images/typingnotif>` - Change user preferences
|
||||||
|
* `logout` - Log out, clear caches and go back to the login view
|
||||||
|
* `send <room id> <event type> <content>` - Send a custom event
|
||||||
|
* `setstate <room id> <event type> <state key/`-`> <content>` - Change room state
|
||||||
|
@ -37,10 +37,11 @@ type AuthCache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UserPreferences struct {
|
type UserPreferences struct {
|
||||||
HideUserList bool `yaml:"hide_user_list"`
|
HideUserList bool `yaml:"hide_user_list"`
|
||||||
HideRoomList bool `yaml:"hide_room_list"`
|
HideRoomList bool `yaml:"hide_room_list"`
|
||||||
BareMessageView bool `yaml:"bare_message_view"`
|
BareMessageView bool `yaml:"bare_message_view"`
|
||||||
DisableImages bool `yaml:"disable_images"`
|
DisableImages bool `yaml:"disable_images"`
|
||||||
|
DisableTypingNotifs bool `yaml:"disable_typing_notifs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config contains the main config of gomuks.
|
// Config contains the main config of gomuks.
|
||||||
|
@ -88,7 +88,7 @@ func NewCommandProcessor(parent *MainView) *CommandProcessor {
|
|||||||
"clearcache": cmdClearCache,
|
"clearcache": cmdClearCache,
|
||||||
"leave": cmdLeave,
|
"leave": cmdLeave,
|
||||||
"join": cmdJoin,
|
"join": cmdJoin,
|
||||||
"uitoggle": cmdUIToggle,
|
"toggle": cmdToggle,
|
||||||
"logout": cmdLogout,
|
"logout": cmdLogout,
|
||||||
"sendevent": cmdSendEvent,
|
"sendevent": cmdSendEvent,
|
||||||
"setstate": cmdSetState,
|
"setstate": cmdSetState,
|
||||||
|
@ -18,10 +18,10 @@ package ui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"maunium.net/go/gomuks/debug"
|
|
||||||
"strings"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/lucasb-eyer/go-colorful"
|
"github.com/lucasb-eyer/go-colorful"
|
||||||
|
"maunium.net/go/gomuks/debug"
|
||||||
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ func cmdRainbow(cmd *Command) {
|
|||||||
html.WriteRune(char)
|
html.WriteRune(char)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
color := rainbow.GetInterpolatedColorFor(float64(i)/float64(len(text))).Hex()
|
color := rainbow.GetInterpolatedColorFor(float64(i) / float64(len(text))).Hex()
|
||||||
fmt.Fprintf(&html, "<font color=\"%s\">%c</font>", color, char)
|
fmt.Fprintf(&html, "<font color=\"%s\">%c</font>", color, char)
|
||||||
}
|
}
|
||||||
tempMessage := cmd.Room.NewTempMessage("m.text", html.String())
|
tempMessage := cmd.Room.NewTempMessage("m.text", html.String())
|
||||||
@ -182,9 +182,9 @@ func cmdSetState(cmd *Command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdUIToggle(cmd *Command) {
|
func cmdToggle(cmd *Command) {
|
||||||
if len(cmd.Args) == 0 {
|
if len(cmd.Args) == 0 {
|
||||||
cmd.Reply("Usage: /uitoggle <rooms/users/baremessages/images>")
|
cmd.Reply("Usage: /toggle <rooms/users/baremessages/images/typingnotif>")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch cmd.Args[0] {
|
switch cmd.Args[0] {
|
||||||
@ -196,11 +196,14 @@ func cmdUIToggle(cmd *Command) {
|
|||||||
cmd.Config.Preferences.BareMessageView = !cmd.Config.Preferences.BareMessageView
|
cmd.Config.Preferences.BareMessageView = !cmd.Config.Preferences.BareMessageView
|
||||||
case "images":
|
case "images":
|
||||||
cmd.Config.Preferences.DisableImages = !cmd.Config.Preferences.DisableImages
|
cmd.Config.Preferences.DisableImages = !cmd.Config.Preferences.DisableImages
|
||||||
|
case "typingnotif":
|
||||||
|
cmd.Config.Preferences.DisableTypingNotifs = !cmd.Config.Preferences.DisableTypingNotifs
|
||||||
default:
|
default:
|
||||||
cmd.Reply("Usage: /uitoggle <rooms/users/baremessages/images>")
|
cmd.Reply("Usage: /toggle <rooms/users/baremessages/images/typingnotif>")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cmd.UI.Render()
|
// is there a reason this is called twice?
|
||||||
|
// cmd.UI.Render()
|
||||||
cmd.UI.Render()
|
cmd.UI.Render()
|
||||||
go cmd.Matrix.SendPreferencesToMatrix()
|
go cmd.Matrix.SendPreferencesToMatrix()
|
||||||
}
|
}
|
||||||
|
@ -102,10 +102,12 @@ func (view *MainView) MarkRead(roomView *RoomView) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (view *MainView) InputChanged(roomView *RoomView, text string) {
|
func (view *MainView) InputChanged(roomView *RoomView, text string) {
|
||||||
if len(text) == 0 {
|
if !roomView.config.Preferences.DisableTypingNotifs {
|
||||||
go view.matrix.SendTyping(roomView.Room.ID, false)
|
if len(text) == 0 {
|
||||||
} else if text[0] != '/' {
|
go view.matrix.SendTyping(roomView.Room.ID, false)
|
||||||
go view.matrix.SendTyping(roomView.Room.ID, true)
|
} else if text[0] != '/' {
|
||||||
|
go view.matrix.SendTyping(roomView.Room.ID, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user