-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] mute/unmute with a command #887
Comments
isn't this what you are asking for? #609 |
yep, hope it gets merged soon! |
Workaround for any Discord client to toggle micro on Linux with PipeWire Launch Vesktop with custom property to filter input recorder: PULSE_PROP="discord.id=vesktop" vesktop For now, we can find the ID of input recorder, used by vesktop: pw-dump | jq ".[] | select(.info.props.\"discord.id\" == \"vesktop\" and .info.props.\"media.name\" == \"RecordStream\") | .id" And we can change mute param: pw-cli set-param STREAM_ID Props "{mute: STATE}" Ready to use script:#!/bin/bash
: ${DISCORD_ID:=vesktop}
# Optional true/false value to enforce specific state (Useful for keybinds on hold key state)
WANT_MUTE=$1
STREAM_IDS=(`pw-dump | jq ".[] | select(.info.props.\"discord.id\" == \"${DISCORD_ID}\"and .info.props.\"media.name\" == \"RecordStream\") | .id"`)
if [[ -z "${STREAM_IDS[@]}" ]]; then
if [[ -z "$WANT_MUTE" ]]; then
notify-send -i error -a "$DISCORD_ID" "Discord microphone" "Status not changed: cannot find the micro.\nPossible reasons:\n - The field 'discord.id' missmatch\n - You not connect to voice channel"
fi
exit 0
fi
# For mutiple same inputs sync on first
STATE=`pw-cli enum-params ${STREAM_IDS[0]} Props | awk '/Prop: key.*mute/{getline; print $2}'`
for STREAM_ID in "${STREAM_IDS[@]}"; do
LOCAL_STATE=`pw-cli enum-params $STREAM_ID Props | awk '/Prop: key.*mute/{getline; print $2}'`
if [[ "$LOCAL_STATE" == "$WANT_MUTE" ]]; then
continue
fi
if [[ "$STATE" == "true" ]]; then
pw-cli set-param $STREAM_ID Props "{mute: false}" > /dev/null
else
pw-cli set-param $STREAM_ID Props "{mute: true}" > /dev/null
fi
done
if [[ "$STATE" == "$WANT_MUTE" ]]; then
exit 0
fi
if [[ "$STATE" == "true" ]]; then
notify-send -i microphone-sensitivity-high -a "$DISCORD_ID" "Discord microphone" "Enabled"
else
notify-send -i microphone-sensitivity-muted -a "$DISCORD_ID" "Discord microphone" "Muted"
fi Don't forget set env |
thank you very much! I made my own script but it was very janky. I'll definitely use that |
I modified it a bit #!/bin/bash
: ${DISCORD_ID:=vesktop}
WANT_MUTE=$1
DEFAULT_SOURCE=$(pactl get-default-source)
STREAM_ID=`pw-dump | jq ".[] | select(.info.props.\"discord.id\" == \"${DISCORD_ID}\"and .info.props.\"media.name\" == \"RecordStream\") | .id"`
if [[ -z "$STREAM_ID" ]]; then
pactl set-source-mute $DEFAULT_SOURCE toggle
exit 0
fi
STATE=`pw-cli enum-params $STREAM_ID Props | awk '/Prop: key.*mute/{getline; print $2}'`
if [[ "$STATE" == "$WANT_MUTE" ]]; then
exit 0
fi
if [[ "$STATE" == "true" ]]; then
pw-cli set-param $STREAM_ID Props "{mute: false}" > /dev/null
pactl set-source-mute $DEFAULT_SOURCE 0
else
pw-cli set-param $STREAM_ID Props "{mute: true}" > /dev/null
pactl set-source-mute $DEFAULT_SOURCE 1
fi
if [ -e "$XDG_RUNTIME_DIR/vesktop-ipc" ]; then
echo "VCD_TOGGLE_SELF_MUTE" >> $XDG_RUNTIME_DIR/vesktop-ipc
fi |
if [[ "$STATE" == "$WANT_MUTE" ]]; then
pactl set-source-mute $DEFAULT_SOURCE toggle
exit 0
fi Why you toggle device micro here? In original script this condition prevent any changes for hold-key bindings, like that: modmap:
- name: In game
application:
only: [cs2, other-game.exe]
remap:
ALT_L:
skip_key_event: true
press: { launch: ["bash", "-c", "/path/to/script.sh", "false"] } # Enable micro
release: { launch: ["bash", "-c", "/path/to/script.sh", "true"] } # Mute micro |
yeah I realised that after sending it. I'll edit the message |
Discord Account
No response
Motivation
I would like to use a specific media key on my keyboard to mute and unmute.
Solution
Provide a way to mute/unmute with a command so I can execute it when the key is pressed.
Alternatives
global keybinds
Additional context
No response
Request Agreement
The text was updated successfully, but these errors were encountered: