mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 18:43:41 -05:00
Add DisplayMode to UserPreferences
This commit is contained in:
parent
b086d68813
commit
a2432d031f
3 changed files with 37 additions and 0 deletions
|
@ -62,6 +62,8 @@ type UserPreferences struct {
|
||||||
AltEnterToSend bool `yaml:"alt_enter_to_send"`
|
AltEnterToSend bool `yaml:"alt_enter_to_send"`
|
||||||
|
|
||||||
InlineURLMode string `yaml:"inline_url_mode"`
|
InlineURLMode string `yaml:"inline_url_mode"`
|
||||||
|
|
||||||
|
DisplayMode DisplayMode `yaml:"display_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var InlineURLsProbablySupported bool
|
var InlineURLsProbablySupported bool
|
||||||
|
|
24
config/display-mode.go
Normal file
24
config/display-mode.go
Normal 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"
|
||||||
|
)
|
|
@ -44,6 +44,7 @@ import (
|
||||||
"maunium.net/go/mautrix/format"
|
"maunium.net/go/mautrix/format"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
|
"maunium.net/go/gomuks/config"
|
||||||
"maunium.net/go/gomuks/debug"
|
"maunium.net/go/gomuks/debug"
|
||||||
"maunium.net/go/gomuks/lib/filepicker"
|
"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.")
|
cmd.Reply("Force-enabled using fancy terminal features to render URLs inside text. Restart gomuks to apply changes.")
|
||||||
}
|
}
|
||||||
continue
|
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":
|
case "newline":
|
||||||
val = &cmd.Config.Preferences.AltEnterToSend
|
val = &cmd.Config.Preferences.AltEnterToSend
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue