gtkcord

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SpinnerSize  = 56
	ChannelWidth = 240
)
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
	// 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) ChannelID added in v0.1.0

func (a *Application) ChannelID() discord.ChannelID

ChannelID gets the application's channel ID. The same enforcement applies.

func (*Application) Close

func (a *Application) Close()

func (*Application) FocusMessages

func (a *Application) FocusMessages()

func (*Application) GuildID added in v0.1.0

func (a *Application) GuildID() discord.GuildID

GuildID gets the application's guild ID. It enforces the internal application state to be the same.

func (*Application) LogOut

func (a *Application) LogOut()

func (*Application) Ready

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

func (*Application) ShowLogin added in v0.1.0

func (a *Application) ShowLogin(lastToken string)

ShowLogin shows the login screen.

func (*Application) SwitchChannel

func (a *Application) SwitchChannel(ch ChannelContainer)

func (*Application) SwitchDM

func (a *Application) SwitchDM()

func (*Application) SwitchGuild

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

func (*Application) SwitchToID

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

SwitchToID returns true if it can find the channel.

type ChannelContainer added in v0.1.0

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

type Plugin added in v0.0.4

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

	// Auto-detected
	Path string
	Err  error
}

type Settings added in v0.0.4

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"`
}

Jump to

Keyboard shortcuts

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