gtkcord

package
v0.0.5-0...-0379fef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2021 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const LastReadFile = "lastread.json"
View Source
const SettingsFile = "settings.json"

Variables

View Source
var HTTPClient = http.Client{
	Timeout: 10 * time.Second,
}

Functions

This section is empty.

Types

type Application

type Application struct {
	*gtk.Application
	Window *window.Container

	Notifier *gdbus.Notifier
	MPRIS    *gdbus.MPRISWatcher

	Plugins []*Plugin

	State *ningen.State

	// Preferences window, hidden by default
	Settings *Settings

	// Main Grid, left is always LeftGrid - *gtk.Grid
	Main  *handy.Leaflet // LeftGrid -- Right
	Right *singlebox.Box // Stack of Messages or full screen server details TODO

	// Left Grid
	LeftGrid *gtk.Grid

	// Application states
	Header   *header.Header
	Guilds   *guild.Guilds
	Privates *channel.PrivateChannels
	Channels *channel.Channels
	Messages *message.Messages

	// LastRead contains the persistent state of the latest channels mapped from
	// guilds.
	LastRead lastread.State
	// contains filtered or unexported fields
}

func New

func New(app *gtk.Application) *Application

New is not thread-safe.

func (*Application) Activate

func (a *Application) Activate()

func (*Application) Close

func (a *Application) Close()

func (*Application) FocusMessages

func (a *Application) FocusMessages()

func (*Application) LogOut

func (a *Application) LogOut()

func (*Application) Ready

func (a *Application) Ready(s *ningen.State) error

func (*Application) SwitchChannel

func (a *Application) SwitchChannel(ch Channel)

func (*Application) SwitchDM

func (a *Application) SwitchDM()

func (*Application) SwitchGuild

func (a *Application) SwitchGuild(g *guild.Guild)

func (*Application) SwitchLastChannel

func (a *Application) SwitchLastChannel(g *guild.Guild)

SwitchLastChannel, nil for DM.

func (*Application) SwitchToID

func (a *Application) SwitchToID(chID discord.ChannelID, guildID discord.GuildID) bool

SwitchToID returns true if it can find the channel.

type Channel

type Channel interface {
	GuildID() discord.GuildID
	ChannelID() discord.ChannelID
	ChannelInfo() (name, topic string)
}

type Plugin

type Plugin struct {
	// Plugin constants/functions
	Name    string // optional
	Author  string // optional
	OnReady func(a *Application)

	// Auto-detected
	Path string
	Err  error
}

type Settings

type Settings struct {
	*handy.PreferencesWindow `json:"-"`

	General struct {
		*handy.PreferencesPage `json:"-"`

		Behavior struct {
			*handy.PreferencesGroup `json:"-"`

			ZeroWidth bool `json:"zero_width"` // true
			OnTyping  bool `json:"on_typing"`  // true
		}

		Customization struct {
			*handy.PreferencesGroup `json:"-"`

			// only 1 file since files can import others.
			CSSFile string `json:"css_files"`

			// https://xyproto.github.io/splash/docs/all.html
			HighlightStyle string `json:"highlight_style"`

			// Default 750
			MessageWidth int `json:"messages_width"`
		} `json:"customization"`
	} `json:"general"`

	Integrations struct {
		*handy.PreferencesPage `json:"-"`

		RichPresence struct {
			*handy.PreferencesGroup `json:"-"`

			MPRIS bool `json:"mpris"`
		} `json:"rich_presence"`

		// Ignore plugins in config
		Plugins struct {
			*handy.PreferencesGroup `json:"-"`
		} `json:"-"`
	} `json:"integrations"`
}

func MakeSettings

func MakeSettings() *Settings

func (*Settings) InitWidgets

func (s *Settings) InitWidgets(a *Application)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL