From d8d1f022c0896622fc109ef704e23f1b12062c20 Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Sat, 19 Oct 2024 23:42:58 +0400 Subject: [PATCH] Add mic-mute.sh for toggling microphone on/off --- debian/changelog | 6 ++++++ etc/skel/.config/river/keybindings.sh | 4 ++++ usr/share/river/scripts/mic-mute.sh | 14 ++++++++++++++ 3 files changed, 24 insertions(+) create mode 100755 usr/share/river/scripts/mic-mute.sh diff --git a/debian/changelog b/debian/changelog index b7bd4a9..1fb116f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +tileos-settings-river (1.2.0~tileos) unstable; urgency=medium + + * Add mic-mute.sh script for toggling microphone on/off + + -- Aleksey Samoilov Sat, 19 Oct 2024 23:41:50 +0400 + tileos-settings-river (1.1.5~tileos) unstable; urgency=medium * Updates from Sway edition diff --git a/etc/skel/.config/river/keybindings.sh b/etc/skel/.config/river/keybindings.sh index 91a3efe..9d519e9 100755 --- a/etc/skel/.config/river/keybindings.sh +++ b/etc/skel/.config/river/keybindings.sh @@ -12,6 +12,9 @@ launcher="eval rofi -show combi -combi-modi 'drun,run' -terminal $term -ssh-comm # Volume changing notify volume_bar="/usr/share/river/scripts/volume-notify.sh" +# Mic volume mute +mic_mute="/usr/share/river/scripts/mic-mute.sh" + # Brightness changing notify brightness_bar="/usr/share/river/scripts/brightness-notify.sh" @@ -153,6 +156,7 @@ do riverctl map $mode None XF86AudioRaiseVolume spawn "pulsemixer --change-volume +5 && $volume_bar" riverctl map $mode None XF86AudioLowerVolume spawn "pulsemixer --change-volume -5 && $volume_bar" riverctl map $mode None XF86AudioMute spawn "pulsemixer --toggle-mute && $volume_bar" + riverctl map $mode None XF86AudioMicMute spawn "$mic_mute" # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' diff --git a/usr/share/river/scripts/mic-mute.sh b/usr/share/river/scripts/mic-mute.sh new file mode 100755 index 0000000..5f4d97d --- /dev/null +++ b/usr/share/river/scripts/mic-mute.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +MIC="${1:-'Capture'}" + +amixer sset "$MIC" toggle + +STATE="$(amixer sget "$MIC",0 | sed -E -e '0,/^.*\[(on|off)\].*$/d' -e 's/^.*\[(\w+)\].*$/\1/')" + +test -n "$STATE" && notify-send \ + --app-name river \ + --expire-time 800 \ + "Microphone is $STATE"