Files
i3status-go/vendor/go.i3wm.org/i3/config.go
2024-01-06 18:33:44 +03:00

25 lines
568 B
Go

package i3
import "encoding/json"
// Config contains details about the configuration file.
//
// See https://i3wm.org/docs/ipc.html#_config_reply for more details.
type Config struct {
Config string `json:"config"`
}
// GetConfig returns i3’s in-memory copy of the configuration file contents.
//
// GetConfig is supported in i3 ≥ v4.14 (2017-09-04).
func GetConfig() (Config, error) {
reply, err := roundTrip(messageTypeGetConfig, nil)
if err != nil {
return Config{}, err
}
var cfg Config
err = json.Unmarshal(reply.Payload, &cfg)
return cfg, err
}