commit cd53608fddeceb6e32a1cb615fc4feb038332c57
parent 28dd54352809d7858916c766cd0a33af5e7a53ad
Author: pyratebeard <root@pyratebeard.net>
Date: Mon, 19 Apr 2021 16:55:32 +0100
dirty ptt script and 2bwm keybinding
Diffstat:
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/2bwm/config.h b/2bwm/config.h
@@ -46,6 +46,7 @@ static const char *ignore_names[] = {"bar", "xclock"};
static const char *menucmd[] = { "/home/pyratebeard/bin/multi-interrobang", NULL };
static const char *terminal[] = { "urxvtc", NULL };
static const char *lock[] = { "/home/pyratebeard/bin/lock", NULL };
+static const char *ptt[] = { "/home/pyratebeard/bin/ptt", NULL };
///--Custom foo---///
static void halfandcentered(const Arg *arg)
{
@@ -210,6 +211,8 @@ static key keys[] = {
{ MOD , XK_w, start, {.com = menucmd}},
{ MOD , XK_Return, start, {.com = terminal}},
{ MOD , XK_z, start, {.com = lock}},
+ // Toggle ptt
+ { MOD , XK_p, start, {.com = ptt}},
// Exit or restart 2bwm
{ MOD |CONTROL, XK_q, twobwm_exit, {.i=0}},
{ MOD |CONTROL, XK_r, twobwm_restart, {.i=0}},
diff --git a/bin/bin/ptt b/bin/bin/ptt
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ptt_cmd=$(amixer set Capture toggle >/dev/null)
+
+set_nocap() {
+ /usr/bin/dunstctl close
+ /usr/bin/notify-send -u 'normal' 'muted'
+ /usr/bin/amixer set Capture nocap >/dev/null
+}
+
+set_cap() {
+ /usr/bin/notify-send -u 'critical' 'unmuted'
+ /usr/bin/amixer set Capture cap >/dev/null
+}
+
+case $(amixer get Capture | tail -n1 | awk '{print $NF}' | tr -d '[]') in
+ off) set_nocap ;;
+ on) set_cap ;;
+esac