code: plan9front

Download patch

ref: 96601790b2847b87bbab95382ed7010fa230cbbc
parent: 11bc8cce33b3922e0fbc4f2d63a42426f6f5a4db
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Aug 29 16:57:14 EDT 2022

reform/shortcuts: use Kmod4+esc to (un)mute the audio

--- a/sys/man/1/reform
+++ b/sys/man/1/reform
@@ -130,7 +130,9 @@
 .I Super+F1/F2
 decreases/increases LCD brightness,
 .I Super+F3/F4
-decreases/increases "master" volume.
+decreases/increases "master" volume,
+.I Super+Escape
+(un)mutes the audio.
 Optionally, a single step amount can be set with
 .I -l
 for LCD light level (default is 5) and
--- a/sys/src/cmd/reform/shortcuts.c
+++ b/sys/src/cmd/reform/shortcuts.c
@@ -3,7 +3,7 @@
 #include <keyboard.h>
 
 static int lightstep = 5, volstep = 3;
-static int light, vol, mod;
+static int light, vol, actl, mod;
 
 static void
 process(char *s)
@@ -34,7 +34,7 @@
 				continue;
 			if(r == Kmod4)
 				mod = 0;
-		}else if(mod && r >= (KF|1) && r <= (KF|4)){
+		}else if(mod && ((r >= (KF|1) && r <= (KF|4) || r == Kesc))){
 			if(*s == 'c'){
 				if(r == (KF|1))
 					fprint(light, "lcd %+d", -lightstep);
@@ -44,9 +44,11 @@
 					fprint(vol, "master %+d", -volstep);
 				else if(r == (KF|4))
 					fprint(vol, "master %+d", volstep);
+				else if(r == Kesc)
+					fprint(actl, "master toggle");
 			}
 			continue;
-			}
+		}
 
 		memmove(b+o, p, n);
 		o += n;
@@ -87,6 +89,7 @@
 
 	light = open("/dev/light", OWRITE);
 	vol = open("/dev/volume", OWRITE);
+	actl = open("/dev/audioctl", OWRITE);
 	for(i = 0;;){
 		if((n = read(0, b+i, sizeof(b)-i)) <= 0)
 			break;