mirror of
https://codeberg.org/scip/swayipc.git
synced 2026-08-24 06:44:19 +02:00
renovate the code, update to go 1.26 and satisfy linter (#3)
This commit is contained in:
30
bar.go
30
bar.go
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Container gaps
|
||||
// Gaps stores container gaps
|
||||
type Gaps struct {
|
||||
Top int `json:"top"`
|
||||
Right int `json:"right"`
|
||||
@@ -13,7 +13,7 @@ type Gaps struct {
|
||||
Left int `json:"left"`
|
||||
}
|
||||
|
||||
// Color definition, used primarily by bars
|
||||
// Colors stores color definitions, used primarily by bars
|
||||
type Colors struct {
|
||||
Background string `json:"background"`
|
||||
Statusline string `json:"statusline"`
|
||||
@@ -27,23 +27,23 @@ type Colors struct {
|
||||
InactiveWorkspaceBorder string `json:"inactive_workspace_border"`
|
||||
InactiveWorkspaceBg string `json:"inactive_workspace_bg"`
|
||||
InactiveWorkspaceText string `json:"inactive_workspace_text"`
|
||||
Active_workspaceBorder string `json:"active_workspace_border"`
|
||||
Active_workspaceBg string `json:"active_workspace_bg"`
|
||||
Active_workspaceText string `json:"active_workspace_text"`
|
||||
Urgent_workspaceBorder string `json:"urgent_workspace_border"`
|
||||
Urgent_workspaceBg string `json:"urgent_workspace_bg"`
|
||||
Urgent_workspaceText string `json:"urgent_workspace_text"`
|
||||
ActiveWorkspaceBorder string `json:"active_workspace_border"`
|
||||
ActiveWorkspaceBg string `json:"active_workspace_bg"`
|
||||
ActiveWorkspaceText string `json:"active_workspace_text"`
|
||||
UrgentWorkspaceBorder string `json:"urgent_workspace_border"`
|
||||
UrgentWorkspaceBg string `json:"urgent_workspace_bg"`
|
||||
UrgentWorkspaceText string `json:"urgent_workspace_text"`
|
||||
BindingModeBorder string `json:"binding_mode_border"`
|
||||
BindingModeBg string `json:"binding_mode_bg"`
|
||||
BindingModeText string `json:"binding_mode_text"`
|
||||
}
|
||||
|
||||
// A bar such as a swaybar(5)
|
||||
// Bar stores information about a bar such as a swaybar(5)
|
||||
type Bar struct {
|
||||
Id string `json:"id"`
|
||||
ID string `json:"id"`
|
||||
Mode string `json:"mode"`
|
||||
Position string `json:"position"`
|
||||
Status_command string `json:"status_command"`
|
||||
StatusCommand string `json:"status_command"`
|
||||
Font string `json:"font"`
|
||||
Gaps *Gaps `json:"gaps"`
|
||||
Height int `json:"bar_height"`
|
||||
@@ -57,9 +57,9 @@ type Bar struct {
|
||||
Colors *Colors `json:"colors"`
|
||||
}
|
||||
|
||||
// Get a list of currently visible and active bar names
|
||||
// GetBars returns a list of currently visible and active bar names
|
||||
func (ipc *SwayIPC) GetBars() ([]string, error) {
|
||||
payload, err := ipc.get(GET_BAR_CONFIG)
|
||||
payload, err := ipc.get(MsgGetBarConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -72,9 +72,9 @@ func (ipc *SwayIPC) GetBars() ([]string, error) {
|
||||
return bars, nil
|
||||
}
|
||||
|
||||
// Get the bar object of the bar specified by the string 'id'
|
||||
// GetBar returns the bar object of the bar specified by the string 'id'
|
||||
func (ipc *SwayIPC) GetBar(id string) (*Bar, error) {
|
||||
err := ipc.sendHeader(GET_BAR_CONFIG, uint32(len(id)))
|
||||
err := ipc.sendHeader(MsgGetBarConfig, uint32(len(id)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user