balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

[Feature request] Control tab sound #51

Closed kamaradclimber closed 2 years ago

kamaradclimber commented 3 years ago

Hello,

I'd like to mute/unmute sound of a given tab programmatically. It would be very comfortable to be able to use brotab to do this. Do you know if this could be done?

kamaradclimber commented 3 years ago

Looking at the code, one way to let users implement such mechanism would be to allow to execute a user script against a given tab.

Workflow could be then:

# to mute
bt query +audible | awk '{print $1}' | xargs -n1 -I{} bt run {} ./mute.js

# to unmute
bt query +muted | awk '{print $1}' | xargs -n1 -I{} bt run {} ./unmute.js

with (un)mute.js the exact piece of javascript taking a tab in input and muting it.

Of course such feature would allow the ability to inject code (but this extension is already doing this in a way)

balta2ar commented 2 years ago

Now in version 1.4.1 it's possible with update command:

bt query +muted | awk '{print $1}' | xargs -n1 -I{} bt update -tabId={} -muted
kamaradclimber commented 2 years ago

Thanks it works!