diff --git a/modules/power/cmd/power/templates_test.go b/modules/power/cmd/power/templates_test.go index 71c9b1bd..1ba16b8c 100644 --- a/modules/power/cmd/power/templates_test.go +++ b/modules/power/cmd/power/templates_test.go @@ -84,9 +84,7 @@ func TestEveryFileTakesItsTextFromATemplateOutsideTheUnpackedFiles(t *testing.T) // The bar's blocks are two items of the collection the bar places (design 57 L3, issue 781): the text i3status-rust's // bars hold for the battery and for the power draw, byte for byte as the bar's own template rendered them before, the -// draw's key being the machine's own name. The draw's item says the state its text reads (shows: state, state: -// power.draw), as the bar's contribution said it before, so the bar's holder is granted this machine's key of it (the -// sweep of 2026-10-30, issue 774: moved to an item, it said nothing, and i3status-rust was issued no read). +// draw's key being the machine's own name. func TestTheBarBlocksAreTwoItemsOfTheBarsCollection(t *testing.T) { raw, err := os.ReadFile("../../module.json") if err != nil { @@ -108,20 +106,19 @@ func TestTheBarBlocksAreTwoItemsOfTheBarsCollection(t *testing.T) { if len(m.Contributions) != 0 || len(m.Items) != 2 { t.Fatalf("%d contributions and %d items", len(m.Contributions), len(m.Items)) } - want := []struct{ name, capability, order, reads, template, text string }{ - {"battery", "battery", "40", "", "templates/bar-battery", "[[block]]\nblock = \"battery\"\n" + + want := []struct{ name, capability, order, template, text string }{ + {"battery", "battery", "40", "templates/bar-battery", "[[block]]\nblock = \"battery\"\n" + "format = \"$icon $percentage{ $time|}\"\ncharging_format = \"$icon $percentage{ $time|}\"\n" + "not_charging_format = \"$icon $percentage\"\nfull_format = \"$icon $percentage\"\n" + "empty_format = \"$icon $percentage\"\nmissing_format = \"\"\n\n"}, - {"power-draw", "power-meter", "45", "power.draw", "templates/bar-power-draw", "[[block]]\nblock = \"custom\"\n" + + {"power-draw", "power-meter", "45", "templates/bar-power-draw", "[[block]]\nblock = \"custom\"\n" + "command = \"~/.local/bin/i3status-value power.draw ${machine:name}\"\ninterval = 5\nhide_when_empty = true\n\n"}, } for i, w := range want { it := m.Items[i] if it.Collection != "contribution:node-bar:block" || it.Name != w.name || it.IfCapability != w.capability || it.Template != w.template || it.Attributes["bar"] != "bottom" || it.Attributes["place"] != "status" || - it.Attributes["order"] != w.order || it.Attributes["state"] != w.reads || - (w.reads != "") != (it.Attributes["shows"] == "state") || len(it.Attributes) != map[bool]int{false: 3, true: 5}[w.reads != ""] { + it.Attributes["order"] != w.order || len(it.Attributes) != 3 { t.Errorf("item %d is %+v", i, it) } text, err := os.ReadFile(filepath.Join("../..", w.template)) diff --git a/modules/power/module.json b/modules/power/module.json index c43e601c..909499ad 100644 --- a/modules/power/module.json +++ b/modules/power/module.json @@ -442,9 +442,7 @@ "attributes": { "bar": "bottom", "place": "status", - "order": "45", - "shows": "state", - "state": "power.draw" + "order": "45" }, "template": "templates/bar-power-draw" }