I made a script that turns the power button red when the microphone is muted

I use an external mic, and occasionally use the mute keybind or push to talk in KDE plasma, and I keep talking when its muted and I never know. Thankfully, I stumbled upon a way to change the power button light color, so I used that to show the status. I originally wanted to use the mic light (closed source firmware), mouse light (mouse lags when updated), or camera light (idk how).

my repo is here:

let me know if there are any issues with it or any advice, its my first finished software project ever so i wouldnt be surprised if there are issues lol

2 Likes
  1. I’m curious how much battery this script will eat as the loop is constant.
    1. Linux has a lot of functionality, you could probably modify the alsamixer script (or whatever you use to toggle the mic) to just change the color upon changing the mic value. There will be no need
  2. The question is… why? :smiley: My mic is always on, I turn it off physically and I can see the switch in the red position already.

Interesting idea to use that light as indicator for something. For me, though, I just disable that light (battery light too). They’re too distracting for me.

Nice little script.
Fortunately, my mic device has a LED on it showing mute or not, but this little script would be useful to people who have mics without mute LEDs.

Some points to note.
The script is making calls to the EC. The EC is a very small, slow chip, so this might overload it a bit, preventing it from doing other important roles.
I suggest keeping a cached version of value last written to the EC, and only call the EC when it changes. The cached value has 3 levels.

  1. Don’t know. I.e. the value it has before its first write to the EC.
  2. Red
  3. White

Also, it might be worth rate limiting the loop. So it uses less CPU resources.

I’m new to Framework and Linux, and find it interesting that red denotes off in regards to camera and mic, since in, say, digital cameras and phone cameras with video, the ‘record’ button (recording ‘on’) is also red. In Apple’s and Ubuntu’s settings, slider switches are green or a chosen accent color for on, and gray for off, for example. I tend to be attuned to little interface things like this…

It’s occurred to me, as the Framework 13 I bought has physical switches for mic and camera in the display frame (I’ve been in the Apple world til now and never had a hardware switch for those), and as the machine came without any documentation, I was a bit confused.

When I wrote to Framework asking what pdfs or pages I could read to learn about the hardware (mic/camera switches, Expansion blocks and their LEDS, keyboard options I’d never seen before etc) they were also confused! but kindly sent an image and description of the cam/mic sliders. They pointed to the usual KB/Guides pages which really don’t explain things for a newb.

That a script for this, back to the OP, is possible is fascinating for me! There are some things I’d like on the Framework, that I have on the Mac, and maybe if I learn enough under the hood stuff I can get them working! Thanks for the Topic @TheGoldenfox64

1 Like