greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

block.click foobared #2082

Closed tbaumann closed 2 months ago

tbaumann commented 2 months ago
[[block]]
block = "keyboard_layout"
driver = "sway"

[[block]]
block = "music"
format = "$icon {$combo.str(max_w:20,rot_interval:0.5) $play $next |}"

[[block]]
block = "sound"

[block.click]
button = "left"
cmd = "pavucontrol"

[[block]]
block = "time"
format = " $timestamp.datetime(f:'%a %d/%m %R') "
interval = 60

[[block]]
block = "custom"
command = "wttrbar --location Marrakech"
json = true

[[block]]
block = "menu"
text = " "

[[block.items]]
cmd = "systemctl suspend"
display = " ->   Sleep   <-"

[[block.items]]
cmd = "poweroff"
confirm_msg = "Are you sure you want to power off?"
display = " -> Power Off <-"

[[block.items]]
cmd = "reboot"
confirm_msg = "Are you sure you want to reboot?"
display = " ->  Reboot   <-"

[icons]
icons = "awesome6"

[theme]
theme = "ctp-frappe"

output

{"version": 1, "click_events": true}
[
[{"full_text":"Failed to deserialize TOML file /home/tilli/.config/i3status-rust/config-default.toml at line 9: invalid type: map, expected a sequence","color":"#DC322FFF","background":"#000000FF","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],

Failed to deserialize TOML file /home/tilli/.config/i3status-rust/config-default.toml at line 9: invalid type: map, expected a sequence

[src/main.rs:55:9] error = NotInBlock(
    Error {
        message: Some(
            "Failed to deserialize TOML file /home/tilli/.config/i3status-rust/config-default.toml at line 9: invalid type: map, expected a sequence",
        ),
        cause: None,
    },
)

The problem is in the click block of

[[block]]
block = "sound"

[block.click]
button = "left"
cmd = "pavucontrol"

Isn't that identical to https://github.com/greshake/i3status-rust/blob/433d2e0fbd9bfcb6de02c84f0eed3a24345d6181/examples/config.toml#L38 ?

MaxVerevkin commented 2 months ago

Isn't that identical to

No, [[block.click]] designates an element of block.click array while [block.click] refers to the block.click object.

tbaumann commented 2 months ago

Ah I didn't see the double brackets. Thank you.

I'm generating the file through nix Home-Manager, I have to figure out how to do this right. I thought click = {} was the right syntax but it's clearly not.

tbaumann commented 2 months ago

I'm AFK but I guess

click = [
{
 cmd = ...
}
];

would do it...

tbaumann commented 2 months ago

That was it. It was even documented like that. Sorry fort wasting your time.