removed useless contexts
This commit is contained in:
parent
103b4c37a8
commit
2dbdc93ac1
@ -1,13 +1,9 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetBarIDs(ctx context.Context) ([]string, error) {
|
||||
func (c *Client) GetBarIDs() ([]string, error) {
|
||||
return sendMessage[[]string](c, 6, "")
|
||||
}
|
||||
|
||||
func (c *Client) GetBarConfig(ctx context.Context, barID string) (*BarConfig, error) {
|
||||
func (c *Client) GetBarConfig(barID string) (*BarConfig, error) {
|
||||
return sendMessage[*BarConfig](c, 6, barID)
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetBindingModes(ctx context.Context) ([]string, error) {
|
||||
func (c *Client) GetBindingModes() ([]string, error) {
|
||||
return sendMessage[[]string](c, 8, "")
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetConfig(ctx context.Context) (string, error) {
|
||||
func (c *Client) GetConfig() (string, error) {
|
||||
cfg, err := sendMessage[config](c, 9, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -1,10 +1,6 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetCurrentBindingMode(ctx context.Context) (string, error) {
|
||||
func (c *Client) GetCurrentBindingMode() (string, error) {
|
||||
mode, err := sendMessage[name](c, 12, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
5
get_inputs.go
Normal file
5
get_inputs.go
Normal file
@ -0,0 +1,5 @@
|
||||
package sway
|
||||
|
||||
func (c *Client) GetInputs() ([]InputDevice, error) {
|
||||
return sendMessage[[]InputDevice](c, 100, "")
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetMarks(ctx context.Context) ([]string, error) {
|
||||
func (c *Client) GetMarks() ([]string, error) {
|
||||
return sendMessage[[]string](c, 5, "")
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetOutputs(ctx context.Context) ([]Output, error) {
|
||||
func (c *Client) GetOutputs() ([]Output, error) {
|
||||
return sendMessage[[]Output](c, 3, "")
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetTree(ctx context.Context) (*Node, error) {
|
||||
func (c *Client) GetTree() (*Node, error) {
|
||||
return sendMessage[*Node](c, 4, "")
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetVersion(ctx context.Context) (*Version, error) {
|
||||
func (c *Client) GetVersion() (*Version, error) {
|
||||
return sendMessage[*Version](c, 7, "")
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) GetWorkspaces(ctx context.Context) ([]Workspace, error) {
|
||||
func (c *Client) GetWorkspaces() ([]Workspace, error) {
|
||||
return sendMessage[[]Workspace](c, 1, "")
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.milar.in/milarin/slices"
|
||||
)
|
||||
|
||||
func (c *Client) RunCommand(ctx context.Context, cmd string) ([]error, error) {
|
||||
func (c *Client) RunCommand(cmd string) ([]error, error) {
|
||||
results, err := sendMessage[[]commandResult](c, 0, cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -1,10 +1,6 @@
|
||||
package sway
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *Client) SendTick(ctx context.Context, payload string) error {
|
||||
func (c *Client) SendTick(payload string) error {
|
||||
result, err := sendMessage[commandResult](c, 10, payload)
|
||||
if err != nil {
|
||||
return err
|
||||
|
48
types.go
48
types.go
@ -255,6 +255,17 @@ const (
|
||||
BarPositionBottom BarPosition = "bottom"
|
||||
)
|
||||
|
||||
type InputDeviceType = string
|
||||
|
||||
const (
|
||||
InputDeviceTypeKeyboard InputDeviceType = "keyboard"
|
||||
InputDeviceTypePointer InputDeviceType = "pointer"
|
||||
InputDeviceTypeTouch InputDeviceType = "touch"
|
||||
InputDeviceTypeTabletTool InputDeviceType = "tablet_tool"
|
||||
InputDeviceTypeTabletPad InputDeviceType = "tablet_pad"
|
||||
InputDeviceTypeSwitch InputDeviceType = "switch"
|
||||
)
|
||||
|
||||
type commandResult struct {
|
||||
Success bool `json:"success"`
|
||||
ParseError bool `json:"parse_error"`
|
||||
@ -331,3 +342,40 @@ type config struct {
|
||||
type name struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type InputDevice struct {
|
||||
Identifier string `json:"identifier"`
|
||||
Name string `json:"name"`
|
||||
Vendor int `json:"vendor"`
|
||||
Product int `json:"product"`
|
||||
Type InputDeviceType `json:"type"`
|
||||
XKBActiveLayoutName string `json:"xkb_active_layout_name"`
|
||||
XKBLayoutNames []string `json:"xkb_layout_names"`
|
||||
XKBActiveLayoutIndex int `json:"xkb_active_layout_index"`
|
||||
ScrollFactor float64 `json:"scroll_factor"`
|
||||
LibInput LibInput `json:"libinput"`
|
||||
}
|
||||
|
||||
func (id InputDevice) String() string {
|
||||
data, _ := json.MarshalIndent(id, "", "\t")
|
||||
return string(data)
|
||||
}
|
||||
|
||||
type LibInput struct {
|
||||
SendEvents string `json:"send_events"`
|
||||
Tap string `json:"tap"`
|
||||
TapButtonMap string `json:"tap_button_map"`
|
||||
TapDrag string `json:"tap_drag"`
|
||||
TapDragLock string `json:"tap_drag_lock"`
|
||||
AccelSpeed float64 `json:"accel_speed"`
|
||||
AccelProfile string `json:"accel_profile"`
|
||||
NaturalScroll string `json:"natural_scroll"`
|
||||
LeftHanded string `json:"left_handed"`
|
||||
ClickMethod string `json:"click_method"`
|
||||
MiddleEmulation string `json:"middle_emulation"`
|
||||
ScrollMethod string `json:"scroll_method"`
|
||||
ScrollButton int `json:"scroll_button"`
|
||||
Dwt string `json:"dwt"`
|
||||
Dwtp string `json:"dwtp"`
|
||||
CalibrationMatrix [6]float64 `json:"calibration_matrix"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user