noctuid/zscroll

Support for multiple -M with -m

maplepy opened this issue · 8 comments

At the moment, when using multiple match-commands we get the message If there is more than one '-M', the number must match the number of '-m's. which is very confusing. Should we be using only one -m with -M if we have 2 -M ??

This doesn't make any sense to me....

I'd like to use something like that:

	--match-command "playerctl status" \
	--match-text "Playing"  "--after-text '   '" \
	--match-text "Paused"   "--after-text '   ' --scroll 0" \
	--match-command "playerctl metadata --format '{{playerName}}'" \
	--match-text "spotify"  "--before-text '阮  '" \
	--match-text "firefox"  "--before-text '  '" \
	--update-check true "playerctl metadata --format '{{ artist }} - {{ title }}'" &

but because -m is not following the previous -M it doesn't work

Could you add maybe argument to parse like -M "command_name" "command" to use with -m "command_name" "options" ?

That'd be very useful

You can either have one command or a command for each --match-text. For you example, you wold have to do this:

--match-command "playerctl status" \
--match-text "Playing"  "--after-text '   '" \
--match-command "playerctl status" \
--match-text "Paused"   "--after-text '   ' --scroll 0"
...

Could you add maybe argument to parse like -M "command_name" "command" to use with -m "command_name" "options" ?

The current behavior is more verbose but good enough for your use case. I don't want to break backwards compatibility for these options. I would accept a PR for newly named options, but I don't plan on implementing this behavior myself.

Yes, you could put the string in a variable:

status="playerctl status"
metadata="playerctl metadata --format '{{playerName}}'"

...

--match-command "$status" \
--match-text "Playing"  "--after-text '   '" \
--match-command "$status" \
--match-text "Paused"   "--after-text '   ' --scroll 0"
--match-command "$metadata" \
--match-text "spotify"  "--before-text '阮  '" \
--match-command "$metadata"
--match-text "firefox"  "--before-text '  '" \
...

Ok nice! But if I wanted to have say two icons, both before the text, how could I do it? I have a function that outputs both say  

But I can't use it in the --before-text since it wants to print it right away, how can i put a function there (or at least a var) ?

say I have prefix=" " and I want to have it in the --before-text, something like --before-text "$prefix". How can I use the var because doing it like that doesn't work

How can I use the var because doing it like that doesn't work

What do you mean?

I don't really understand the question. You want to have a --before-text that changes based on some function? If that's what you're asking, it's not possible. Could you more specifically describe the condition where you want two icons printed and the full script you tried?