Skip to content

Assign an action/cmd to a named part of the format with [[block.click]]'s widget key #1871

Open
@tkapias

Description

@tkapias

Since PR #1686, overriding a default action is easy, you just need to write a block.click for the same button.

There were many elements that made me think that you could also override the default action for a specific part or write a new action or cmd for a specific part:

  • Presence of the widget key for [[block.click]] in the blocks doc.
  • @MaxVerevkin explaining his idea for widget_key+named_arguments in 2 merged PR conversations here and here.
  • The fact that default blocks can already specify click actions to some parts.

But, apparently the widget key in [[block.click]] is not implemented or need more documentation, when I use it, the action or cmd are not applied, even on existing parts like prev, play...

I tried with names arguments too (.str(name:'player')) but it makes the configuration fail.

  • Following @MaxVerevkin, this is what i'd like to do for the music block:
[[block]]
block = "music"
format = " $icon{ $combo.str(max_w:25)  󰥠 $player.str(max_w:7, widget:'player') { $volume_icon $volume |} $prev $play.str(widget:'play') $next |} "
volume_step = 3
[[block.click]]
button = "right"
action = "next_player"
widget = "player"
[[block.click]]
button = "left"
cmd = "urxvtc -e sh -c 'vimpc'"
widget = "player"
[[block.click]]
button = "right"
action = "mpc stop"
widget = "play"
[[block.click]]
button = "left"
action = "play_pause"
widget = "play"
[[block.click]]
button = "up"
action = "volume_up"
[[block.click]]
button = "down"
action = "volume_down"
[block.theme_overrides]
idle_bg = "#303549"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions