Add DisplayMode to UserPreferences

This commit is contained in:
FIGBERT 2023-02-24 19:08:11 -08:00
parent b086d68813
commit a2432d031f
No known key found for this signature in database
GPG key ID: 67F1598D607A844B
3 changed files with 37 additions and 0 deletions

View file

@ -62,6 +62,8 @@ type UserPreferences struct {
AltEnterToSend bool `yaml:"alt_enter_to_send"`
InlineURLMode string `yaml:"inline_url_mode"`
DisplayMode DisplayMode `yaml:"display_mode"`
}
var InlineURLsProbablySupported bool

24
config/display-mode.go Normal file
View file

@ -0,0 +1,24 @@
// gomuks - A terminal Matrix client written in Go.
// Copyright (C) 2020 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package config
type DisplayMode string
const (
DisplayModeIRC DisplayMode = "irc"
DisplayModeModern DisplayMode = "modern"
)

View file

@ -44,6 +44,7 @@ import (
"maunium.net/go/mautrix/format"
"maunium.net/go/mautrix/id"
"maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/lib/filepicker"
)
@ -1040,6 +1041,16 @@ func cmdToggle(cmd *Command) {
cmd.Reply("Force-enabled using fancy terminal features to render URLs inside text. Restart gomuks to apply changes.")
}
continue
case "displaymode":
switch cmd.Config.Preferences.DisplayMode {
case "modern":
cmd.Config.Preferences.DisplayMode = config.DisplayModeIRC
cmd.Reply("Enabled IRC display mode. Restart gomuks to apply changes.")
default:
cmd.Config.Preferences.DisplayMode = config.DisplayModeModern
cmd.Reply("Enabled modern display mode. Restart gomuks to apply changes.")
}
continue
case "newline":
val = &cmd.Config.Preferences.AltEnterToSend
default: