refactor(core): tidy bind returns and sentCache doc
- commit
- b3cee94adf54427a27b4eede88ab22d4542ec16a
- author
- brice · · 2026-10-08 06:07 UTC
- parent
- 640f800
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +4 -10
M internal/core/core.go +2 -2
| @@ -149,8 +149,8 @@ type Core struct { | |||
| 149 | 149 | pulse focusPulse | |
| 150 | 150 | } | |
| 151 | 151 | ||
| 152 | - | // sentCache is what core last sent on its latest-only channels; an | |
| 153 | - | // unchanged value is not sent again. | |
| 152 | + | // sentCache is what core last sent to wayland and on its latest-only | |
| 153 | + | // channels; an unchanged value is not sent again. | |
| 154 | 154 | type sentCache struct { | |
| 155 | 155 | outputs ports.SetOutputs | |
| 156 | 156 | state ports.State | |
| @@ -149,8 +149,8 @@ type Core struct { | |||||
| 149 | pulse focusPulse | 149 | pulse focusPulse | ||
| 150 | } | 150 | } | ||
| 151 | 151 | ||||
| 152 | - | // sentCache is what core last sent on its latest-only channels; an | 152 | + | // sentCache is what core last sent to wayland and on its latest-only |
| 153 | - | // unchanged value is not sent again. | 153 | + | // channels; an unchanged value is not sent again. |
| 154 | type sentCache struct { | 154 | type sentCache struct { | ||
| 155 | outputs ports.SetOutputs | 155 | outputs ports.SetOutputs | ||
| 156 | state ports.State | 156 | state ports.State | ||
M internal/core/input.go +2 -8
| @@ -323,10 +323,7 @@ func (c *Core) runBind(ctx context.Context, action Action) error { | |||
| 323 | 323 | return err | |
| 324 | 324 | } | |
| 325 | 325 | } | |
| 326 | - | if err := c.publish(ctx); err != nil { | |
| 327 | - | return err | |
| 328 | - | } | |
| 329 | - | return nil | |
| 326 | + | return c.publish(ctx) | |
| 330 | 327 | } | |
| 331 | 328 | ||
| 332 | 329 | // scaleBind steps the focused output's scale and asks for it to be saved. | |
| @@ -346,8 +343,5 @@ func (c *Core) scaleBind(ctx context.Context, action Action) error { | |||
| 346 | 343 | default: | |
| 347 | 344 | } | |
| 348 | 345 | } | |
| 349 | - | if err := c.publish(ctx); err != nil { | |
| 350 | - | return err | |
| 351 | - | } | |
| 352 | - | return nil | |
| 346 | + | return c.publish(ctx) | |
| 353 | 347 | } | |
| @@ -323,10 +323,7 @@ func (c *Core) runBind(ctx context.Context, action Action) error { | |||||
| 323 | return err | 323 | return err | ||
| 324 | } | 324 | } | ||
| 325 | } | 325 | } | ||
| 326 | - | if err := c.publish(ctx); err != nil { | 326 | + | return c.publish(ctx) |
| 327 | - | return err | |||
| 328 | - | } | |||
| 329 | - | return nil | |||
| 330 | } | 327 | } | ||
| 331 | 328 | ||||
| 332 | // scaleBind steps the focused output's scale and asks for it to be saved. | 329 | // scaleBind steps the focused output's scale and asks for it to be saved. | ||
| @@ -346,8 +343,5 @@ func (c *Core) scaleBind(ctx context.Context, action Action) error { | |||||
| 346 | default: | 343 | default: | ||
| 347 | } | 344 | } | ||
| 348 | } | 345 | } | ||
| 349 | - | if err := c.publish(ctx); err != nil { | 346 | + | return c.publish(ctx) |
| 350 | - | return err | |||
| 351 | - | } | |||
| 352 | - | return nil | |||
| 353 | } | 347 | } | ||